This is probably a stupid question, but I looked for hours online and couldn\'t find an answer...
I\'m writing a kernel module that also creates a character device. It c
The function __class_create is exported only for GPL modules (exported with EXPORT_SYMBOL_GPL
). So, you need to use a GPL license with MODULE_LICENSE
macro to make use of that function. Same goes for other functions as well.
This should do the trick:
MODULE_LICENSE("GPL");
To learn about what exporting is, take a look at here. Basically, dynamic modules do not have access to variables and functions in kernel, and kernel needs to specify what to export, to enable access. That's the purpose of EXPORT_SYMBOL
and EXPORT_SYMBOL_GPL
macros, which are used everywhere.
And the difference between EXPORT_SYMBOL
and EXPORT_SYMBOL_GPL
is that the latter only reveals the function or the variable if the module is GPL licensed.