> 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: >
> 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
https://kerneltweaks.wordpress.com/2014/03/30/platform-device-and-platform-driver-linux/
What is MODULE_ALIAS:
http://stackoverflow.com/questions/22778879/what-is-module-alias-in-linux-device-driver-code
Review Identifying Device Driver Modules:
http://free-electrons.com/doc/udev.pdf
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
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
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies