error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes] MODULE_LICENSE(“GPL”);

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.

So here is a funny one. Since I was updating a few governors for a newer kernel, one of the things that must have been previously declared somewhere was to include the “module.h” file that allows modules to have tags. These tags are benign, and are only for reference, since they just state text such as the version number or the license type or title of the module.

However, it will stop your compiler dead in it’s tracks if you run into this, just like it did for me. Here’s a few examples:

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_brazilianwax.c:826:16: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
MODULE_LICENSE (“GPL”);

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_smartass.c:751:15: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
MODULE_AUTHOR (“Erasmux”);

 

/home/alaskalinuxuser/aokp_pie/kernel/sony/sdm660/drivers/cpufreq/cpufreq_interactivex.c:768:15: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
MODULE_LICENSE(“GPL”);

It’s easy to fix, though, since all you have to do is include the modules.h file, like so:

#include <linux/module.h>

Just put it with the other includes at the beginning of the file, and you should be good to go.

Linux – keep it simple.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s