Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [PATCH] hwmon: (pmbus/ltc4286) support building the sensor as a module
@ 2026-12-04  1:50 Pengpeng Hou
  2026-12-04  1:57 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-12-04  1:50 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-hwmon, linux-kernel, Delphine CC Chiu, Pengpeng Hou

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>
---
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(-)

diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index fd6641316454f00eef8d7b7502da9d76c7ed2c4e..6a4a1ab257deaad79da021115fab83b990803358 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 ea2f9a5a4b24973b577a2292ce76ab70e4430cdc..7e6c2e911d1647758d01a4931ca1b75b18dad43a 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 = {

base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-04  1:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04  1:50 [PATCH] hwmon: (pmbus/ltc4286) support building the sensor as a module Pengpeng Hou
2026-12-04  1:57 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox