]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
hwmon: (adt7410): Add OF match table
authorNuno Sá <nuno.sa@analog.com>
Wed, 15 Oct 2025 14:52:20 +0000 (15:52 +0100)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 16 Oct 2025 20:45:35 +0000 (13:45 -0700)
Add a struct of_device_id match table to the driver.

While at it, make sure to properly include mod_devicetable.h which is
also needed for struct i2c_device_id.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20251015-dev-add-adt7422-v1-2-7cf72d3253ad@analog.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/adt7410.c

index 3bf0e0a0882c11758dae8a528b91ec1156395c88..79952866a4db48f0dbc6aabcf56558209c9ecf6a 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 #include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/regmap.h>
@@ -94,10 +95,18 @@ static const struct i2c_device_id adt7410_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adt7410_ids);
 
+static const struct of_device_id adt7410_of_match[] = {
+       { .compatible = "adi,adt7410" },
+       { .compatible = "adi,adt7420" },
+       { }
+};
+MODULE_DEVICE_TABLE(of, adt7410_of_match);
+
 static struct i2c_driver adt7410_driver = {
        .driver = {
                .name   = "adt7410",
                .pm     = pm_sleep_ptr(&adt7x10_dev_pm_ops),
+               .of_match_table = adt7410_of_match,
        },
        .probe          = adt7410_i2c_probe,
        .id_table       = adt7410_ids,