* [PATCH] module: remove redundant module_sysfs_initialized variable
@ 2022-09-29 12:10 Rasmus Villemoes
2022-09-30 11:20 ` Miroslav Benes
2022-10-03 23:40 ` Luis Chamberlain
0 siblings, 2 replies; 5+ messages in thread
From: Rasmus Villemoes @ 2022-09-29 12:10 UTC (permalink / raw)
To: Luis Chamberlain; +Cc: Rasmus Villemoes, linux-modules, linux-kernel
The variable module_sysfs_initialized is used for checking whether
module_kset has been initialized. Checking module_kset itself works
just fine for that.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
include/linux/module.h | 1 -
kernel/module/sysfs.c | 2 +-
kernel/params.c | 2 --
3 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/include/linux/module.h b/include/linux/module.h
index 518296ea7f73..727176de2890 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -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)
diff --git a/kernel/module/sysfs.c b/kernel/module/sysfs.c
index ce68f821dcd1..c921bf044050 100644
--- a/kernel/module/sysfs.c
+++ b/kernel/module/sysfs.c
@@ -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;
diff --git a/kernel/params.c b/kernel/params.c
index 5b92310425c5..8d4e9a3f0df2 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -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)
{
@@ -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();
--
2.37.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] module: remove redundant module_sysfs_initialized variable
2022-09-29 12:10 [PATCH] module: remove redundant module_sysfs_initialized variable Rasmus Villemoes
@ 2022-09-30 11:20 ` Miroslav Benes
2022-10-03 23:40 ` Luis Chamberlain
1 sibling, 0 replies; 5+ messages in thread
From: Miroslav Benes @ 2022-09-30 11:20 UTC (permalink / raw)
To: Rasmus Villemoes; +Cc: Luis Chamberlain, linux-modules, linux-kernel
On Thu, 29 Sep 2022, Rasmus Villemoes wrote:
> The variable module_sysfs_initialized is used for checking whether
> module_kset has been initialized. Checking module_kset itself works
> just fine for that.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
M
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] module: remove redundant module_sysfs_initialized variable
2022-09-29 12:10 [PATCH] module: remove redundant module_sysfs_initialized variable Rasmus Villemoes
2022-09-30 11:20 ` Miroslav Benes
@ 2022-10-03 23:40 ` Luis Chamberlain
2022-10-04 4:35 ` Christophe Leroy
1 sibling, 1 reply; 5+ messages in thread
From: Luis Chamberlain @ 2022-10-03 23:40 UTC (permalink / raw)
To: Rasmus Villemoes; +Cc: linux-modules, linux-kernel
On Thu, Sep 29, 2022 at 02:10:39PM +0200, Rasmus Villemoes wrote:
> The variable module_sysfs_initialized is used for checking whether
> module_kset has been initialized. Checking module_kset itself works
> just fine for that.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Looks pretty sane to me, thanks! I'll queue this up for 6.2
as we didn't get a chance to spin test this for 6.1 on linux-next.
Luis
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] module: remove redundant module_sysfs_initialized variable
2022-10-03 23:40 ` Luis Chamberlain
@ 2022-10-04 4:35 ` Christophe Leroy
2022-10-04 16:31 ` Luis Chamberlain
0 siblings, 1 reply; 5+ messages in thread
From: Christophe Leroy @ 2022-10-04 4:35 UTC (permalink / raw)
To: Luis Chamberlain, Rasmus Villemoes; +Cc: linux-modules, linux-kernel
Le 04/10/2022 à 01:40, Luis Chamberlain a écrit :
> On Thu, Sep 29, 2022 at 02:10:39PM +0200, Rasmus Villemoes wrote:
>> The variable module_sysfs_initialized is used for checking whether
>> module_kset has been initialized. Checking module_kset itself works
>> just fine for that.
>>
>> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>
> Looks pretty sane to me, thanks! I'll queue this up for 6.2
> as we didn't get a chance to spin test this for 6.1 on linux-next.
>
Maybe you can mention that this is a leftover from commit 7405c1e15edf
("kset: convert /sys/module to use kset_create")
Christophe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] module: remove redundant module_sysfs_initialized variable
2022-10-04 4:35 ` Christophe Leroy
@ 2022-10-04 16:31 ` Luis Chamberlain
0 siblings, 0 replies; 5+ messages in thread
From: Luis Chamberlain @ 2022-10-04 16:31 UTC (permalink / raw)
To: Christophe Leroy; +Cc: Rasmus Villemoes, linux-modules, linux-kernel
On Tue, Oct 04, 2022 at 04:35:43AM +0000, Christophe Leroy wrote:
>
>
> Le 04/10/2022 à 01:40, Luis Chamberlain a écrit :
> > On Thu, Sep 29, 2022 at 02:10:39PM +0200, Rasmus Villemoes wrote:
> >> The variable module_sysfs_initialized is used for checking whether
> >> module_kset has been initialized. Checking module_kset itself works
> >> just fine for that.
> >>
> >> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> >
> > Looks pretty sane to me, thanks! I'll queue this up for 6.2
> > as we didn't get a chance to spin test this for 6.1 on linux-next.
> >
>
> Maybe you can mention that this is a leftover from commit 7405c1e15edf
> ("kset: convert /sys/module to use kset_create")
Sure, did that.
Luis
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-10-04 16:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-29 12:10 [PATCH] module: remove redundant module_sysfs_initialized variable Rasmus Villemoes
2022-09-30 11:20 ` Miroslav Benes
2022-10-03 23:40 ` Luis Chamberlain
2022-10-04 4:35 ` Christophe Leroy
2022-10-04 16:31 ` Luis Chamberlain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).