What is this MODULE_ALIAS() used for?
Giedrius Statkevičius
giedrius.statkevicius at gmail.com
Sat Dec 10 03:40:56 EST 2016
On Sat, Dec 10, 2016 at 3:36 AM, Perr Zhang <strongbox8 at zoho.com> wrote:
> 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?
>
>
>
MODULE_ALIAS() adds some more info for the userspace programs. In
/lib/modules/VERSION/modules.alias you can see the aliases that were parsed from
the modules. In your case, running `modprobe platform:sm501` would insert the
sm501 module.
Thanks,
Giedrius
More information about the Kernelnewbies
mailing list