Commit 31c4141f authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Module attributes: fix build error if CONFIG_MODULE_UNLOAD=n

Thanks to Andrew Morton for pointing this out to me.
parent b863a25d
...@@ -379,6 +379,22 @@ static inline void percpu_modcopy(void *pcpudst, const void *src, ...@@ -379,6 +379,22 @@ static inline void percpu_modcopy(void *pcpudst, const void *src,
} }
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
static int add_attribute(struct module *mod, struct kernel_param *kp)
{
struct module_attribute *a;
int retval;
a = &mod->mkobj->attr[mod->mkobj->num_attributes];
a->attr.name = (char *)kp->name;
a->attr.owner = mod;
a->attr.mode = kp->perm;
a->param = kp;
retval = sysfs_create_file(&mod->mkobj->kobj, &a->attr);
if (!retval)
mod->mkobj->num_attributes++;
return retval;
}
#ifdef CONFIG_MODULE_UNLOAD #ifdef CONFIG_MODULE_UNLOAD
/* Init the unload section of the module. */ /* Init the unload section of the module. */
static void module_unload_init(struct module *mod) static void module_unload_init(struct module *mod)
...@@ -504,22 +520,6 @@ static int try_stop_module(struct module *mod, int flags, int *forced) ...@@ -504,22 +520,6 @@ static int try_stop_module(struct module *mod, int flags, int *forced)
return stop_machine_run(__try_stop_module, &sref, NR_CPUS); return stop_machine_run(__try_stop_module, &sref, NR_CPUS);
} }
static int add_attribute(struct module *mod, struct kernel_param *kp)
{
struct module_attribute *a;
int retval;
a = &mod->mkobj->attr[mod->mkobj->num_attributes];
a->attr.name = (char *)kp->name;
a->attr.owner = mod;
a->attr.mode = kp->perm;
a->param = kp;
retval = sysfs_create_file(&mod->mkobj->kobj, &a->attr);
if (!retval)
mod->mkobj->num_attributes++;
return retval;
}
unsigned int module_refcount(struct module *mod) unsigned int module_refcount(struct module *mod)
{ {
unsigned int i, total = 0; unsigned int i, total = 0;
......
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