[PATCH] hwmon: (lm77) Provide of_match_table to allow module auto loading

From: Lukasz Majewski

Date: Fri Nov 13 2026 - 14:33:40 EST


When lm77 is built as a module and it is properly described in the
board's DTS file (i.e. with proper compatible) it is required to have
the in-driver compatible definition as well to allow automatic loading
of it.

Up till now the lm77 used I2C discovery fallback routine to bind it with
its name.

Signed-off-by: Lukasz Majewski <lukma@xxxxxxxxxxxx>
---
drivers/hwmon/lm77.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c
index 1f8402be599c..440dd91de39d 100644
--- a/drivers/hwmon/lm77.c
+++ b/drivers/hwmon/lm77.c
@@ -336,6 +336,12 @@ static int lm77_probe(struct i2c_client *client)
return PTR_ERR_OR_ZERO(hwmon_dev);
}

+static const struct of_device_id lm77_of_match[] = {
+ { .compatible = "national,lm77" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, lm77_of_match);
+
static const struct i2c_device_id lm77_id[] = {
{ .name = "lm77" },
{ }
@@ -347,6 +353,7 @@ static struct i2c_driver lm77_driver = {
.class = I2C_CLASS_HWMON,
.driver = {
.name = "lm77",
+ .of_match_table = lm77_of_match,
},
.probe = lm77_probe,
.id_table = lm77_id,
--
2.47.3