Skip to content

Commit

Permalink
init/main.c: silence some -Wunused-parameter warnings
Browse files Browse the repository at this point in the history
There are a bunch of callbacks with unused arguments, go ahead and silence
those so "make KCFLAGS=-W init/main.o" is a little quieter.  Here's a
little sample:

init/main.c:182:43: warning: unused parameter 'str' [-Wunused-parameter]
static int __init set_reset_devices(char *str)

Link: https://lkml.kernel.org/r/20210519162341.1275452-1-ahalaney@redhat.com
Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
  • Loading branch information
Andrew Halaney authored and Stephen Rothwell committed Jan 4, 2022
1 parent c7401fd commit 0e57df7
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ EXPORT_SYMBOL_GPL(static_key_initialized);
unsigned int reset_devices;
EXPORT_SYMBOL(reset_devices);

static int __init set_reset_devices(char *str)
static int __init set_reset_devices(char *str __always_unused)
{
reset_devices = 1;
return 1;
Expand Down Expand Up @@ -230,13 +230,13 @@ static bool __init obsolete_checksetup(char *line)
unsigned long loops_per_jiffy = (1<<12);
EXPORT_SYMBOL(loops_per_jiffy);

static int __init debug_kernel(char *str)
static int __init debug_kernel(char *str __always_unused)
{
console_loglevel = CONSOLE_LOGLEVEL_DEBUG;
return 0;
}

static int __init quiet_kernel(char *str)
static int __init quiet_kernel(char *str __always_unused)
{
console_loglevel = CONSOLE_LOGLEVEL_QUIET;
return 0;
Expand Down Expand Up @@ -473,7 +473,7 @@ static void __init setup_boot_config(void)
get_boot_config_from_initrd(NULL, NULL);
}

static int __init warn_bootconfig(char *str)
static int __init warn_bootconfig(char *str __always_unused)
{
pr_warn("WARNING: 'bootconfig' found on the kernel command line but CONFIG_BOOT_CONFIG is not set.\n");
return 0;
Expand Down Expand Up @@ -502,7 +502,8 @@ static void __init repair_env_string(char *param, char *val)

/* Anything after -- gets handed straight to init. */
static int __init set_init_arg(char *param, char *val,
const char *unused, void *arg)
const char *unused __always_unused,
void *arg __always_unused)
{
unsigned int i;

Expand All @@ -527,7 +528,8 @@ static int __init set_init_arg(char *param, char *val,
* unused parameters (modprobe will find them in /proc/cmdline).
*/
static int __init unknown_bootoption(char *param, char *val,
const char *unused, void *arg)
const char *unused __always_unused,
void *arg __always_unused)
{
size_t len = strlen(param);

Expand Down Expand Up @@ -727,7 +729,8 @@ noinline void __ref rest_init(void)

/* Check for early params. */
static int __init do_early_param(char *param, char *val,
const char *unused, void *arg)
const char *unused __always_unused,
void *arg __always_unused)
{
const struct obs_kernel_param *p;

Expand Down Expand Up @@ -1349,8 +1352,10 @@ static const char *initcall_level_names[] __initdata = {
"late",
};

static int __init ignore_unknown_bootoption(char *param, char *val,
const char *unused, void *arg)
static int __init ignore_unknown_bootoption(char *param __always_unused,
char *val __always_unused,
const char *unused __always_unused,
void *arg __always_unused)
{
return 0;
}
Expand Down Expand Up @@ -1487,7 +1492,7 @@ void __weak free_initmem(void)
free_initmem_default(POISON_FREE_INITMEM);
}

static int __ref kernel_init(void *unused)
static int __ref kernel_init(void *unused __always_unused)
{
int ret;

Expand Down

0 comments on commit 0e57df7

Please sign in to comment.