Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwrng: meson - Fix module autoload for OF registration

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/char/hw_random/meson-rng.ko | grep alias
alias: platform:meson-rng

After this patch:

$ modinfo drivers/char/hw_random/meson-rng.ko | grep alias
alias: platform:meson-rng
alias: of:N*T*Camlogic,meson-rngC*
alias: of:N*T*Camlogic,meson-rng

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Javier Martinez Canillas and committed by
Herbert Xu
877f69a8 9b40f79c

+1
+1
drivers/char/hw_random/meson-rng.c
··· 110 110 { .compatible = "amlogic,meson-rng", }, 111 111 {}, 112 112 }; 113 + MODULE_DEVICE_TABLE(of, meson_rng_of_match); 113 114 114 115 static struct platform_driver meson_rng_driver = { 115 116 .probe = meson_rng_probe,