Skip to content

Commit

Permalink
module: remove redundant module_sysfs_initialized variable
Browse files Browse the repository at this point in the history
The variable module_sysfs_initialized is used for checking whether
module_kset has been initialized. Checking module_kset itself works
just fine for that.

This is a leftover from commit 7405c1e ("kset: convert /sys/module
to use kset_create").

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
[mcgrof: adjusted commit log as suggested by Christophe Leroy]
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
  • Loading branch information
Rasmus Villemoes authored and Luis Chamberlain committed Nov 11, 2022
1 parent eb037f1 commit 3cd6086
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion include/linux/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,6 @@ void *dereference_module_function_descriptor(struct module *mod, void *ptr)
#ifdef CONFIG_SYSFS
extern struct kset *module_kset;
extern struct kobj_type module_ktype;
extern int module_sysfs_initialized;
#endif /* CONFIG_SYSFS */

#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
Expand Down
2 changes: 1 addition & 1 deletion kernel/module/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ static int mod_sysfs_init(struct module *mod)
int err;
struct kobject *kobj;

if (!module_sysfs_initialized) {
if (!module_kset) {
pr_err("%s: module sysfs not initialized\n", mod->name);
err = -EINVAL;
goto out;
Expand Down
2 changes: 0 additions & 2 deletions kernel/params.c
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,6 @@ static const struct kset_uevent_ops module_uevent_ops = {
};

struct kset *module_kset;
int module_sysfs_initialized;

static void module_kobj_release(struct kobject *kobj)
{
Expand All @@ -964,7 +963,6 @@ static int __init param_sysfs_init(void)
__FILE__, __LINE__);
return -ENOMEM;
}
module_sysfs_initialized = 1;

version_sysfs_builtin();
param_sysfs_builtin();
Expand Down

0 comments on commit 3cd6086

Please sign in to comment.