aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-15 01:41:27 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-15 01:41:27 -0400
commitc362495586e8a3a6487a318fcd82eaf15ffe2142 (patch)
tree86f7b195d36ba198f24f86be327f21a8d24ec248 /drivers/tty
parentb70936d9ffbf0f45f4fa13a03122f015f13ecdb0 (diff)
parentddffeb8c4d0331609ef2581d84de4d763607bd37 (diff)
Merge 3.7-rc1 into tty-linus
This syncs up the tty-linus branch to the latest in Linus's tree to get all of the UAPI stuff needed for the next set of patches to merge. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/hvc/hvc_console.c33
-rw-r--r--drivers/tty/hvc/hvc_vio.c123
-rw-r--r--drivers/tty/hvc/hvc_xen.c5
-rw-r--r--drivers/tty/serial/kgdboc.c3
-rw-r--r--drivers/tty/vt/vt.c13
5 files changed, 115 insertions, 62 deletions
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index 4a652999380f..a5dec1ca1b82 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -245,6 +245,20 @@ static void hvc_port_destruct(struct tty_port *port)
245 kfree(hp); 245 kfree(hp);
246} 246}
247 247
248static void hvc_check_console(int index)
249{
250 /* Already enabled, bail out */
251 if (hvc_console.flags & CON_ENABLED)
252 return;
253
254 /* If this index is what the user requested, then register
255 * now (setup won't fail at this point). It's ok to just
256 * call register again if previously .setup failed.
257 */
258 if (index == hvc_console.index)
259 register_console(&hvc_console);
260}
261
248/* 262/*
249 * hvc_instantiate() is an early console discovery method which locates 263 * hvc_instantiate() is an early console discovery method which locates
250 * consoles * prior to the vio subsystem discovering them. Hotplugged 264 * consoles * prior to the vio subsystem discovering them. Hotplugged
@@ -275,12 +289,8 @@ int hvc_instantiate(uint32_t vtermno, int index, const struct hv_ops *ops)
275 if (last_hvc < index) 289 if (last_hvc < index)
276 last_hvc = index; 290 last_hvc = index;
277 291
278 /* if this index is what the user requested, then register 292 /* check if we need to re-register the kernel console */
279 * now (setup won't fail at this point). It's ok to just 293 hvc_check_console(index);
280 * call register again if previously .setup failed.
281 */
282 if (index == hvc_console.index)
283 register_console(&hvc_console);
284 294
285 return 0; 295 return 0;
286} 296}
@@ -877,10 +887,15 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
877 i = ++last_hvc; 887 i = ++last_hvc;
878 888
879 hp->index = i; 889 hp->index = i;
890 cons_ops[i] = ops;
891 vtermnos[i] = vtermno;
880 892
881 list_add_tail(&(hp->next), &hvc_structs); 893 list_add_tail(&(hp->next), &hvc_structs);
882 spin_unlock(&hvc_structs_lock); 894 spin_unlock(&hvc_structs_lock);
883 895
896 /* check if we need to re-register the kernel console */
897 hvc_check_console(i);
898
884 return hp; 899 return hp;
885} 900}
886EXPORT_SYMBOL_GPL(hvc_alloc); 901EXPORT_SYMBOL_GPL(hvc_alloc);
@@ -893,8 +908,12 @@ int hvc_remove(struct hvc_struct *hp)
893 tty = tty_port_tty_get(&hp->port); 908 tty = tty_port_tty_get(&hp->port);
894 909
895 spin_lock_irqsave(&hp->lock, flags); 910 spin_lock_irqsave(&hp->lock, flags);
896 if (hp->index < MAX_NR_HVC_CONSOLES) 911 if (hp->index < MAX_NR_HVC_CONSOLES) {
912 console_lock();
897 vtermnos[hp->index] = -1; 913 vtermnos[hp->index] = -1;
914 cons_ops[hp->index] = NULL;
915 console_unlock();
916 }
898 917
899 /* Don't whack hp->irq because tty_hangup() will need to free the irq. */ 918 /* Don't whack hp->irq because tty_hangup() will need to free the irq. */
900 919
diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c
index ee307799271a..070c0ee68642 100644
--- a/drivers/tty/hvc/hvc_vio.c
+++ b/drivers/tty/hvc/hvc_vio.c
@@ -230,6 +230,69 @@ static const struct hv_ops hvterm_hvsi_ops = {
230 .tiocmset = hvterm_hvsi_tiocmset, 230 .tiocmset = hvterm_hvsi_tiocmset,
231}; 231};
232 232
233static void udbg_hvc_putc(char c)
234{
235 int count = -1;
236
237 if (!hvterm_privs[0])
238 return;
239
240 if (c == '\n')
241 udbg_hvc_putc('\r');
242
243 do {
244 switch(hvterm_privs[0]->proto) {
245 case HV_PROTOCOL_RAW:
246 count = hvterm_raw_put_chars(0, &c, 1);
247 break;
248 case HV_PROTOCOL_HVSI:
249 count = hvterm_hvsi_put_chars(0, &c, 1);
250 break;
251 }
252 } while(count == 0);
253}
254
255static int udbg_hvc_getc_poll(void)
256{
257 int rc = 0;
258 char c;
259
260 if (!hvterm_privs[0])
261 return -1;
262
263 switch(hvterm_privs[0]->proto) {
264 case HV_PROTOCOL_RAW:
265 rc = hvterm_raw_get_chars(0, &c, 1);
266 break;
267 case HV_PROTOCOL_HVSI:
268 rc = hvterm_hvsi_get_chars(0, &c, 1);
269 break;
270 }
271 if (!rc)
272 return -1;
273 return c;
274}
275
276static int udbg_hvc_getc(void)
277{
278 int ch;
279
280 if (!hvterm_privs[0])
281 return -1;
282
283 for (;;) {
284 ch = udbg_hvc_getc_poll();
285 if (ch == -1) {
286 /* This shouldn't be needed...but... */
287 volatile unsigned long delay;
288 for (delay=0; delay < 2000000; delay++)
289 ;
290 } else {
291 return ch;
292 }
293 }
294}
295
233static int __devinit hvc_vio_probe(struct vio_dev *vdev, 296static int __devinit hvc_vio_probe(struct vio_dev *vdev,
234 const struct vio_device_id *id) 297 const struct vio_device_id *id)
235{ 298{
@@ -289,6 +352,13 @@ static int __devinit hvc_vio_probe(struct vio_dev *vdev,
289 return PTR_ERR(hp); 352 return PTR_ERR(hp);
290 dev_set_drvdata(&vdev->dev, hp); 353 dev_set_drvdata(&vdev->dev, hp);
291 354
355 /* register udbg if it's not there already for console 0 */
356 if (hp->index == 0 && !udbg_putc) {
357 udbg_putc = udbg_hvc_putc;
358 udbg_getc = udbg_hvc_getc;
359 udbg_getc_poll = udbg_hvc_getc_poll;
360 }
361
292 return 0; 362 return 0;
293} 363}
294 364
@@ -331,59 +401,6 @@ static void __exit hvc_vio_exit(void)
331} 401}
332module_exit(hvc_vio_exit); 402module_exit(hvc_vio_exit);
333 403
334static void udbg_hvc_putc(char c)
335{
336 int count = -1;
337
338 if (c == '\n')
339 udbg_hvc_putc('\r');
340
341 do {
342 switch(hvterm_priv0.proto) {
343 case HV_PROTOCOL_RAW:
344 count = hvterm_raw_put_chars(0, &c, 1);
345 break;
346 case HV_PROTOCOL_HVSI:
347 count = hvterm_hvsi_put_chars(0, &c, 1);
348 break;
349 }
350 } while(count == 0);
351}
352
353static int udbg_hvc_getc_poll(void)
354{
355 int rc = 0;
356 char c;
357
358 switch(hvterm_priv0.proto) {
359 case HV_PROTOCOL_RAW:
360 rc = hvterm_raw_get_chars(0, &c, 1);
361 break;
362 case HV_PROTOCOL_HVSI:
363 rc = hvterm_hvsi_get_chars(0, &c, 1);
364 break;
365 }
366 if (!rc)
367 return -1;
368 return c;
369}
370
371static int udbg_hvc_getc(void)
372{
373 int ch;
374 for (;;) {
375 ch = udbg_hvc_getc_poll();
376 if (ch == -1) {
377 /* This shouldn't be needed...but... */
378 volatile unsigned long delay;
379 for (delay=0; delay < 2000000; delay++)
380 ;
381 } else {
382 return ch;
383 }
384 }
385}
386
387void __init hvc_vio_init_early(void) 404void __init hvc_vio_init_early(void)
388{ 405{
389 struct device_node *stdout_node; 406 struct device_node *stdout_node;
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index 2944ff88fdc0..f4abfe238f98 100644
--- a/drivers/tty/hvc/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
@@ -478,7 +478,6 @@ static void xencons_backend_changed(struct xenbus_device *dev,
478 case XenbusStateInitialising: 478 case XenbusStateInitialising:
479 case XenbusStateInitialised: 479 case XenbusStateInitialised:
480 case XenbusStateUnknown: 480 case XenbusStateUnknown:
481 case XenbusStateClosed:
482 break; 481 break;
483 482
484 case XenbusStateInitWait: 483 case XenbusStateInitWait:
@@ -488,6 +487,10 @@ static void xencons_backend_changed(struct xenbus_device *dev,
488 xenbus_switch_state(dev, XenbusStateConnected); 487 xenbus_switch_state(dev, XenbusStateConnected);
489 break; 488 break;
490 489
490 case XenbusStateClosed:
491 if (dev->state == XenbusStateClosed)
492 break;
493 /* Missed the backend's CLOSING state -- fallthrough */
491 case XenbusStateClosing: 494 case XenbusStateClosing:
492 xenbus_frontend_closed(dev); 495 xenbus_frontend_closed(dev);
493 break; 496 break;
diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
index c0b334327d93..10020547c60b 100644
--- a/drivers/tty/serial/kgdboc.c
+++ b/drivers/tty/serial/kgdboc.c
@@ -97,7 +97,8 @@ static void kgdboc_restore_input(void)
97 97
98static int kgdboc_register_kbd(char **cptr) 98static int kgdboc_register_kbd(char **cptr)
99{ 99{
100 if (strncmp(*cptr, "kbd", 3) == 0) { 100 if (strncmp(*cptr, "kbd", 3) == 0 ||
101 strncmp(*cptr, "kdb", 3) == 0) {
101 if (kdb_poll_idx < KDB_POLL_FUNC_MAX) { 102 if (kdb_poll_idx < KDB_POLL_FUNC_MAX) {
102 kdb_poll_funcs[kdb_poll_idx] = kdb_get_kbd_char; 103 kdb_poll_funcs[kdb_poll_idx] = kdb_get_kbd_char;
103 kdb_poll_idx++; 104 kdb_poll_idx++;
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 999ca63afdef..f87d7e8964bf 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3442,6 +3442,19 @@ int con_debug_enter(struct vc_data *vc)
3442 kdb_set(2, setargs); 3442 kdb_set(2, setargs);
3443 } 3443 }
3444 } 3444 }
3445 if (vc->vc_cols < 999) {
3446 int colcount;
3447 char cols[4];
3448 const char *setargs[3] = {
3449 "set",
3450 "COLUMNS",
3451 cols,
3452 };
3453 if (kdbgetintenv(setargs[0], &colcount)) {
3454 snprintf(cols, 4, "%i", vc->vc_cols);
3455 kdb_set(2, setargs);
3456 }
3457 }
3445#endif /* CONFIG_KGDB_KDB */ 3458#endif /* CONFIG_KGDB_KDB */
3446 return ret; 3459 return ret;
3447} 3460}