Skip to content

Commit

Permalink
fs/nls: make load_nls() take a const parameter
Browse files Browse the repository at this point in the history
[ Upstream commit c1ed39e ]

load_nls() take a char * parameter, use it to find nls module in list or
construct the module name to load it.

This change make load_nls() take a const parameter, so we don't need do
some cast like this:

        ses->local_nls = load_nls((char *)ctx->local_nls->charset);

Suggested-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Winston Wen <wentao@uniontech.com>
Reviewed-by: Paulo Alcantara <pc@manguebit.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
winnscode authored and gregkh committed Sep 13, 2023
1 parent d28f76b commit 952af5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions fs/nls/nls_base.c
Expand Up @@ -272,7 +272,7 @@ int unregister_nls(struct nls_table * nls)
return -EINVAL;
}

static struct nls_table *find_nls(char *charset)
static struct nls_table *find_nls(const char *charset)
{
struct nls_table *nls;
spin_lock(&nls_lock);
Expand All @@ -288,7 +288,7 @@ static struct nls_table *find_nls(char *charset)
return nls;
}

struct nls_table *load_nls(char *charset)
struct nls_table *load_nls(const char *charset)
{
return try_then_request_module(find_nls(charset), "nls_%s", charset);
}
Expand Down
2 changes: 1 addition & 1 deletion include/linux/nls.h
Expand Up @@ -47,7 +47,7 @@ enum utf16_endian {
/* nls_base.c */
extern int __register_nls(struct nls_table *, struct module *);
extern int unregister_nls(struct nls_table *);
extern struct nls_table *load_nls(char *);
extern struct nls_table *load_nls(const char *charset);
extern void unload_nls(struct nls_table *);
extern struct nls_table *load_nls_default(void);
#define register_nls(nls) __register_nls((nls), THIS_MODULE)
Expand Down

0 comments on commit 952af5c

Please sign in to comment.