While working on the nightmare governor for the Xperia XA2 Ultra (sdm660), I ran into this error:
/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_nightmare.c:714:3: error: implicit declaration of function ‘INIT_DELAYED_WORK_DEFERRABLE’ [-Werror,-Wimplicit-function-declaration]
INIT_DELAYED_WORK_DEFERRABLE(&this_nightmare_cpuinfo->work, do_nightmare_timer);
^
/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_nightmare.c:714:3: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
2 errors generated.
On that line, I saw this:
INIT_DELAYED_WORK_DEFERRABLE(&this_nightmare_cpuinfo->work, do_nightmare_timer);
So I did a little digging, and found a great Linux resource site: https://elixir.bootlin.com
What makes it so great, is you can search each version of the kernel (back to 2.6.11) up to the latest version, and search for any term in them. A quick perusal found this term was used up to the 2.6.39 kernel in the include/linux/workque.h file. It goes like this:
#define INIT_DELAYED_WORK(_work, _func) \ do { \ INIT_WORK(&(_work)->work, (_func)); \ init_timer(&(_work)->timer); \ } while (0) #define INIT_DELAYED_WORK_ONSTACK(_work, _func) \ do { \ INIT_WORK_ONSTACK(&(_work)->work, (_func)); \ init_timer_on_stack(&(_work)->timer); \ } while (0) #define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \ do { \ INIT_WORK(&(_work)->work, (_func)); \ init_timer_deferrable(&(_work)->timer); \ } while (0)
But it was later changed to be like this in 4.4:
#define INIT_DELAYED_WORK(_work, _func) \ __INIT_DELAYED_WORK(_work, _func, 0) #define INIT_DELAYED_WORK_ONSTACK(_work, _func) \ __INIT_DELAYED_WORK_ONSTACK(_work, _func, 0) #define INIT_DEFERRABLE_WORK(_work, _func) \ __INIT_DELAYED_WORK(_work, _func, TIMER_DEFERRABLE) #define INIT_DEFERRABLE_WORK_ONSTACK(_work, _func) \ __INIT_DELAYED_WORK_ONSTACK(_work, _func, TIMER_DEFERRABLE)
So, I edited the gov like by changing to the newer definition which seems to do the same thing:
INIT_DELAYED_WORK_ONSTACK(&this_nightmare_cpuinfo->work, do_nightmare_timer);
And, praise God! It even worked! I love it when you can find good, helpful resources out there. I know I’ve bookmarked elixir! I’ll be using that reference again!
Linux – keep it simple.