Lately I’ve been going through the Xperia XA2 Ultra kernel (sdm660) and trying to add new features. Today I was adding in some governors, and several of them had the same underlying issues. Part of the problem was that I got the governors from a 3.10 kernel and put them into a 4.4 kernel, so understandably some things have changed.
I received a series of errors while compiling, complaining about early suspend. Here are some examples:
/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass2.c: undefined reference to `register_early_suspend’
/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass.c:739: undefined reference to `register_early_suspend’
/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:641: undefined reference to `register_early_suspend’
/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:670: undefined reference to `unregister_early_suspend’
field designator ‘suspend’ does not refer to any field in type ‘struct early_suspend’
All of these errors came after I had received an error about the compiler being unable to find linux/early_suspend.h. So I downloaded that file from the internet and put it in the include directory, only to realize that I needed the c file as well! Again, I downloaded the c file and put it in, only to find that the header and code file didn’t match. They were from different kernels and didn’t match up. Anyhow, once I found the most up to date version of the file, then I could actually use it! Here’s my commit if you want to check it out.
Either way, if you run into a similar message, make sure you have set “CONFIG_HAS_EARLYSUSPEND=Y” in your defconfig, or when you compile your kernel, it wont actually get turned on or built!
Linux – keep it simple.