Commit 361795b1 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Greg Kroah-Hartman

sysfs: Use sysfs_attr_init and sysfs_bin_attr_init on module dynamic attributes

A little more whack-a-mole annotating the dynamic sysfs attributes.  I
had everything built into my earlier test kernel, and so I missed
these.
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 35960258
...@@ -1085,6 +1085,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect, ...@@ -1085,6 +1085,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
if (sattr->name == NULL) if (sattr->name == NULL)
goto out; goto out;
sect_attrs->nsections++; sect_attrs->nsections++;
sysfs_attr_init(&sattr->mattr.attr);
sattr->mattr.show = module_sect_show; sattr->mattr.show = module_sect_show;
sattr->mattr.store = NULL; sattr->mattr.store = NULL;
sattr->mattr.attr.name = sattr->name; sattr->mattr.attr.name = sattr->name;
...@@ -1180,6 +1181,7 @@ static void add_notes_attrs(struct module *mod, unsigned int nsect, ...@@ -1180,6 +1181,7 @@ static void add_notes_attrs(struct module *mod, unsigned int nsect,
if (sect_empty(&sechdrs[i])) if (sect_empty(&sechdrs[i]))
continue; continue;
if (sechdrs[i].sh_type == SHT_NOTE) { if (sechdrs[i].sh_type == SHT_NOTE) {
sysfs_bin_attr_init(nattr);
nattr->attr.name = mod->sect_attrs->attrs[loaded].name; nattr->attr.name = mod->sect_attrs->attrs[loaded].name;
nattr->attr.mode = S_IRUGO; nattr->attr.mode = S_IRUGO;
nattr->size = sechdrs[i].sh_size; nattr->size = sechdrs[i].sh_size;
...@@ -1252,6 +1254,7 @@ int module_add_modinfo_attrs(struct module *mod) ...@@ -1252,6 +1254,7 @@ int module_add_modinfo_attrs(struct module *mod)
if (!attr->test || if (!attr->test ||
(attr->test && attr->test(mod))) { (attr->test && attr->test(mod))) {
memcpy(temp_attr, attr, sizeof(*temp_attr)); memcpy(temp_attr, attr, sizeof(*temp_attr));
sysfs_attr_init(&temp_attr->attr);
error = sysfs_create_file(&mod->mkobj.kobj,&temp_attr->attr); error = sysfs_create_file(&mod->mkobj.kobj,&temp_attr->attr);
++temp_attr; ++temp_attr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment