Skip to content

Commit 1cd25cb

Browse files
labbottgregkh
authored andcommitted
kgdboc: Fix warning with module build
After 2dd4531 ("kgdboc: Fix restrict error"), kgdboc_option_setup is now only used when built in, resulting in a warning when compiled as a module: drivers/tty/serial/kgdboc.c:134:12: warning: 'kgdboc_option_setup' defined but not used [-Wunused-function] static int kgdboc_option_setup(char *opt) ^~~~~~~~~~~~~~~~~~~ Move the function under the appropriate ifdef for builtin only. Fixes: 2dd4531 ("kgdboc: Fix restrict error") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Laura Abbott <labbott@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent feacbec commit 1cd25cb

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

drivers/tty/serial/kgdboc.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,24 +131,6 @@ static void kgdboc_unregister_kbd(void)
131131
#define kgdboc_restore_input()
132132
#endif /* ! CONFIG_KDB_KEYBOARD */
133133

134-
static int kgdboc_option_setup(char *opt)
135-
{
136-
if (!opt) {
137-
pr_err("config string not provided\n");
138-
return -EINVAL;
139-
}
140-
141-
if (strlen(opt) >= MAX_CONFIG_LEN) {
142-
pr_err("config string too long\n");
143-
return -ENOSPC;
144-
}
145-
strcpy(config, opt);
146-
147-
return 0;
148-
}
149-
150-
__setup("kgdboc=", kgdboc_option_setup);
151-
152134
static void cleanup_kgdboc(void)
153135
{
154136
if (kgdb_unregister_nmi_console())
@@ -316,6 +298,25 @@ static struct kgdb_io kgdboc_io_ops = {
316298
};
317299

318300
#ifdef CONFIG_KGDB_SERIAL_CONSOLE
301+
static int kgdboc_option_setup(char *opt)
302+
{
303+
if (!opt) {
304+
pr_err("config string not provided\n");
305+
return -EINVAL;
306+
}
307+
308+
if (strlen(opt) >= MAX_CONFIG_LEN) {
309+
pr_err("config string too long\n");
310+
return -ENOSPC;
311+
}
312+
strcpy(config, opt);
313+
314+
return 0;
315+
}
316+
317+
__setup("kgdboc=", kgdboc_option_setup);
318+
319+
319320
/* This is only available if kgdboc is a built in for early debugging */
320321
static int __init kgdboc_early_init(char *opt)
321322
{

0 commit comments

Comments
 (0)