Commit fe9810da1280 for kernel
commit fe9810da12806b2903d9a0f72c6ee21e3106b045
Author: Pengpeng Hou <hppiscas@163.com>
Date: Fri Dec 4 09:50:38 2026 +0800
hwmon: (pmbus/ltc4286) support building the sensor as a module
With PMBUS=m, Kbuild descends into pmbus/ for modules. An ltc4286 object
placed in obj-y by the boolean sensor option is not part of that build.
Make the sensor option tristate. Export its existing OF match table as
well: an I2C client instantiated from a device tree can produce an OF
modalias rather than an i2c modalias. Keep the existing I2C IDs for
other clients.
The issue was found by our static-analysis tool and manually reviewed.
Fixes: 0c459759ca97 ("hwmon: (pmbus) Add ltc4286 driver")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
Link: https://patch.msgid.link/179634903882.74470.12607115542458648726@163.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index fd6641316454..6a4a1ab257de 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -320,7 +320,7 @@ config SENSORS_LTC3815
be called ltc3815.
config SENSORS_LTC4286
- bool "Analog Devices LTC4286"
+ tristate "Analog Devices LTC4286"
help
LTC4286 is an integrated solution for hot swap applications that
allows a board to be safely inserted and removed from a live
@@ -329,6 +329,9 @@ config SENSORS_LTC4286
If you say yes here you get hardware monitoring support for Analog
Devices LTC4286.
+ This driver can also be built as a module. If so, the module will
+ be called ltc4286.
+
config SENSORS_LX1308
tristate "Luxshare LX1308 DC/DC Power Module"
help
diff --git a/drivers/hwmon/pmbus/ltc4286.c b/drivers/hwmon/pmbus/ltc4286.c
index ea2f9a5a4b24..7e6c2e911d16 100644
--- a/drivers/hwmon/pmbus/ltc4286.c
+++ b/drivers/hwmon/pmbus/ltc4286.c
@@ -246,6 +246,7 @@ static const struct of_device_id ltc4286_of_match[] = {
{ .compatible = "lltc,ltc4287" },
{}
};
+MODULE_DEVICE_TABLE(of, ltc4286_of_match);
static struct i2c_driver ltc4286_driver = {
.driver = {