i2c: designware: Replace MODULE_ALIAS() with MODULE_DEVICE_TABLE()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 25 Apr 2024 21:44:34 +0000 (14:44 -0700)
committerAndi Shyti <andi.shyti@kernel.org>
Sun, 5 May 2024 22:56:55 +0000 (00:56 +0200)
As Krzysztof Kozlowski pointed out the better is to use
MODULE_DEVICE_TABLE() as it will be consistent with the content
of the real ID table of the platform devices.

While at it, drop unneeded and unused module alias in PCI glue
driver as PCI already has its own ID table and automatic loading
should just work.

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Serge Semin <fancer.lancer@gmail.com>
Link: https://lore.kernel.org/r/20231120144641.1660574-9-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-designware-pcidrv.c
drivers/i2c/busses/i2c-designware-platdrv.c

index 9be9a2658e1f6ede697906827b26da319b098902..a1b379a1e9040127af7743e927baf49969cd88d9 100644 (file)
@@ -424,8 +424,6 @@ static struct pci_driver dw_i2c_driver = {
 };
 module_pci_driver(dw_i2c_driver);
 
-/* Work with hotplug and coldplug */
-MODULE_ALIAS("i2c_designware-pci");
 MODULE_AUTHOR("Baruch Siach <baruch@tkos.co.il>");
 MODULE_DESCRIPTION("Synopsys DesignWare PCI I2C bus adapter");
 MODULE_LICENSE("GPL");
index 926fb74a85703cb51edc93ad586190a06fee1091..29aac9c873684a8ab3d254ff4060cef6e610af62 100644 (file)
@@ -480,8 +480,11 @@ static const struct dev_pm_ops dw_i2c_dev_pm_ops = {
        RUNTIME_PM_OPS(dw_i2c_plat_runtime_suspend, dw_i2c_plat_runtime_resume, NULL)
 };
 
-/* Work with hotplug and coldplug */
-MODULE_ALIAS("platform:i2c_designware");
+static const struct platform_device_id dw_i2c_platform_ids[] = {
+       { "i2c_designware" },
+       {}
+};
+MODULE_DEVICE_TABLE(platform, dw_i2c_platform_ids);
 
 static struct platform_driver dw_i2c_driver = {
        .probe = dw_i2c_plat_probe,
@@ -492,6 +495,7 @@ static struct platform_driver dw_i2c_driver = {
                .acpi_match_table = ACPI_PTR(dw_i2c_acpi_match),
                .pm     = pm_ptr(&dw_i2c_dev_pm_ops),
        },
+       .id_table = dw_i2c_platform_ids,
 };
 
 static int __init dw_i2c_init_driver(void)