Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] PMBus core's pmbus_notify() calls sysfs_notify() on the wrong kobject, silently breaking sysfs poll() and udev events for hardware alarms.
--
--- Patch [1]: [PATCH 1/3] hwmon: pmbus: event notification with alarms ---
commit 2d27260577dbfaf59cc5dfe956f36d8429cbffb8
Author: Vincent Jardin <[email protected]>
hwmon: pmbus: event notification with alarms
This commit introduces pmbus_get_hwmon_device() to allow PMBus chip drivers
to retrieve the hwmon class device for an i2c_client. This enables drivers
to call hwmon_notify_event() on per-sensor alarm attributes during work-item
polling when SMBALERT# is unavailable.
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 3143b9e0316c4..6ba00ad732973 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
[ ... ]
> @@ -695,6 +695,14 @@ const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client *client)
> }
> EXPORT_SYMBOL_NS_GPL(pmbus_get_driver_info, "PMBUS");
>
> +struct device *pmbus_get_hwmon_device(struct i2c_client *client)
> +{
> + struct pmbus_data *data = i2c_get_clientdata(client);
> +
> + return data->hwmon_dev;
> +}
> +EXPORT_SYMBOL_NS_GPL(pmbus_get_hwmon_device, "PMBUS");
> +
[Severity: High]
This is a pre-existing issue, but while looking at how hwmon devices are
exposed for alarm notification, I noticed that pmbus_notify() might be
sending notifications to the wrong kobject:
drivers/hwmon/pmbus/pmbus_core.c:pmbus_notify() {
...
sysfs_notify(&data->dev->kobj, NULL, da->attr.name);
kobject_uevent(&data->dev->kobj, KOBJ_CHANGE);
...
}
Since the hwmon attributes are attached to the hwmon device rather than the
parent I2C device, does sysfs_notify() fail to find the attribute and return
silently?
If so, this could prevent userspace processes polling on hardware alarm sysfs
attributes from being awakened when a hardware fault occurs, leaving alarms
unhandled.
Would it make sense to update pmbus_notify() to use data->hwmon_dev->kobj
instead to ensure poll() and udev events work correctly?
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.