hwmon: (pmbus/ltc4286) support building the sensor as a module
Subsystems (2)
PATCH 1/1 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.
---
The original patch was prepared with Gemini. Codex assisted with this review and revision (Assisted-by: gpt 5).
Built ltc4286.o on x86-64 with GCC 11.4 and W=1 (CONFIG_PMBUS=m, CONFIG_SENSORS_LTC4286=m). The object contains both I2C and OF device-table symbols. No runtime or hardware test was performed.
drivers/hwmon/pmbus/Kconfig | 5 ++++- drivers/hwmon/pmbus/ltc4286.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/hwmon/pmbus/Kconfig +4 -1
@@ -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
drivers/hwmon/pmbus/ltc4286.c +1 -0
@@ -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 = {
base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 8 lines
With PMBUS=m,
Kbuilddescends 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.
Quoted 4 lines
The issue was found by our static-analysis tool and manually reviewed.
Fixes 0c459759ca97 ("hwmon: (pmbus) Add ltc4286 driver")Signed-off-by Pengpeng Hou <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 8 lines · Pengpeng Hou
With PMBUS=m,
Kbuilddescends 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.
Quoted 4 lines
The issue was found by our static-analysis tool and manually reviewed.
Fixes 0c459759ca97 ("hwmon: (pmbus) Add ltc4286 driver")Signed-off-by Pengpeng Hou <[email protected]>
Applied.
Thanks,
Guenter