[PATCH] hwmon: Move MODULE_DEVICE_TABLE next to the table itself

From: Krzysztof Kozlowski

Date: Tue May 05 2026 - 06:50:53 EST


By convention MODULE_DEVICE_TABLE() immediately follows the ID table it
exports, because this is easier to read and verify. It also makes more
sense since #ifdef for ACPI or OF could hide both of them.

Most of the privers already have this correctly placed, so adjust
the missing ones. No functional impact.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>
---
drivers/hwmon/applesmc.c | 2 +-
drivers/hwmon/cros_ec_hwmon.c | 2 +-
drivers/hwmon/intel-m10-bmc-hwmon.c | 2 +-
drivers/hwmon/nsa320-hwmon.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
index 24f3e86d0ebf..90a14a7f2c4c 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -1305,6 +1305,7 @@ static const struct dmi_system_id applesmc_whitelist[] __initconst = {
},
{ .ident = NULL }
};
+MODULE_DEVICE_TABLE(dmi, applesmc_whitelist);

static int __init applesmc_init(void)
{
@@ -1416,4 +1417,3 @@ module_exit(applesmc_exit);
MODULE_AUTHOR("Nicolas Boichat");
MODULE_DESCRIPTION("Apple SMC");
MODULE_LICENSE("GPL v2");
-MODULE_DEVICE_TABLE(dmi, applesmc_whitelist);
diff --git a/drivers/hwmon/cros_ec_hwmon.c b/drivers/hwmon/cros_ec_hwmon.c
index 6cf5ab0f4b73..7c308b0a4b9e 100644
--- a/drivers/hwmon/cros_ec_hwmon.c
+++ b/drivers/hwmon/cros_ec_hwmon.c
@@ -657,6 +657,7 @@ static const struct platform_device_id cros_ec_hwmon_id[] = {
{ DRV_NAME, 0 },
{}
};
+MODULE_DEVICE_TABLE(platform, cros_ec_hwmon_id);

static struct platform_driver cros_ec_hwmon_driver = {
.driver.name = DRV_NAME,
@@ -667,7 +668,6 @@ static struct platform_driver cros_ec_hwmon_driver = {
};
module_platform_driver(cros_ec_hwmon_driver);

-MODULE_DEVICE_TABLE(platform, cros_ec_hwmon_id);
MODULE_DESCRIPTION("ChromeOS EC Hardware Monitoring Driver");
MODULE_AUTHOR("Thomas Weißschuh <linux@xxxxxxxxxxxxxx");
MODULE_LICENSE("GPL");
diff --git a/drivers/hwmon/intel-m10-bmc-hwmon.c b/drivers/hwmon/intel-m10-bmc-hwmon.c
index aa01a4bedc21..e85d42a45113 100644
--- a/drivers/hwmon/intel-m10-bmc-hwmon.c
+++ b/drivers/hwmon/intel-m10-bmc-hwmon.c
@@ -773,6 +773,7 @@ static const struct platform_device_id intel_m10bmc_hwmon_ids[] = {
},
{ }
};
+MODULE_DEVICE_TABLE(platform, intel_m10bmc_hwmon_ids);

static struct platform_driver intel_m10bmc_hwmon_driver = {
.probe = m10bmc_hwmon_probe,
@@ -783,7 +784,6 @@ static struct platform_driver intel_m10bmc_hwmon_driver = {
};
module_platform_driver(intel_m10bmc_hwmon_driver);

-MODULE_DEVICE_TABLE(platform, intel_m10bmc_hwmon_ids);
MODULE_AUTHOR("Intel Corporation");
MODULE_DESCRIPTION("Intel MAX 10 BMC hardware monitor");
MODULE_LICENSE("GPL");
diff --git a/drivers/hwmon/nsa320-hwmon.c b/drivers/hwmon/nsa320-hwmon.c
index 18076ba7fc14..5c99acc09677 100644
--- a/drivers/hwmon/nsa320-hwmon.c
+++ b/drivers/hwmon/nsa320-hwmon.c
@@ -153,6 +153,7 @@ static const struct of_device_id of_nsa320_hwmon_match[] = {
{ .compatible = "zyxel,nsa320-mcu", },
{ },
};
+MODULE_DEVICE_TABLE(of, of_nsa320_hwmon_match);

static int nsa320_hwmon_probe(struct platform_device *pdev)
{
@@ -197,7 +198,6 @@ static struct platform_driver nsa320_hwmon_driver = {

module_platform_driver(nsa320_hwmon_driver);

-MODULE_DEVICE_TABLE(of, of_nsa320_hwmon_match);
MODULE_AUTHOR("Peter Schildmann <linux@xxxxxxxxxxxxxxx>");
MODULE_AUTHOR("Adam Baker <linux@xxxxxxxxxxxxxxxx>");
MODULE_DESCRIPTION("NSA320 Hardware Monitoring");
--
2.51.0