Skip to content

Commit

Permalink
kernel: globalize lookup_or_create_module_kobject()
Browse files Browse the repository at this point in the history
[ Upstream commit 7c76c81 ]

lookup_or_create_module_kobject() is marked as static and __init,
to make it global drop static keyword.
Since this function can be called from non-init code, use __modinit
instead of __init, __modinit marker will make it __init if
CONFIG_MODULES is not defined.

Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Shyam Saini <shyamsaini@linux.microsoft.com>
Link: https://lore.kernel.org/r/20250227184930.34163-4-shyamsaini@linux.microsoft.com
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
Stable-dep-of: f95bbfe ("drivers: base: handle module_kobject creation")
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Shyam Saini authored and Greg Kroah-Hartman committed May 9, 2025
1 parent 3a1e704 commit 63035f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions include/linux/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ extern void cleanup_module(void);
#define __INITRODATA_OR_MODULE __INITRODATA
#endif /*CONFIG_MODULES*/

struct module_kobject *lookup_or_create_module_kobject(const char *name);

/* Generic info of form tag = "info" */
#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)

Expand Down
2 changes: 1 addition & 1 deletion kernel/params.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ void destroy_params(const struct kernel_param *params, unsigned num)
params[i].ops->free(params[i].arg);
}

static struct module_kobject * __init lookup_or_create_module_kobject(const char *name)
struct module_kobject __modinit * lookup_or_create_module_kobject(const char *name)
{
struct module_kobject *mk;
struct kobject *kobj;
Expand Down

0 comments on commit 63035f8

Please sign in to comment.