aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tty_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/tty_io.c')
-rw-r--r--drivers/char/tty_io.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 83e9e7d9b58c..b3cfc8bc613c 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3615,7 +3615,8 @@ static struct class *tty_class;
3615 * This field is optional, if there is no known struct device 3615 * This field is optional, if there is no known struct device
3616 * for this tty device it can be set to NULL safely. 3616 * for this tty device it can be set to NULL safely.
3617 * 3617 *
3618 * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error). 3618 * Returns a pointer to the struct device for this tty device
3619 * (or ERR_PTR(-EFOO) on error).
3619 * 3620 *
3620 * This call is required to be made to register an individual tty device 3621 * This call is required to be made to register an individual tty device
3621 * if the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If 3622 * if the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If
@@ -3625,8 +3626,8 @@ static struct class *tty_class;
3625 * Locking: ?? 3626 * Locking: ??
3626 */ 3627 */
3627 3628
3628struct class_device *tty_register_device(struct tty_driver *driver, 3629struct device *tty_register_device(struct tty_driver *driver, unsigned index,
3629 unsigned index, struct device *device) 3630 struct device *device)
3630{ 3631{
3631 char name[64]; 3632 char name[64];
3632 dev_t dev = MKDEV(driver->major, driver->minor_start) + index; 3633 dev_t dev = MKDEV(driver->major, driver->minor_start) + index;
@@ -3642,7 +3643,7 @@ struct class_device *tty_register_device(struct tty_driver *driver,
3642 else 3643 else
3643 tty_line_name(driver, index, name); 3644 tty_line_name(driver, index, name);
3644 3645
3645 return class_device_create(tty_class, NULL, dev, device, "%s", name); 3646 return device_create(tty_class, device, dev, name);
3646} 3647}
3647 3648
3648/** 3649/**
@@ -3658,7 +3659,7 @@ struct class_device *tty_register_device(struct tty_driver *driver,
3658 3659
3659void tty_unregister_device(struct tty_driver *driver, unsigned index) 3660void tty_unregister_device(struct tty_driver *driver, unsigned index)
3660{ 3661{
3661 class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); 3662 device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index);
3662} 3663}
3663 3664
3664EXPORT_SYMBOL(tty_register_device); 3665EXPORT_SYMBOL(tty_register_device);
@@ -3898,20 +3899,20 @@ static int __init tty_init(void)
3898 if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || 3899 if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
3899 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) 3900 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
3900 panic("Couldn't register /dev/tty driver\n"); 3901 panic("Couldn't register /dev/tty driver\n");
3901 class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty"); 3902 device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), "tty");
3902 3903
3903 cdev_init(&console_cdev, &console_fops); 3904 cdev_init(&console_cdev, &console_fops);
3904 if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || 3905 if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) ||
3905 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) 3906 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0)
3906 panic("Couldn't register /dev/console driver\n"); 3907 panic("Couldn't register /dev/console driver\n");
3907 class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, "console"); 3908 device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), "console");
3908 3909
3909#ifdef CONFIG_UNIX98_PTYS 3910#ifdef CONFIG_UNIX98_PTYS
3910 cdev_init(&ptmx_cdev, &ptmx_fops); 3911 cdev_init(&ptmx_cdev, &ptmx_fops);
3911 if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || 3912 if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) ||
3912 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) 3913 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0)
3913 panic("Couldn't register /dev/ptmx driver\n"); 3914 panic("Couldn't register /dev/ptmx driver\n");
3914 class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); 3915 device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), "ptmx");
3915#endif 3916#endif
3916 3917
3917#ifdef CONFIG_VT 3918#ifdef CONFIG_VT
@@ -3919,7 +3920,7 @@ static int __init tty_init(void)
3919 if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || 3920 if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
3920 register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) 3921 register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
3921 panic("Couldn't register /dev/tty0 driver\n"); 3922 panic("Couldn't register /dev/tty0 driver\n");
3922 class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); 3923 device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), "tty0");
3923 3924
3924 vty_init(); 3925 vty_init();
3925#endif 3926#endif