[PATCH] hwmon: (core) Constify PEC device attribute
Thomas Weißschuh <[email protected]>
| Newsgroups | org.kernel.vger.linux-hwmon,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260807-sysfs-const-attr-hwmon-2-v1-1-d16341379a97@weissschuh.net> |
Mark the attribute structure as const, as it is never modified. Signed-off-by: Thomas Weißschuh <[email protected]> --- This should have been part of commit 5d27101b6f1c ("hwmon: (core) Constify device attributes"). If you do a rebase anyways, maybe you could fold them together. --- drivers/hwmon/hwmon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index 90ceb815f43e..3297ed6daec1 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -341,7 +341,7 @@ static int hwmon_match_device(struct device *dev, const void *data) return dev->class == &hwmon_class; } -static ssize_t pec_show(struct device *dev, struct device_attribute *dummy, +static ssize_t pec_show(struct device *dev, const struct device_attribute *dummy, char *buf) { struct i2c_client *client = to_i2c_client(dev); @@ -349,7 +349,7 @@ static ssize_t pec_show(struct device *dev, struct device_attribute *dummy, return sysfs_emit(buf, "%d\n", !!(client->flags & I2C_CLIENT_PEC)); } -static ssize_t pec_store(struct device *dev, struct device_attribute *devattr, +static ssize_t pec_store(struct device *dev, const struct device_attribute *devattr, const char *buf, size_t count) { struct i2c_client *client = to_i2c_client(dev); @@ -390,7 +390,7 @@ static ssize_t pec_store(struct device *dev, struct device_attribute *devattr, return err; } -static DEVICE_ATTR_RW(pec); +static const DEVICE_ATTR_RW(pec); static void hwmon_remove_pec(void *dev) { --- base-commit: 611f4cbac429c09a7db4bb2aebf64e3423109639 change-id: 20260807-sysfs-const-attr-hwmon-2-43bd646c0c67 Best regards, -- Thomas Weißschuh <[email protected]>