Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

printk: Constify name for add_preferred_console()

While adding a preferred console handling for serial_core for serial port
hardware based device addressing, Jiri suggested we constify name for
add_preferred_console(). The name gets copied anyways. This allows serial
core to add a preferred console using serial drv->dev_name without copying
it.

Note that constifying options causes changes all over the place because of
struct console for match().

Suggested-by: Jiri Slaby <jirislaby@kernel.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20231012064300.50221-2-tony@atomide.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Tony Lindgren and committed by
Greg Kroah-Hartman
1e3c8526 545a4f89

+3 -3
+1 -1
include/linux/console.h
··· 347 347 CONSOLE_REPLAY_ALL, 348 348 }; 349 349 350 - extern int add_preferred_console(char *name, const short idx, char *options); 350 + extern int add_preferred_console(const char *name, const short idx, char *options); 351 351 extern void console_force_preferred_locked(struct console *con); 352 352 extern void register_console(struct console *); 353 353 extern int unregister_console(struct console *);
+2 -2
kernel/printk/printk.c
··· 2404 2404 console_set_on_cmdline = 1; 2405 2405 } 2406 2406 2407 - static int __add_preferred_console(char *name, const short idx, char *options, 2407 + static int __add_preferred_console(const char *name, const short idx, char *options, 2408 2408 char *brl_options, bool user_specified) 2409 2409 { 2410 2410 struct console_cmdline *c; ··· 2521 2521 * commonly to provide a default console (ie from PROM variables) when 2522 2522 * the user has not supplied one. 2523 2523 */ 2524 - int add_preferred_console(char *name, const short idx, char *options) 2524 + int add_preferred_console(const char *name, const short idx, char *options) 2525 2525 { 2526 2526 return __add_preferred_console(name, idx, options, NULL, false); 2527 2527 }