[PATCH v2] hwmon: (adt7462) Add of_match_table to support devicetree
From: Romain Gantois
Date: Mon Jun 08 2026 - 12:01:47 EST
From: Kory Maincent <kory.maincent@xxxxxxxxxxx>
Add of_match_table to add support of devicetree probing.
Signed-off-by: Kory Maincent <kory.maincent@xxxxxxxxxxx>
[rgantois: Removed of_match_ptr().]
Signed-off-by: Romain Gantois <romain.gantois@xxxxxxxxxxx>
---
Changes in v2:
- Dropped usage of of_match_ptr().
- Removed redundant device tree bindings.
- Link to v1: https://patch.msgid.link/20260603-adt7462-bindings-v1-0-301304bcf774@xxxxxxxxxxx
To: Guenter Roeck <linux@xxxxxxxxxxxx>
Cc: Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxx>
Cc: linux-hwmon@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
drivers/hwmon/adt7462.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
index 174dfee47f7a7..f935c3477b364 100644
--- a/drivers/hwmon/adt7462.c
+++ b/drivers/hwmon/adt7462.c
@@ -12,6 +12,7 @@
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <linux/err.h>
+#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/log2.h>
#include <linux/slab.h>
@@ -1814,10 +1815,17 @@ static const struct i2c_device_id adt7462_id[] = {
};
MODULE_DEVICE_TABLE(i2c, adt7462_id);
+static const struct of_device_id adt7462_of_match[] = {
+ { .compatible = "onnn,adt7462" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, adt7462_of_match);
+
static struct i2c_driver adt7462_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = "adt7462",
+ .of_match_table = adt7462_of_match,
},
.probe = adt7462_probe,
.id_table = adt7462_id,
---
base-commit: ddd664bbff63e09e7a7f9acae9c43605d4cf185f
change-id: 20260603-adt7462-bindings-5ecf3037040f
Best regards,
--
Romain Gantois <romain.gantois@xxxxxxxxxxx>