aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2006-03-25 01:30:00 -0500
committerPaul Mackerras <paulus@samba.org>2006-03-26 22:49:48 -0500
commit55aab8cd3a498201b769a19de861c77516bdfd45 (patch)
tree1d05000e49324876872bb8e9deb0359379674616 /drivers
parent1f5e3b028c5b592b5a792a390c78d609219aebfd (diff)
[PATCH] powerpc: HVC init race
I've been hitting a crash on boot where tty_open is being called before the hvc console driver setup is complete. This fixes the problem. Thanks to benh for his help on this. Signed-off-by: Michael Neuling <mikey@neuling.org> Acked-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/hvc_console.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index f65b2e14a485..a94c5b0cac52 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -823,34 +823,38 @@ EXPORT_SYMBOL(hvc_remove);
823 * interfaces start to become available. */ 823 * interfaces start to become available. */
824int __init hvc_init(void) 824int __init hvc_init(void)
825{ 825{
826 struct tty_driver *drv;
827
826 /* We need more than hvc_count adapters due to hotplug additions. */ 828 /* We need more than hvc_count adapters due to hotplug additions. */
827 hvc_driver = alloc_tty_driver(HVC_ALLOC_TTY_ADAPTERS); 829 drv = alloc_tty_driver(HVC_ALLOC_TTY_ADAPTERS);
828 if (!hvc_driver) 830 if (!drv)
829 return -ENOMEM; 831 return -ENOMEM;
830 832
831 hvc_driver->owner = THIS_MODULE; 833 drv->owner = THIS_MODULE;
832 hvc_driver->devfs_name = "hvc/"; 834 drv->devfs_name = "hvc/";
833 hvc_driver->driver_name = "hvc"; 835 drv->driver_name = "hvc";
834 hvc_driver->name = "hvc"; 836 drv->name = "hvc";
835 hvc_driver->major = HVC_MAJOR; 837 drv->major = HVC_MAJOR;
836 hvc_driver->minor_start = HVC_MINOR; 838 drv->minor_start = HVC_MINOR;
837 hvc_driver->type = TTY_DRIVER_TYPE_SYSTEM; 839 drv->type = TTY_DRIVER_TYPE_SYSTEM;
838 hvc_driver->init_termios = tty_std_termios; 840 drv->init_termios = tty_std_termios;
839 hvc_driver->flags = TTY_DRIVER_REAL_RAW; 841 drv->flags = TTY_DRIVER_REAL_RAW;
840 tty_set_operations(hvc_driver, &hvc_ops); 842 tty_set_operations(drv, &hvc_ops);
841 843
842 /* Always start the kthread because there can be hotplug vty adapters 844 /* Always start the kthread because there can be hotplug vty adapters
843 * added later. */ 845 * added later. */
844 hvc_task = kthread_run(khvcd, NULL, "khvcd"); 846 hvc_task = kthread_run(khvcd, NULL, "khvcd");
845 if (IS_ERR(hvc_task)) { 847 if (IS_ERR(hvc_task)) {
846 panic("Couldn't create kthread for console.\n"); 848 panic("Couldn't create kthread for console.\n");
847 put_tty_driver(hvc_driver); 849 put_tty_driver(drv);
848 return -EIO; 850 return -EIO;
849 } 851 }
850 852
851 if (tty_register_driver(hvc_driver)) 853 if (tty_register_driver(drv))
852 panic("Couldn't register hvc console driver\n"); 854 panic("Couldn't register hvc console driver\n");
853 855
856 mb();
857 hvc_driver = drv;
854 return 0; 858 return 0;
855} 859}
856module_init(hvc_init); 860module_init(hvc_init);