diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2008-04-17 14:05:37 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 14:05:37 -0400 |
commit | f2d937f3bf00665ccf048b3b6616ef95859b0945 (patch) | |
tree | 6136ded0706be0d39a09a0a912e8f79a4ab63322 /drivers/char/tty_io.c | |
parent | dc7d552705215ac50a0617fcf51bb9c736255b8e (diff) |
consoles: polling support, kgdboc
polled console handling support, to access a console in an irq-less
way while in debug or irq context.
absolutely zero impact as long as CONFIG_CONSOLE_POLL is disabled.
(which is the default)
[ jan.kiszka@siemens.com: lots of cleanups ]
[ mingo@elte.hu: redesign, splitups, cleanups. ]
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/char/tty_io.c')
-rw-r--r-- | drivers/char/tty_io.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 613ec816ce60..4d3c7018f0c3 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -1155,6 +1155,48 @@ static struct tty_driver *get_tty_driver(dev_t device, int *index) | |||
1155 | return NULL; | 1155 | return NULL; |
1156 | } | 1156 | } |
1157 | 1157 | ||
1158 | #ifdef CONFIG_CONSOLE_POLL | ||
1159 | |||
1160 | /** | ||
1161 | * tty_find_polling_driver - find device of a polled tty | ||
1162 | * @name: name string to match | ||
1163 | * @line: pointer to resulting tty line nr | ||
1164 | * | ||
1165 | * This routine returns a tty driver structure, given a name | ||
1166 | * and the condition that the tty driver is capable of polled | ||
1167 | * operation. | ||
1168 | */ | ||
1169 | struct tty_driver *tty_find_polling_driver(char *name, int *line) | ||
1170 | { | ||
1171 | struct tty_driver *p, *res = NULL; | ||
1172 | int tty_line = 0; | ||
1173 | char *str; | ||
1174 | |||
1175 | mutex_lock(&tty_mutex); | ||
1176 | /* Search through the tty devices to look for a match */ | ||
1177 | list_for_each_entry(p, &tty_drivers, tty_drivers) { | ||
1178 | str = name + strlen(p->name); | ||
1179 | tty_line = simple_strtoul(str, &str, 10); | ||
1180 | if (*str == ',') | ||
1181 | str++; | ||
1182 | if (*str == '\0') | ||
1183 | str = 0; | ||
1184 | |||
1185 | if (tty_line >= 0 && tty_line <= p->num && p->poll_init && | ||
1186 | !p->poll_init(p, tty_line, str)) { | ||
1187 | |||
1188 | res = p; | ||
1189 | *line = tty_line; | ||
1190 | break; | ||
1191 | } | ||
1192 | } | ||
1193 | mutex_unlock(&tty_mutex); | ||
1194 | |||
1195 | return res; | ||
1196 | } | ||
1197 | EXPORT_SYMBOL_GPL(tty_find_polling_driver); | ||
1198 | #endif | ||
1199 | |||
1158 | /** | 1200 | /** |
1159 | * tty_check_change - check for POSIX terminal changes | 1201 | * tty_check_change - check for POSIX terminal changes |
1160 | * @tty: tty to check | 1202 | * @tty: tty to check |
@@ -3850,6 +3892,11 @@ void tty_set_operations(struct tty_driver *driver, | |||
3850 | driver->write_proc = op->write_proc; | 3892 | driver->write_proc = op->write_proc; |
3851 | driver->tiocmget = op->tiocmget; | 3893 | driver->tiocmget = op->tiocmget; |
3852 | driver->tiocmset = op->tiocmset; | 3894 | driver->tiocmset = op->tiocmset; |
3895 | #ifdef CONFIG_CONSOLE_POLL | ||
3896 | driver->poll_init = op->poll_init; | ||
3897 | driver->poll_get_char = op->poll_get_char; | ||
3898 | driver->poll_put_char = op->poll_put_char; | ||
3899 | #endif | ||
3853 | } | 3900 | } |
3854 | 3901 | ||
3855 | 3902 | ||