console: unify return codes from ->setup() hook
Subsystems (5)
PATCH 1/6 mips: Return proper error code from console ->setup() hook
In reply to Andy ShevchenkoFor unifying console ->setup() handling, which is pure documented, return error code, rather than non-zero arbitrary number.
--- arch/mips/fw/arc/arc_con.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/mips/fw/arc/arc_con.c +3 -1
@@ -28,7 +28,9 @@ static void prom_console_write(struct console *co, const char *s,static int prom_console_setup (struct console *co,char *options) { -return !(prom_flags &PROM_FLAG_USE_AS_CONSOLE ); +if (prom_flags &PROM_FLAG_USE_AS_CONSOLE ) +return 0 ; +return -ENODEV ; }static struct console arc_cons = {
Signature · 1 line
2.27.0
PATCH 3/6 serial: sunzilog: Return proper error code from console ->setup() hook
In reply to Andy ShevchenkoFor unifying console ->setup() handling, which is pure documented, return error code, rather than non-zero arbitrary number.
--- drivers/tty/serial/sunzilog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sunzilog.c +1 -1
@@ -1221,7 +1221,7 @@ static int __init sunzilog_console_setup(struct console *con, char *options)int baud, brg;if (up->port.type !=PORT_SUNZILOG ) -return -1 ; +return -EINVAL ;printk (KERN_INFO "Console: ttyS%d (SunZilog zs%d)\n" , (sunzilog_reg.minor -64 ) + con->index, con->index);
Signature · 1 line
2.27.0
PATCH 2/6 serial: sunsab: Return proper error code from console ->setup() hook
In reply to Andy ShevchenkoFor unifying console ->setup() handling, which is pure documented, return error code, rather than non-zero arbitrary number.
--- drivers/tty/serial/sunsab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sunsab.c +1 -1
@@ -886,7 +886,7 @@ static int sunsab_console_setup(struct console *con, char *options)* though... */ if (up->port.type !=PORT_SUNSAB ) -return -1 ; +return -EINVAL ;printk ("Console: ttyS%d (SAB82532)\n" , (sunsab_reg.minor -64 ) + con->index);
Signature · 1 line
2.27.0
PATCH 4/6 tty: hvc: Return proper error code from console ->setup() hook
In reply to Andy ShevchenkoFor unifying console ->setup() handling, which is pure documented, return error code, rather than non-zero arbitrary number.
--- drivers/tty/hvc/hvsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/hvc/hvsi.c +1 -1
@@ -1128,7 +1128,7 @@ static int __init hvsi_console_setup(struct console *console, char *options)int ret;if (console->index <0 || console->index >= hvsi_count) -return -1 ; +return -EINVAL ; hp = &hvsi_ports[console->index];/* give the FSP a chance to change the baud rate when we re-open */
Signature · 1 line
2.27.0
PATCH 6/6 console: Fix trivia typo 'change' -> 'chance'
In reply to Andy ShevchenkoI bet the word 'chance' has to be used in 'had a chance to be called', but, alas, I'm not native speaker...
--- kernel/printk/printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/printk.c +1 -1
@@ -2705,7 +2705,7 @@ static int try_enable_new_console(struct console *newcon, bool user_specified)/* * Some consoles, such as pstore and netconsole, can be enabled even * without matching. Accept the pre-enabled consoles only when match() -* and setup() had a change to be called. +* and setup() had a chance to be called. */ if (newcon->flags &CON_ENABLED && c->user_specified == user_specified)return 0 ;
Signature · 1 line
2.27.0
cover console: unify return codes from ->setup() hook
Some of the console providers treat error code, returned by ->setup() hook, differently. Here is the unification of the behaviour.
The drivers checked by one of the below criteria:
1/ the driver has explicit struct console .setup assignment 2/ the driver has assigned callback to the setup member
All such drivers were read in order to see if there is any problematic return codes, and fixed accordingly which is this series in the result.
Andy Shevchenko (6):
mips: Return proper error code from console ->setup() hook
serial: sunsab: Return proper error code from console ->setup() hook
serial: sunzilog: Return proper error code from console ->setup() hook
tty: hvc: Return proper error code from console ->setup() hook
console: Propagate error code from console ->setup()
console: Fix trivia typo 'change' -> 'chance'
arch/mips/fw/arc/arc_con.c | 4 +++- drivers/tty/hvc/hvsi.c | 2 +- drivers/tty/serial/sunsab.c | 2 +- drivers/tty/serial/sunzilog.c | 2 +- kernel/printk/printk.c | 8 ++++---- 5 files changed, 10 insertions(+), 8 deletions(-)
Signature · 1 line
2.27.0
PATCH 5/6 console: Propagate error code from console ->setup()
Since console ->setup() hook returns meaningful error codes, propagate it to the caller of try_enable_new_console().
--- kernel/printk/printk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/printk/printk.c +3 -3
@@ -2668,7 +2668,7 @@ early_param("keep_bootcon", keep_bootcon_setup);static int try_enable_new_console (struct console *newcon,bool user_specified) {struct console_cmdline *c; -int i; +int i, err; for (i = 0, c = console_cmdline; i < MAX_CMDLINECONSOLES && c->name[0];
@@ -2691,8 +2691,8 @@ static int try_enable_new_console(struct console *newcon, bool user_specified)return 0 ;if (newcon->setup && - newcon->setup (newcon, c->options) !=0 ) -return -EIO ; + (err = newcon->setup (newcon, c->options)) !=0 ) +return err; } newcon->flags |=CON_ENABLED ;if (i == preferred_console) {
Signature · 1 line
2.27.0
Quoted 18 lines · Andy Shevchenko
Some of the console providers treat error code, returned by ->setup() hook, differently. Here is the unification of the behaviour.
The drivers checked by one of the below criteria:
1/ the driver has explicit struct console .setup assignment 2/ the driver has assigned callback to the setup memberAll such drivers were read in order to see if there is any problematic return codes, and fixed accordingly which is this series in the result.
Andy Shevchenko (6):
mips: Return proper error code from console ->setup() hook
serial: sunsab: Return proper error code from console ->setup() hook
serial: sunzilog: Return proper error code from console ->setup() hook
tty: hvc: Return proper error code from console ->setup() hook
console: Propagate error code from console ->setup()
console: Fix trivia typo 'change' -> 'chance'
Quoted 6 lines
arch/mips/fw/arc/arc_con.c | 4 +++- drivers/tty/hvc/hvsi.c | 2 +- drivers/tty/serial/sunsab.c | 2 +- drivers/tty/serial/sunzilog.c | 2 +- kernel/printk/printk.c | 8 ++++---- 5 files changed, 10 insertions(+), 8 deletions(-)
Looks good to me. I'd also, probably, unify the naming. I can grep 71 foo_console_setup() and only 1 foo_setup_console().
--- drivers/tty/hvc/hvc_xen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/hvc/hvc_xen.c +2 -2
@@ -603,7 +603,7 @@ static void xen_hvm_early_write(uint32_t vtermno, const char *str, int len) { }#endif #ifdef CONFIG_EARLY_PRINTK -static int __init xenboot_setup_console (struct console *console,char *string) +static int __init xenboot_console_setup (struct console *console,char *string) {static struct xencons_info xenboot;
@@ -647,7 +647,7 @@ static void xenboot_write_console(struct console *console, const char *string,struct console xenboot_console = { .name ="xenboot" , .write = xenboot_write_console, - .setup = xenboot_setup_console, + .setup = xenboot_console_setup, .flags =CON_PRINTBUFFER |CON_BOOT |CON_ANYTIME , .index =-1 , };
Signature · 1 line
2.27.0
Re: [PATCH v1 3/6] serial: sunzilog: Return proper error code from console ->setup() hook
In reply to Andy ShevchenkoFrom: Andy Shevchenko <[email protected]>
Date: Thu, 18 Jun 2020 19:47:48 +0300
Quoted 5 lines
For unifying console ->setup() handling, which is pure documented, return error code, rather than non-zero arbitrary number.
Signed-off-by Andy Shevchenko <[email protected]>Cc "David S. Miller" <[email protected]>
Re: [PATCH v1 2/6] serial: sunsab: Return proper error code from console ->setup() hook
In reply to Andy ShevchenkoFrom: Andy Shevchenko <[email protected]>
Date: Thu, 18 Jun 2020 19:47:47 +0300
Quoted 5 lines
For unifying console ->setup() handling, which is pure documented, return error code, rather than non-zero arbitrary number.
Signed-off-by Andy Shevchenko <[email protected]>Cc "David S. Miller" <[email protected]>
Re: [PATCH v1 5/6] console: Propagate error code from console ->setup()
In reply to Andy ShevchenkoQuoted 5 lines · Andy Shevchenko
Since console ->setup() hook returns meaningful error codes, propagate it to the caller of
try_enable_new_console().Signed-off-by Andy Shevchenko <[email protected]>
Quoted 28 lines
---A
kernel/printk/printk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)kernel/printk/printk.c +3
-3@@ -2668,7 +2668,7 @@ early_param("keep_bootcon", keep_bootcon_setup);static int try_enable_new_console (struct console *newcon,bool user_specified) {struct console_cmdline *c; -int i; +int i, err; for (i = 0, c = console_cmdline; i < MAX_CMDLINECONSOLES && c->name[0];@@ -2691,8 +2691,8 @@ static int try_enable_new_console(struct console *newcon, bool user_specified)return 0 ;if (newcon->setup && - newcon->setup (newcon, c->options) !=0 ) -return -EIO ; + (err = newcon->setup (newcon, c->options)) !=0 ) +return err; } newcon->flags |=CON_ENABLED ;if (i == preferred_console) {
Re: [PATCH v1 6/6] console: Fix trivia typo 'change' -> 'chance'
In reply to Andy ShevchenkoQuoted 2 lines · Andy Shevchenko
I bet the word 'chance' has to be used in 'had a chance to be called', but, alas, I'm not native speaker...
Yup, typo :)
Quoted 2 lines
Signed-off-by Andy Shevchenko <[email protected]>
Quoted 17 lines
--- kernel/printk/printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/printk/printk.c +1
-1@@ -2705,7 +2705,7 @@ static int try_enable_new_console(struct console *newcon, bool user_specified)/* * Some consoles, such as pstore and netconsole, can be enabled even * without matching. Accept the pre-enabled consoles only when match() -* and setup() had a change to be called. +* and setup() had a chance to be called. */ if (newcon->flags &CON_ENABLED && c->user_specified == user_specified)return 0 ;
Quoted 10 lines · Andy Shevchenko
Some of the console providers treat error code, returned by ->setup() hook, differently. Here is the unification of the behaviour.
The drivers checked by one of the below criteria:
1/ the driver has explicit struct console .setup assignment 2/ the driver has assigned callback to the setup memberAll such drivers were read in order to see if there is any problematic return codes, and fixed accordingly which is this series in the result.
Quoted 7 lines
Andy Shevchenko (6):
mips: Return proper error code from console ->setup() hook
serial: sunsab: Return proper error code from console ->setup() hook
serial: sunzilog: Return proper error code from console ->setup() hook
tty: hvc: Return proper error code from console ->setup() hook
console: Propagate error code from console ->setup()
console: Fix trivia typo 'change' -> 'chance'
For the entire patchset:
I am going to push it the following week via printk tree unless anybody complains.
Best Regards,
Petr
Re: [PATCH v1 1/6] mips: Return proper error code from console ->setup() hook
In reply to Andy ShevchenkoQuoted 8 lines · Andy Shevchenko
For unifying console ->setup() handling, which is pure documented, return error code, rather than non-zero arbitrary number.
Signed-off-by Andy Shevchenko <[email protected]>Cc Thomas Bogendoerfer <[email protected]>--- arch/mips/fw/arc/arc_con.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]
Quoted 19 lines · Petr Mladek
Quoted 10 lines · Andy Shevchenko
Some of the console providers treat error code, returned by ->setup() hook, differently. Here is the unification of the behaviour.
The drivers checked by one of the below criteria:
1/ the driver has explicit struct console .setup assignment 2/ the driver has assigned callback to the setup memberAll such drivers were read in order to see if there is any problematic return codes, and fixed accordingly which is this series in the result.
Quoted 7 lines
Andy Shevchenko (6):
mips: Return proper error code from console ->setup() hook
serial: sunsab: Return proper error code from console ->setup() hook
serial: sunzilog: Return proper error code from console ->setup() hook
tty: hvc: Return proper error code from console ->setup() hook
console: Propagate error code from console ->setup()
console: Fix trivia typo 'change' -> 'chance'
Quoted 6 lines
For the entire patchset:
Reviewed-by Petr Mladek <[email protected]>I am going to push it the following week via printk tree unless anybody complains.
Thanks, Petr, I guess you may also incorporate Sergey's patch he proposed. Sergey, are you going to submit it officially?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Petr Mladek
On Thu 2020-06-18 19:47:45, Andy Shevchenko wrote:
[..]
Quoted 5 lines
Quoted 2 lines
I am going to push it the following week via printk tree unless anybody complains.
Thanks, Petr, I guess you may also incorporate Sergey's patch he proposed. Sergey, are you going to submit it officially?
I can send a patch, unless Petr has objections.
-ss
Petr Mladek
maintainerQuoted 11 lines · Sergey Senozhatsky
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Petr Mladek
On Thu 2020-06-18 19:47:45, Andy Shevchenko wrote:
[..]
Quoted 5 lines
Quoted 2 lines
I am going to push it the following week via printk tree unless anybody complains.
Thanks, Petr, I guess you may also incorporate Sergey's patch he proposed. Sergey, are you going to submit it officially?
I can send a patch, unless Petr has objections.
Go ahead :-)
Best Regards,
Petr
Quoted 8 lines · Petr Mladek
Quoted 7 lines · Sergey Senozhatsky
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Petr Mladek
On Thu 2020-06-18 19:47:45, Andy Shevchenko wrote:
[..]
Quoted 3 lines
Quoted 2 lines
I am going to push it the following week via printk tree unless anybody complains.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Thanks, Petr, I guess you may also incorporate Sergey's patch he proposed. Sergey, are you going to submit it officially?
I can send a patch, unless Petr has objections.
Go ahead :-)
Oops, I just sent it, but I forgot to specify in-reply-to message-id :(
-ss
Re: [PATCH v1 1/6] mips: Return proper error code from console ->setup() hook
In reply to Andy ShevchenkoQuoted 1 line · Andy Shevchenko
For unifying console ->setup() handling, which is pure documented,
Did you mean s/pure/poorly/ in all the patches? Or purely? But then where?
Quoted 4 lines
return error code, rather than non-zero arbitrary number.
Signed-off-by Andy Shevchenko <[email protected]>Cc Thomas Bogendoerfer <[email protected]>
thanks,
Signature · 2 lines
js suse labs
Re: [PATCH v1 1/6] mips: Return proper error code from console ->setup() hook
Quoted 5 lines · Jiri Slaby
Quoted 1 line · Andy Shevchenko
For unifying console ->setup() handling, which is pure documented,
Did you mean s/pure/poorly/ in all the patches? Or purely? But then where?
Poorly.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Petr Mladek
maintainerQuoted 10 lines · Andy Shevchenko
Some of the console providers treat error code, returned by ->setup() hook, differently. Here is the unification of the behaviour.
The drivers checked by one of the below criteria:
1/ the driver has explicit struct console .setup assignment 2/ the driver has assigned callback to the setup memberAll such drivers were read in order to see if there is any problematic return codes, and fixed accordingly which is this series in the result.
Quoted 7 lines
Andy Shevchenko (6):
mips: Return proper error code from console ->setup() hook
serial: sunsab: Return proper error code from console ->setup() hook
serial: sunzilog: Return proper error code from console ->setup() hook
tty: hvc: Return proper error code from console ->setup() hook
console: Propagate error code from console ->setup()
console: Fix trivia typo 'change' -> 'chance'
The entire patchset has been pushed into printk/linux.git, branch for-5.9-console-return-codes.
I have done "s/pure/poorly/" to fix the typo in commit messages reported by Jiri Slaby.
Best Regards,
Petr