summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2026-02-24 00:16:31 +0300
committerBorislav Petkov (AMD) <bp@alien8.de>2026-03-12 00:20:20 +0300
commite72e70870a0b4955ca74e2a715f9bda4c08b252c (patch)
tree64bcd1e6eadca72a5be102df12fdf55735f1e3f9
parent495e77a575a1f3637cfc0cff53d889316dd00594 (diff)
downloadlinux-e72e70870a0b4955ca74e2a715f9bda4c08b252c.tar.xz
EDAC/device: Constify info sysfs attributes
These structures are never modified, mark them read-only. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://patch.msgid.link/20260223-sysfs-const-edac-v1-4-3ff0b87249e7@weissschuh.net
-rw-r--r--drivers/edac/edac_device_sysfs.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c
index 1e79f36a91fa..754d44827942 100644
--- a/drivers/edac/edac_device_sysfs.c
+++ b/drivers/edac/edac_device_sysfs.c
@@ -109,14 +109,14 @@ struct ctl_info_attribute {
};
#define to_ctl_info(k) container_of(k, struct edac_device_ctl_info, kobj)
-#define to_ctl_info_attr(a) container_of(a,struct ctl_info_attribute,attr)
+#define to_ctl_info_attr(a) container_of_const(a, struct ctl_info_attribute, attr)
/* Function to 'show' fields from the edac_dev 'ctl_info' structure */
static ssize_t edac_dev_ctl_info_show(struct kobject *kobj,
struct attribute *attr, char *buffer)
{
struct edac_device_ctl_info *edac_dev = to_ctl_info(kobj);
- struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);
+ const struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);
if (ctl_info_attr->show)
return ctl_info_attr->show(edac_dev, buffer);
@@ -129,7 +129,7 @@ static ssize_t edac_dev_ctl_info_store(struct kobject *kobj,
const char *buffer, size_t count)
{
struct edac_device_ctl_info *edac_dev = to_ctl_info(kobj);
- struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);
+ const struct ctl_info_attribute *ctl_info_attr = to_ctl_info_attr(attr);
if (ctl_info_attr->store)
return ctl_info_attr->store(edac_dev, buffer, count);
@@ -143,7 +143,7 @@ static const struct sysfs_ops device_ctl_info_ops = {
};
#define CTL_INFO_ATTR(_name,_mode,_show,_store) \
-static struct ctl_info_attribute attr_ctl_info_##_name = { \
+static const struct ctl_info_attribute attr_ctl_info_##_name = { \
.attr = {.name = __stringify(_name), .mode = _mode }, \
.show = _show, \
.store = _store, \
@@ -161,7 +161,7 @@ CTL_INFO_ATTR(poll_msec, S_IRUGO | S_IWUSR,
edac_device_ctl_poll_msec_show, edac_device_ctl_poll_msec_store);
/* Base Attributes of the EDAC_DEVICE ECC object */
-static struct attribute *device_ctrl_attrs[] = {
+static const struct attribute *const device_ctrl_attrs[] = {
&attr_ctl_info_panic_on_ue.attr,
&attr_ctl_info_log_ue.attr,
&attr_ctl_info_log_ce.attr,