[PATCH] hwmon: (pmbus/core) notify on the hwmon device, not the i2c client

Vincent Jardin via B4 Relay posted 1 patch 13 hours ago
drivers/hwmon/pmbus/pmbus_core.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
[PATCH] hwmon: (pmbus/core) notify on the hwmon device, not the i2c client
Posted by Vincent Jardin via B4 Relay 13 hours ago
From: Vincent Jardin <vjardin@free.fr>

pmbus_notify() calls sysfs_notify() and kobject_uevent() on the i2c
client's kobject, but the alarm attributes live on the hwmon class
device registered by pmbus_do_probe(). Notifying the parent i2c device
is a no-op for both poll(POLLPRI) waiters and udev listeners: the named
attribute does not exist on that kobject.

Notify the hwmon device instead, so poll() wakes up and "change"
uevents fire on the inX_alarm/tempX_alarm attributes when SMBALERT#
reports a fault.

Fixes: f469bde9afd1 ("hwmon: (pmbus/core) Notify hwmon events")
Cc: stable@vger.kernel.org # v6.4+
Signed-off-by: Vincent Jardin <vjardin@free.fr>
---
Found during the review of the MPQ8646 series (v1):

  https://lore.kernel.org/all/20260723131352.182B61F000E9@smtp.kernel.org/

The sysfs_notify() half is a no-op today: the named attribute does not
exist on the i2c client's kobject. Note the KOBJ_CHANGE uevent source
moves from the i2c device to the hwmon class device, matching what
hwmon_notify_event() does.
---
 drivers/hwmon/pmbus/pmbus_core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 3143b9e0316c..0081f16c3a95 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -2985,8 +2985,9 @@ static void pmbus_notify(struct pmbus_data *data, int page, int reg, int flags)
 
 		if (reg == sreg && page == spage && (smask & flags)) {
 			dev_dbg(data->dev, "sysfs notify: %s", da->attr.name);
-			sysfs_notify(&data->dev->kobj, NULL, da->attr.name);
-			kobject_uevent(&data->dev->kobj, KOBJ_CHANGE);
+			sysfs_notify(&data->hwmon_dev->kobj, NULL,
+				     da->attr.name);
+			kobject_uevent(&data->hwmon_dev->kobj, KOBJ_CHANGE);
 			flags &= ~smask;
 		}
 

---
base-commit: 248951ddc14de84de3910f9b13f51491a8cd91df
change-id: 20260723-fix_hwmon_notify_v1-74e1a94346c1

Best regards,
-- 
Vincent Jardin <vjardin@free.fr>
Re: [PATCH] hwmon: (pmbus/core) notify on the hwmon device, not the i2c client
Posted by Guenter Roeck 11 hours ago
On Thu, Jul 23, 2026 at 05:44:56PM +0200, Vincent Jardin wrote:
> From: Vincent Jardin <vjardin@free.fr>
> 
> pmbus_notify() calls sysfs_notify() and kobject_uevent() on the i2c
> client's kobject, but the alarm attributes live on the hwmon class
> device registered by pmbus_do_probe(). Notifying the parent i2c device
> is a no-op for both poll(POLLPRI) waiters and udev listeners: the named
> attribute does not exist on that kobject.
> 
> Notify the hwmon device instead, so poll() wakes up and "change"
> uevents fire on the inX_alarm/tempX_alarm attributes when SMBALERT#
> reports a fault.
> 
> Fixes: f469bde9afd1 ("hwmon: (pmbus/core) Notify hwmon events")
> Cc: stable@vger.kernel.org # v6.4+
> Signed-off-by: Vincent Jardin <vjardin@free.fr>

Applied.

Thanks,
Guenter