diff options
author | Joe Perches <joe@perches.com> | 2013-07-31 16:53:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-31 17:41:03 -0400 |
commit | bbeddf52adc1b4207674ab88686cbbe58c24f721 (patch) | |
tree | b5cc2fe8f140e340407e2daa8b1ab2ba63ae00f4 /kernel/printk/printk.c | |
parent | d197c43d04decb6b1298fa3ef26ea04a9ca7c977 (diff) |
printk: move braille console support into separate braille.[ch] files
Create files with prototypes and static inlines for braille support. Make
braille_console functions return 1 on success.
Corrected CONFIG_A11Y_BRAILLE_CONSOLE=n _braille_console_setup
return value to NULL.
Signed-off-by: Joe Perches <joe@perches.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/printk/printk.c')
-rw-r--r-- | kernel/printk/printk.c | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 4da2b2c7f67d..5a022e0c654c 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <trace/events/printk.h> | 52 | #include <trace/events/printk.h> |
53 | 53 | ||
54 | #include "console_cmdline.h" | 54 | #include "console_cmdline.h" |
55 | #include "braille.h" | ||
55 | 56 | ||
56 | /* printk's without a loglevel use this.. */ | 57 | /* printk's without a loglevel use this.. */ |
57 | #define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL | 58 | #define DEFAULT_MESSAGE_LOGLEVEL CONFIG_DEFAULT_MESSAGE_LOGLEVEL |
@@ -1769,9 +1770,8 @@ static int __add_preferred_console(char *name, int idx, char *options, | |||
1769 | c = &console_cmdline[i]; | 1770 | c = &console_cmdline[i]; |
1770 | strlcpy(c->name, name, sizeof(c->name)); | 1771 | strlcpy(c->name, name, sizeof(c->name)); |
1771 | c->options = options; | 1772 | c->options = options; |
1772 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 1773 | braille_set_options(c, brl_options); |
1773 | c->brl_options = brl_options; | 1774 | |
1774 | #endif | ||
1775 | c->index = idx; | 1775 | c->index = idx; |
1776 | return 0; | 1776 | return 0; |
1777 | } | 1777 | } |
@@ -1784,20 +1784,8 @@ static int __init console_setup(char *str) | |||
1784 | char *s, *options, *brl_options = NULL; | 1784 | char *s, *options, *brl_options = NULL; |
1785 | int idx; | 1785 | int idx; |
1786 | 1786 | ||
1787 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 1787 | if (_braille_console_setup(&str, &brl_options)) |
1788 | if (!memcmp(str, "brl,", 4)) { | 1788 | return 1; |
1789 | brl_options = ""; | ||
1790 | str += 4; | ||
1791 | } else if (!memcmp(str, "brl=", 4)) { | ||
1792 | brl_options = str + 4; | ||
1793 | str = strchr(brl_options, ','); | ||
1794 | if (!str) { | ||
1795 | printk(KERN_ERR "need port name after brl=\n"); | ||
1796 | return 1; | ||
1797 | } | ||
1798 | *(str++) = 0; | ||
1799 | } | ||
1800 | #endif | ||
1801 | 1789 | ||
1802 | /* | 1790 | /* |
1803 | * Decode str into name, index, options. | 1791 | * Decode str into name, index, options. |
@@ -2291,16 +2279,10 @@ void register_console(struct console *newcon) | |||
2291 | continue; | 2279 | continue; |
2292 | if (newcon->index < 0) | 2280 | if (newcon->index < 0) |
2293 | newcon->index = console_cmdline[i].index; | 2281 | newcon->index = console_cmdline[i].index; |
2294 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 2282 | |
2295 | if (console_cmdline[i].brl_options) { | 2283 | if (_braille_register_console(newcon, &console_cmdline[i])) |
2296 | newcon->flags |= CON_BRL; | ||
2297 | braille_register_console(newcon, | ||
2298 | console_cmdline[i].index, | ||
2299 | console_cmdline[i].options, | ||
2300 | console_cmdline[i].brl_options); | ||
2301 | return; | 2284 | return; |
2302 | } | 2285 | |
2303 | #endif | ||
2304 | if (newcon->setup && | 2286 | if (newcon->setup && |
2305 | newcon->setup(newcon, console_cmdline[i].options) != 0) | 2287 | newcon->setup(newcon, console_cmdline[i].options) != 0) |
2306 | break; | 2288 | break; |
@@ -2388,13 +2370,13 @@ EXPORT_SYMBOL(register_console); | |||
2388 | int unregister_console(struct console *console) | 2370 | int unregister_console(struct console *console) |
2389 | { | 2371 | { |
2390 | struct console *a, *b; | 2372 | struct console *a, *b; |
2391 | int res = 1; | 2373 | int res; |
2392 | 2374 | ||
2393 | #ifdef CONFIG_A11Y_BRAILLE_CONSOLE | 2375 | res = _braille_unregister_console(console); |
2394 | if (console->flags & CON_BRL) | 2376 | if (res) |
2395 | return braille_unregister_console(console); | 2377 | return res; |
2396 | #endif | ||
2397 | 2378 | ||
2379 | res = 1; | ||
2398 | console_lock(); | 2380 | console_lock(); |
2399 | if (console_drivers == console) { | 2381 | if (console_drivers == console) { |
2400 | console_drivers=console->next; | 2382 | console_drivers=console->next; |