On 9/18/24 14:29, Andreas Kemnade wrote:
Avoid requiring MODULE_ALIASES by declaring proper device id tables.
Signed-off-by: Andreas Kemnade <andreas@xxxxxxxxxxxx>
This needs a better rationale. There are more than 40 watchdog drivers
using MODULE_ALIAS. I would hate having to deal with 40+ patches just
for cosmetic reasons, not counting the thousands of instances of
MODULE_ALIAS in the kernel, including the more than 1,000 instances of
"MODULE_ALIAS.*platform:".
Guenter
---
drivers/watchdog/rn5t618_wdt.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c
index 87d06d210ac9..97ef54f01ed9 100644
--- a/drivers/watchdog/rn5t618_wdt.c
+++ b/drivers/watchdog/rn5t618_wdt.c
@@ -8,6 +8,7 @@
#include <linux/device.h>
#include <linux/mfd/rn5t618.h>
#include <linux/module.h>
+#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/watchdog.h>
@@ -181,16 +182,25 @@ static int rn5t618_wdt_probe(struct platform_device *pdev)
return devm_watchdog_register_device(dev, &wdt->wdt_dev);
}
+static const struct platform_device_id rn5t618_wdt_id[] = {
+ {
+ .name = "rn5t618-wdt",
+ }, {
+ /* sentinel */
+ }
+};
+MODULE_DEVICE_TABLE(platform, rn5t618_wdt_id);
+
static struct platform_driver rn5t618_wdt_driver = {
.probe = rn5t618_wdt_probe,
.driver = {
.name = DRIVER_NAME,
},
+ .id_table = rn5t618_wdt_id,
};
module_platform_driver(rn5t618_wdt_driver);
-MODULE_ALIAS("platform:rn5t618-wdt");
MODULE_AUTHOR("Beniamino Galvani <b.galvani@xxxxxxxxx>");
MODULE_DESCRIPTION("RN5T618 watchdog driver");
MODULE_LICENSE("GPL v2");