What is this MODULE_ALIAS() used for?

Aruna Hewapathirane aruna.hewapathirane at gmail.com
Wed Dec 14 08:01:14 EST 2016


> source code:
>
> MODULE_ALIAS("platform:sm501");
>
> static const struct of_device_id of_sm501_match_tbl[] = {
>     { .compatible = "smi,sm501", },
>     { /* end */ }
> };
> MODULE_DEVICE_TABLE(of, of_sm501_match_tbl);
>
> location: http://lxr.free-electrons.com/source/drivers/mfd/sm501.c#L1711
>
> Since there is the MODULE_DEVICE_TABLE(), why  the author additionally
adds the MODULE_ALIAS()?
> What exactly is this MODULE_ALIAS() used for?

Short answer: to re-enable auto loading of the module, Please refer subject
line here:
https://lab.nexedi.cn/kirr/linux/commit/4f46d6e7e5ffbce0ee1d1a80767fdf45e56cc863

Long answer:
https://kerneltweaks.wordpress.com/2014/03/30/platform-device-and-platform-driver-linux/

References:
Review the section kmod vs kerneld: http://lpic2.unix.nl/ch02s03.html

What is MODULE_ALIAS:
http://stackoverflow.com/questions/22778879/what-is-module-alias-in-linux-device-driver-code

Review Alias section:
https://wiki.debian.org/Modules#Automatic_loading_of_modules

Review Identifying Device Driver Modules:
http://free-electrons.com/doc/udev.pdf

Useful to know:
1 - https://frankpzh.wordpress.com/2011/04/16/kmod-udev-and-modprobe/
2 -
https://www.quora.com/What-is-the-difference-between-platform-device-drivers-and-normal-device-drivers
3 - http://www.atmel.com/Images/doc32098.pdf

Where it all began:
http://www.linuxjournal.com/node/5604/print

Hope this helps.

Thanks - Aruna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20161214/5535050f/attachment.html 


More information about the Kernelnewbies mailing list