Skip to content

Commit

Permalink
module: mark module_mutex static
Browse files Browse the repository at this point in the history
Except for two lockdep asserts module_mutex is only used in module.c.
Remove the two asserts given that the functions they are in are not
exported and just called from the module code, and mark module_mutex
static.

Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
  • Loading branch information
Christoph Hellwig authored and Jessica Yu committed Feb 8, 2021
1 parent 3e35520 commit 922f2a7
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
2 changes: 0 additions & 2 deletions include/linux/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,6 @@ static inline unsigned long kallsyms_symbol_value(const Elf_Sym *sym)
}
#endif

extern struct mutex module_mutex;

/* FIXME: It'd be nice to isolate modules during init, too, so they
aren't used before they (may) fail. But presently too much code
(IDE & SCSI) require entry into the module during init.*/
Expand Down
2 changes: 1 addition & 1 deletion kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
* 3) module_addr_min/module_addr_max.
* (delete and add uses RCU list operations).
*/
DEFINE_MUTEX(module_mutex);
static DEFINE_MUTEX(module_mutex);
static LIST_HEAD(modules);

/* Work queue for freeing init sections in success case */
Expand Down
3 changes: 0 additions & 3 deletions lib/bug.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ void module_bug_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
char *secstrings;
unsigned int i;

lockdep_assert_held(&module_mutex);

mod->bug_table = NULL;
mod->num_bugs = 0;

Expand All @@ -118,7 +116,6 @@ void module_bug_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,

void module_bug_cleanup(struct module *mod)
{
lockdep_assert_held(&module_mutex);
list_del_rcu(&mod->bug_list);
}

Expand Down

0 comments on commit 922f2a7

Please sign in to comment.