summaryrefslogtreecommitdiff
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2026-08-06 08:09:11 +0200
committerGuenter Roeck <linux@roeck-us.net>2026-08-10 08:59:43 -0700
commitdafe7f1ec9db8f92a575a22f67d4f0f28bf10657 (patch)
treefd657e2f2f38d64e53def08e445eec7c816a4d48 /drivers/hwmon
parent9c110a467686ee84e951a8a3cc518afc9de7eeef (diff)
hwmon: (core) Constify device attributes
Mark the attribute structures as const, as they are never modified. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://lore.kernel.org/r/20260806-sysfs-const-attr-hwmon-v2-1-22fee8b85509@weissschuh.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/hwmon.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 29dc90a2c3fe..f1051b89c564 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -71,27 +71,27 @@ struct hwmon_thermal_data {
};
static ssize_t
-name_show(struct device *dev, struct device_attribute *attr, char *buf)
+name_show(struct device *dev, const struct device_attribute *attr, char *buf)
{
return sysfs_emit(buf, "%s\n", to_hwmon_device(dev)->name);
}
-static DEVICE_ATTR_RO(name);
+static const DEVICE_ATTR_RO(name);
static ssize_t
-label_show(struct device *dev, struct device_attribute *attr, char *buf)
+label_show(struct device *dev, const struct device_attribute *attr, char *buf)
{
return sysfs_emit(buf, "%s\n", to_hwmon_device(dev)->label);
}
-static DEVICE_ATTR_RO(label);
+static const DEVICE_ATTR_RO(label);
-static struct attribute *hwmon_dev_attrs[] = {
+static const struct attribute *const hwmon_dev_attrs[] = {
&dev_attr_name.attr,
&dev_attr_label.attr,
NULL
};
static umode_t hwmon_dev_attr_is_visible(struct kobject *kobj,
- struct attribute *attr, int n)
+ const struct attribute *attr, int n)
{
struct device *dev = kobj_to_dev(kobj);
struct hwmon_device *hdev = to_hwmon_device(dev);
@@ -106,8 +106,8 @@ static umode_t hwmon_dev_attr_is_visible(struct kobject *kobj,
}
static const struct attribute_group hwmon_dev_attr_group = {
- .attrs = hwmon_dev_attrs,
- .is_visible = hwmon_dev_attr_is_visible,
+ .attrs_const = hwmon_dev_attrs,
+ .is_visible_const = hwmon_dev_attr_is_visible,
};
static const struct attribute_group *hwmon_dev_attr_groups[] = {