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

hwmon: (sch56xx) Autoload modules on platform device creation

Right now, when sch56xx-common has detected a SCH5627/SCH5636
superio chip, the corresponding module is not automatically
loaded.
Fix that by adding the necessary device tables to both modules.

Tested on a Fujitsu Esprimo P720.

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20220131211935.3656-2-W_Armin@gmx.de
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Armin Wolf and committed by
Guenter Roeck
4db3c092 07320c91

+20
+10
drivers/hwmon/sch5627.c
··· 7 7 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 8 8 9 9 #include <linux/module.h> 10 + #include <linux/mod_devicetable.h> 10 11 #include <linux/init.h> 11 12 #include <linux/slab.h> 12 13 #include <linux/jiffies.h> ··· 457 456 return 0; 458 457 } 459 458 459 + static const struct platform_device_id sch5627_device_id[] = { 460 + { 461 + .name = "sch5627", 462 + }, 463 + { } 464 + }; 465 + MODULE_DEVICE_TABLE(platform, sch5627_device_id); 466 + 460 467 static struct platform_driver sch5627_driver = { 461 468 .driver = { 462 469 .name = DRVNAME, 463 470 }, 464 471 .probe = sch5627_probe, 472 + .id_table = sch5627_device_id, 465 473 }; 466 474 467 475 module_platform_driver(sch5627_driver);
+10
drivers/hwmon/sch5636.c
··· 7 7 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 8 8 9 9 #include <linux/module.h> 10 + #include <linux/mod_devicetable.h> 10 11 #include <linux/init.h> 11 12 #include <linux/slab.h> 12 13 #include <linux/jiffies.h> ··· 502 501 return err; 503 502 } 504 503 504 + static const struct platform_device_id sch5636_device_id[] = { 505 + { 506 + .name = "sch5636", 507 + }, 508 + { } 509 + }; 510 + MODULE_DEVICE_TABLE(platform, sch5636_device_id); 511 + 505 512 static struct platform_driver sch5636_driver = { 506 513 .driver = { 507 514 .name = DRVNAME, 508 515 }, 509 516 .probe = sch5636_probe, 510 517 .remove = sch5636_remove, 518 + .id_table = sch5636_device_id, 511 519 }; 512 520 513 521 module_platform_driver(sch5636_driver);