aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/printk/printk.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 5a022e0c654c..8f1fb50aa3ce 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1756,18 +1756,19 @@ static int __add_preferred_console(char *name, int idx, char *options,
1756 * See if this tty is not yet registered, and 1756 * See if this tty is not yet registered, and
1757 * if we have a slot free. 1757 * if we have a slot free.
1758 */ 1758 */
1759 for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) 1759 for (i = 0, c = console_cmdline;
1760 if (strcmp(console_cmdline[i].name, name) == 0 && 1760 i < MAX_CMDLINECONSOLES && c->name[0];
1761 console_cmdline[i].index == idx) { 1761 i++, c++) {
1762 if (!brl_options) 1762 if (strcmp(c->name, name) == 0 && c->index == idx) {
1763 selected_console = i; 1763 if (!brl_options)
1764 return 0; 1764 selected_console = i;
1765 return 0;
1765 } 1766 }
1767 }
1766 if (i == MAX_CMDLINECONSOLES) 1768 if (i == MAX_CMDLINECONSOLES)
1767 return -E2BIG; 1769 return -E2BIG;
1768 if (!brl_options) 1770 if (!brl_options)
1769 selected_console = i; 1771 selected_console = i;
1770 c = &console_cmdline[i];
1771 strlcpy(c->name, name, sizeof(c->name)); 1772 strlcpy(c->name, name, sizeof(c->name));
1772 c->options = options; 1773 c->options = options;
1773 braille_set_options(c, brl_options); 1774 braille_set_options(c, brl_options);
@@ -1840,15 +1841,15 @@ int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, cha
1840 struct console_cmdline *c; 1841 struct console_cmdline *c;
1841 int i; 1842 int i;
1842 1843
1843 for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) 1844 for (i = 0, c = console_cmdline;
1844 if (strcmp(console_cmdline[i].name, name) == 0 && 1845 i < MAX_CMDLINECONSOLES && c->name[0];
1845 console_cmdline[i].index == idx) { 1846 i++, c++)
1846 c = &console_cmdline[i]; 1847 if (strcmp(c->name, name) == 0 && c->index == idx) {
1847 strlcpy(c->name, name_new, sizeof(c->name)); 1848 strlcpy(c->name, name_new, sizeof(c->name));
1848 c->name[sizeof(c->name) - 1] = 0; 1849 c->name[sizeof(c->name) - 1] = 0;
1849 c->options = options; 1850 c->options = options;
1850 c->index = idx_new; 1851 c->index = idx_new;
1851 return i; 1852 return i;
1852 } 1853 }
1853 /* not found */ 1854 /* not found */
1854 return -1; 1855 return -1;
@@ -2223,6 +2224,7 @@ void register_console(struct console *newcon)
2223 int i; 2224 int i;
2224 unsigned long flags; 2225 unsigned long flags;
2225 struct console *bcon = NULL; 2226 struct console *bcon = NULL;
2227 struct console_cmdline *c;
2226 2228
2227 /* 2229 /*
2228 * before we register a new CON_BOOT console, make sure we don't 2230 * before we register a new CON_BOOT console, make sure we don't
@@ -2270,24 +2272,25 @@ void register_console(struct console *newcon)
2270 * See if this console matches one we selected on 2272 * See if this console matches one we selected on
2271 * the command line. 2273 * the command line.
2272 */ 2274 */
2273 for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; 2275 for (i = 0, c = console_cmdline;
2274 i++) { 2276 i < MAX_CMDLINECONSOLES && c->name[0];
2275 if (strcmp(console_cmdline[i].name, newcon->name) != 0) 2277 i++, c++) {
2278 if (strcmp(c->name, newcon->name) != 0)
2276 continue; 2279 continue;
2277 if (newcon->index >= 0 && 2280 if (newcon->index >= 0 &&
2278 newcon->index != console_cmdline[i].index) 2281 newcon->index != c->index)
2279 continue; 2282 continue;
2280 if (newcon->index < 0) 2283 if (newcon->index < 0)
2281 newcon->index = console_cmdline[i].index; 2284 newcon->index = c->index;
2282 2285
2283 if (_braille_register_console(newcon, &console_cmdline[i])) 2286 if (_braille_register_console(newcon, c))
2284 return; 2287 return;
2285 2288
2286 if (newcon->setup && 2289 if (newcon->setup &&
2287 newcon->setup(newcon, console_cmdline[i].options) != 0) 2290 newcon->setup(newcon, console_cmdline[i].options) != 0)
2288 break; 2291 break;
2289 newcon->flags |= CON_ENABLED; 2292 newcon->flags |= CON_ENABLED;
2290 newcon->index = console_cmdline[i].index; 2293 newcon->index = c->index;
2291 if (i == selected_console) { 2294 if (i == selected_console) {
2292 newcon->flags |= CON_CONSDEV; 2295 newcon->flags |= CON_CONSDEV;
2293 preferred_console = selected_console; 2296 preferred_console = selected_console;