[PATCH 2/2] hwmon: (adt7462) Add of_match_table to support devicetree

From: Romain Gantois

Date: Wed Jun 03 2026 - 07:33:35 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>
Signed-off-by: Romain Gantois <romain.gantois@xxxxxxxxxxx>
---
drivers/hwmon/adt7462.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
index 174dfee47f7a7..ef6e5252dc0a4 100644
--- a/drivers/hwmon/adt7462.c
+++ b/drivers/hwmon/adt7462.c
@@ -1814,10 +1814,17 @@ static const struct i2c_device_id adt7462_id[] = {
};
MODULE_DEVICE_TABLE(i2c, adt7462_id);

+static const struct of_device_id __maybe_unused adt7462_of_match[] = {
+ { .compatible = "adi,adt7462" },
+ { },
+};
+MODULE_DEVICE_TABLE(of, adt7462_of_match);
+
static struct i2c_driver adt7462_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = "adt7462",
+ .of_match_table = of_match_ptr(adt7462_of_match),
},
.probe = adt7462_probe,
.id_table = adt7462_id,

--
2.54.0