aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2008-02-09 12:24:33 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2008-02-09 12:24:39 -0500
commit59eb1ca7a8906412478656ba79261036261f4b76 (patch)
treee21974f7a9f07cc1f4f2378428ea1c76b9259018
parentbf3f837804997e5f5d9888051e9e5356961af0f2 (diff)
[S390] sclp_vt220: Fix vt220 initialization
There are two problems in the vt220 intialization: o Currently the vt220 console looses early printk events until the the vt220 tty is registered. o console should work if tty_register fails sclp_vt220_con_init calls __sclp_vt220_init and register_console. It does not register the driver with the sclp core code via sclp_register. That results in an sclp_send_mask=0. Therefore, __sclp_vt220_emit will reject buffers with EIO. Unfortunately register_console will cause the printk buffer to be sent to the console and, therefore, every early message gets dropped. The sclp_send_mask is set later during boot, when sclp_vt220_tty_init calls sclp_register. The solution is to move the sclp_register call from sclp_vt220_tty_init to __sclp_vt220_init. This makes sure that the console is properly registered with the sclp subsystem before the first log buffer messages are passed to the vt220 console. We also adopt the cleanup on error to keep the console alive if tty_register fails. Thanks to Peter Oberparleiter and Heiko Carstens for review and ideas for improvement. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--drivers/s390/char/sclp_vt220.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/s390/char/sclp_vt220.c b/drivers/s390/char/sclp_vt220.c
index 68071622d4bb..f47f4a768be5 100644
--- a/drivers/s390/char/sclp_vt220.c
+++ b/drivers/s390/char/sclp_vt220.c
@@ -3,7 +3,7 @@
3 * SCLP VT220 terminal driver. 3 * SCLP VT220 terminal driver.
4 * 4 *
5 * S390 version 5 * S390 version
6 * Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation 6 * Copyright IBM Corp. 2003,2008
7 * Author(s): Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com> 7 * Author(s): Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com>
8 */ 8 */
9 9
@@ -632,6 +632,9 @@ static void __init __sclp_vt220_cleanup(void)
632 else 632 else
633 free_bootmem((unsigned long) page, PAGE_SIZE); 633 free_bootmem((unsigned long) page, PAGE_SIZE);
634 } 634 }
635 if (!list_empty(&sclp_vt220_register.list))
636 sclp_unregister(&sclp_vt220_register);
637 sclp_vt220_initialized = 0;
635} 638}
636 639
637static int __init __sclp_vt220_init(void) 640static int __init __sclp_vt220_init(void)
@@ -639,6 +642,7 @@ static int __init __sclp_vt220_init(void)
639 void *page; 642 void *page;
640 int i; 643 int i;
641 int num_pages; 644 int num_pages;
645 int rc;
642 646
643 if (sclp_vt220_initialized) 647 if (sclp_vt220_initialized)
644 return 0; 648 return 0;
@@ -667,7 +671,14 @@ static int __init __sclp_vt220_init(void)
667 } 671 }
668 list_add_tail((struct list_head *) page, &sclp_vt220_empty); 672 list_add_tail((struct list_head *) page, &sclp_vt220_empty);
669 } 673 }
670 return 0; 674 rc = sclp_register(&sclp_vt220_register);
675 if (rc) {
676 printk(KERN_ERR SCLP_VT220_PRINT_HEADER
677 "could not register vt220 - "
678 "sclp_register returned %d\n", rc);
679 __sclp_vt220_cleanup();
680 }
681 return rc;
671} 682}
672 683
673static const struct tty_operations sclp_vt220_ops = { 684static const struct tty_operations sclp_vt220_ops = {
@@ -688,22 +699,17 @@ static int __init sclp_vt220_tty_init(void)
688{ 699{
689 struct tty_driver *driver; 700 struct tty_driver *driver;
690 int rc; 701 int rc;
702 int cleanup;
691 703
692 /* Note: we're not testing for CONSOLE_IS_SCLP here to preserve 704 /* Note: we're not testing for CONSOLE_IS_SCLP here to preserve
693 * symmetry between VM and LPAR systems regarding ttyS1. */ 705 * symmetry between VM and LPAR systems regarding ttyS1. */
694 driver = alloc_tty_driver(1); 706 driver = alloc_tty_driver(1);
695 if (!driver) 707 if (!driver)
696 return -ENOMEM; 708 return -ENOMEM;
709 cleanup = !sclp_vt220_initialized;
697 rc = __sclp_vt220_init(); 710 rc = __sclp_vt220_init();
698 if (rc) 711 if (rc)
699 goto out_driver; 712 goto out_driver;
700 rc = sclp_register(&sclp_vt220_register);
701 if (rc) {
702 printk(KERN_ERR SCLP_VT220_PRINT_HEADER
703 "could not register tty - "
704 "sclp_register returned %d\n", rc);
705 goto out_init;
706 }
707 713
708 driver->owner = THIS_MODULE; 714 driver->owner = THIS_MODULE;
709 driver->driver_name = SCLP_VT220_DRIVER_NAME; 715 driver->driver_name = SCLP_VT220_DRIVER_NAME;
@@ -721,15 +727,14 @@ static int __init sclp_vt220_tty_init(void)
721 printk(KERN_ERR SCLP_VT220_PRINT_HEADER 727 printk(KERN_ERR SCLP_VT220_PRINT_HEADER
722 "could not register tty - " 728 "could not register tty - "
723 "tty_register_driver returned %d\n", rc); 729 "tty_register_driver returned %d\n", rc);
724 goto out_sclp; 730 goto out_init;
725 } 731 }
726 sclp_vt220_driver = driver; 732 sclp_vt220_driver = driver;
727 return 0; 733 return 0;
728 734
729out_sclp:
730 sclp_unregister(&sclp_vt220_register);
731out_init: 735out_init:
732 __sclp_vt220_cleanup(); 736 if (cleanup)
737 __sclp_vt220_cleanup();
733out_driver: 738out_driver:
734 put_tty_driver(driver); 739 put_tty_driver(driver);
735 return rc; 740 return rc;