aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tty_io.c47
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 */
1169struct 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}
1197EXPORT_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