]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
EDAC/device: Allow addition of const sysfs attributes
authorThomas Weißschuh <linux@weissschuh.net>
Mon, 23 Feb 2026 21:16:33 +0000 (22:16 +0100)
committerBorislav Petkov (AMD) <bp@alien8.de>
Wed, 11 Mar 2026 21:33:38 +0000 (22:33 +0100)
The generic EDAC sysfs code does not need to modify these structs.
Allow the drivers to add read-only ones.

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-6-3ff0b87249e7@weissschuh.net
drivers/edac/edac_device.h
drivers/edac/edac_device_sysfs.c

index 034711d71ebf63de1300283d4f49c2b7f683fa50..24c1921aa49034a20abcce0cba22fbbc63abe0f5 100644 (file)
@@ -163,7 +163,7 @@ struct edac_device_ctl_info {
         * If attributes are desired, then set to array of attributes
         * If no attributes are desired, leave NULL
         */
-       struct edac_dev_sysfs_attribute *sysfs_attributes;
+       const struct edac_dev_sysfs_attribute *sysfs_attributes;
 
        /* pointer to main 'edac' subsys in sysfs */
        const struct bus_type *edac_subsys;
index 754d448279427b7820c4f0bb667f3ccab8631595..b1c2717cd0237b9c3b6b4af1b766a1f78b3e1649 100644 (file)
@@ -723,7 +723,7 @@ static void edac_device_delete_instances(struct edac_device_ctl_info *edac_dev)
 static int edac_device_add_main_sysfs_attributes(
                        struct edac_device_ctl_info *edac_dev)
 {
-       struct edac_dev_sysfs_attribute *sysfs_attrib;
+       const struct edac_dev_sysfs_attribute *sysfs_attrib;
        int err = 0;
 
        sysfs_attrib = edac_dev->sysfs_attributes;
@@ -752,7 +752,7 @@ err_out:
 static void edac_device_remove_main_sysfs_attributes(
                        struct edac_device_ctl_info *edac_dev)
 {
-       struct edac_dev_sysfs_attribute *sysfs_attrib;
+       const struct edac_dev_sysfs_attribute *sysfs_attrib;
 
        /* if there are main attributes, defined, remove them. First,
         * point to the start of the array and iterate over it