diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2017-03-26 16:47:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-31 09:29:06 -0400 |
commit | 2ed2b8621be2708c0f6d61fe9841e9ad8b9753f0 (patch) | |
tree | 341e078fa6625fecaea9710cd303630b2bfde4da /kernel/printk | |
parent | cfa6eb239154315e6efcdda1d929e024097f927b (diff) |
braille-console: Fix value returned by _braille_console_setup
commit bbeddf52adc1 ("printk: move braille console support into
separate braille.[ch] files") introduced _braille_console_setup()
to outline the braille initialization code. There was however some
confusion over the value it was supposed to return. commit 2cfe6c4ac7ee
("printk: Fix return of braille_register_console()") tried to fix it
but failed to.
This fixes and documents the returned value according to the use
in printk.c: non-zero return means a parsing error, and thus this
console configuration should be ignored.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Aleksey Makarov <aleksey.makarov@linaro.org>
Cc: Joe Perches <joe@perches.com>
Cc: Ming Lei <ming.lei@canonical.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/printk')
-rw-r--r-- | kernel/printk/braille.c | 15 | ||||
-rw-r--r-- | kernel/printk/braille.h | 13 |
2 files changed, 18 insertions, 10 deletions
diff --git a/kernel/printk/braille.c b/kernel/printk/braille.c index d5760c42f042..61d41ca41844 100644 --- a/kernel/printk/braille.c +++ b/kernel/printk/braille.c | |||
@@ -2,12 +2,13 @@ | |||
2 | 2 | ||
3 | #include <linux/kernel.h> | 3 | #include <linux/kernel.h> |
4 | #include <linux/console.h> | 4 | #include <linux/console.h> |
5 | #include <linux/errno.h> | ||
5 | #include <linux/string.h> | 6 | #include <linux/string.h> |
6 | 7 | ||
7 | #include "console_cmdline.h" | 8 | #include "console_cmdline.h" |
8 | #include "braille.h" | 9 | #include "braille.h" |
9 | 10 | ||
10 | char *_braille_console_setup(char **str, char **brl_options) | 11 | int _braille_console_setup(char **str, char **brl_options) |
11 | { | 12 | { |
12 | if (!strncmp(*str, "brl,", 4)) { | 13 | if (!strncmp(*str, "brl,", 4)) { |
13 | *brl_options = ""; | 14 | *brl_options = ""; |
@@ -15,14 +16,14 @@ char *_braille_console_setup(char **str, char **brl_options) | |||
15 | } else if (!strncmp(*str, "brl=", 4)) { | 16 | } else if (!strncmp(*str, "brl=", 4)) { |
16 | *brl_options = *str + 4; | 17 | *brl_options = *str + 4; |
17 | *str = strchr(*brl_options, ','); | 18 | *str = strchr(*brl_options, ','); |
18 | if (!*str) | 19 | if (!*str) { |
19 | pr_err("need port name after brl=\n"); | 20 | pr_err("need port name after brl=\n"); |
20 | else | 21 | return -EINVAL; |
21 | *((*str)++) = 0; | 22 | } |
22 | } else | 23 | *((*str)++) = 0; |
23 | return NULL; | 24 | } |
24 | 25 | ||
25 | return *str; | 26 | return 0; |
26 | } | 27 | } |
27 | 28 | ||
28 | int | 29 | int |
diff --git a/kernel/printk/braille.h b/kernel/printk/braille.h index 769d771145c8..749a6756843a 100644 --- a/kernel/printk/braille.h +++ b/kernel/printk/braille.h | |||
@@ -9,7 +9,14 @@ braille_set_options(struct console_cmdline *c, char *brl_options) | |||
9 | c->brl_options = brl_options; | 9 | c->brl_options = brl_options; |
10 | } | 10 | } |
11 | 11 | ||
12 | char * | 12 | /* |
13 | * Setup console according to braille options. | ||
14 | * Return -EINVAL on syntax error, 0 on success (or no braille option was | ||
15 | * actually given). | ||
16 | * Modifies str to point to the serial options | ||
17 | * Sets brl_options to the parsed braille options. | ||
18 | */ | ||
19 | int | ||
13 | _braille_console_setup(char **str, char **brl_options); | 20 | _braille_console_setup(char **str, char **brl_options); |
14 | 21 | ||
15 | int | 22 | int |
@@ -25,10 +32,10 @@ braille_set_options(struct console_cmdline *c, char *brl_options) | |||
25 | { | 32 | { |
26 | } | 33 | } |
27 | 34 | ||
28 | static inline char * | 35 | static inline int |
29 | _braille_console_setup(char **str, char **brl_options) | 36 | _braille_console_setup(char **str, char **brl_options) |
30 | { | 37 | { |
31 | return NULL; | 38 | return 0; |
32 | } | 39 | } |
33 | 40 | ||
34 | static inline int | 41 | static inline int |