]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
module: sysfs: Drop 'struct module_sect_attr'
authorThomas Weißschuh <linux@weissschuh.net>
Fri, 27 Dec 2024 13:23:22 +0000 (14:23 +0100)
committerPetr Pavlu <petr.pavlu@suse.com>
Sun, 26 Jan 2025 12:05:24 +0000 (13:05 +0100)
This is now an otherwise empty wrapper around a 'struct bin_attribute',
not providing any functionality. Remove it.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Reviewed-by: Petr Pavlu <petr.pavlu@suse.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20241227-sysfs-const-bin_attr-module-v2-3-e267275f0f37@weissschuh.net
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
kernel/module/sysfs.c

index 6941ecc941d7c853c5a3dc9b905a563959c6af3a..89797c556e8c51141ae095eb7004f997bf791e80 100644 (file)
  * J. Corbet <corbet@lwn.net>
  */
 #ifdef CONFIG_KALLSYMS
-struct module_sect_attr {
-       struct bin_attribute battr;
-};
-
 struct module_sect_attrs {
        struct attribute_group grp;
-       struct module_sect_attr attrs[];
+       struct bin_attribute attrs[];
 };
 
 #define MODULE_SECT_READ_SIZE (3 /* "0x", "\n" */ + (BITS_PER_LONG / 4))
@@ -69,8 +65,8 @@ static int add_sect_attrs(struct module *mod, const struct load_info *info)
 {
        unsigned int nloaded = 0, i, size[2];
        struct module_sect_attrs *sect_attrs;
-       struct module_sect_attr *sattr;
        struct bin_attribute **gattr;
+       struct bin_attribute *sattr;
        int ret;
 
        /* Count loaded sections and allocate structures */
@@ -95,18 +91,18 @@ static int add_sect_attrs(struct module *mod, const struct load_info *info)
 
                if (sect_empty(sec))
                        continue;
-               sysfs_bin_attr_init(&sattr->battr);
-               sattr->battr.attr.name =
+               sysfs_bin_attr_init(sattr);
+               sattr->attr.name =
                        kstrdup(info->secstrings + sec->sh_name, GFP_KERNEL);
-               if (!sattr->battr.attr.name) {
+               if (!sattr->attr.name) {
                        ret = -ENOMEM;
                        goto out;
                }
-               sattr->battr.read = module_sect_read;
-               sattr->battr.private = (void *)sec->sh_addr;
-               sattr->battr.size = MODULE_SECT_READ_SIZE;
-               sattr->battr.attr.mode = 0400;
-               *(gattr++) = &(sattr++)->battr;
+               sattr->read = module_sect_read;
+               sattr->private = (void *)sec->sh_addr;
+               sattr->size = MODULE_SECT_READ_SIZE;
+               sattr->attr.mode = 0400;
+               *(gattr++) = sattr++;
        }
        *gattr = NULL;
 
@@ -186,7 +182,7 @@ static int add_notes_attrs(struct module *mod, const struct load_info *info)
                        continue;
                if (info->sechdrs[i].sh_type == SHT_NOTE) {
                        sysfs_bin_attr_init(nattr);
-                       nattr->attr.name = mod->sect_attrs->attrs[loaded].battr.attr.name;
+                       nattr->attr.name = mod->sect_attrs->attrs[loaded].attr.name;
                        nattr->attr.mode = 0444;
                        nattr->size = info->sechdrs[i].sh_size;
                        nattr->private = (void *)info->sechdrs[i].sh_addr;