aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tty_io.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-08-08 01:19:37 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-01 17:51:59 -0500
commit01107d343076c34b9e1ce5d073292bd7f3097fda (patch)
tree075dcadaff7c124022157c8ee819550cd1023440 /drivers/char/tty_io.c
parent94fbcded4ea0dc14cbfb222a5c68372f150d1476 (diff)
Driver core: convert tty core to use struct device
Converts from using struct "class_device" to "struct device" making everything show up properly in /sys/devices/ with symlinks from the /sys/class directory. Also fixes up the isdn drivers that were putting something in the class device's directory. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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 e90ea39c7c4b..50dc49205a23 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -3612,7 +3612,8 @@ static struct class *tty_class;
3612 * This field is optional, if there is no known struct device 3612 * This field is optional, if there is no known struct device
3613 * for this tty device it can be set to NULL safely. 3613 * for this tty device it can be set to NULL safely.
3614 * 3614 *
3615 * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error). 3615 * Returns a pointer to the struct device for this tty device
3616 * (or ERR_PTR(-EFOO) on error).
3616 * 3617 *
3617 * This call is required to be made to register an individual tty device 3618 * This call is required to be made to register an individual tty device
3618 * if the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If 3619 * if the tty driver's flags have the TTY_DRIVER_DYNAMIC_DEV bit set. If
@@ -3622,8 +3623,8 @@ static struct class *tty_class;
3622 * Locking: ?? 3623 * Locking: ??
3623 */ 3624 */
3624 3625
3625struct class_device *tty_register_device(struct tty_driver *driver, 3626struct device *tty_register_device(struct tty_driver *driver, unsigned index,
3626 unsigned index, struct device *device) 3627 struct device *device)
3627{ 3628{
3628 char name[64]; 3629 char name[64];
3629 dev_t dev = MKDEV(driver->major, driver->minor_start) + index; 3630 dev_t dev = MKDEV(driver->major, driver->minor_start) + index;
@@ -3639,7 +3640,7 @@ struct class_device *tty_register_device(struct tty_driver *driver,
3639 else 3640 else
3640 tty_line_name(driver, index, name); 3641 tty_line_name(driver, index, name);
3641 3642
3642 return class_device_create(tty_class, NULL, dev, device, "%s", name); 3643 return device_create(tty_class, device, dev, name);
3643} 3644}
3644 3645
3645/** 3646/**
@@ -3655,7 +3656,7 @@ struct class_device *tty_register_device(struct tty_driver *driver,
3655 3656
3656void tty_unregister_device(struct tty_driver *driver, unsigned index) 3657void tty_unregister_device(struct tty_driver *driver, unsigned index)
3657{ 3658{
3658 class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index); 3659 device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index);
3659} 3660}
3660 3661
3661EXPORT_SYMBOL(tty_register_device); 3662EXPORT_SYMBOL(tty_register_device);
@@ -3895,20 +3896,20 @@ static int __init tty_init(void)
3895 if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || 3896 if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
3896 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) 3897 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
3897 panic("Couldn't register /dev/tty driver\n"); 3898 panic("Couldn't register /dev/tty driver\n");
3898 class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty"); 3899 device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), "tty");
3899 3900
3900 cdev_init(&console_cdev, &console_fops); 3901 cdev_init(&console_cdev, &console_fops);
3901 if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || 3902 if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) ||
3902 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) 3903 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0)
3903 panic("Couldn't register /dev/console driver\n"); 3904 panic("Couldn't register /dev/console driver\n");
3904 class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, "console"); 3905 device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), "console");
3905 3906
3906#ifdef CONFIG_UNIX98_PTYS 3907#ifdef CONFIG_UNIX98_PTYS
3907 cdev_init(&ptmx_cdev, &ptmx_fops); 3908 cdev_init(&ptmx_cdev, &ptmx_fops);
3908 if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || 3909 if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) ||
3909 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) 3910 register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0)
3910 panic("Couldn't register /dev/ptmx driver\n"); 3911 panic("Couldn't register /dev/ptmx driver\n");
3911 class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); 3912 device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), "ptmx");
3912#endif 3913#endif
3913 3914
3914#ifdef CONFIG_VT 3915#ifdef CONFIG_VT
@@ -3916,7 +3917,7 @@ static int __init tty_init(void)
3916 if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || 3917 if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
3917 register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) 3918 register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
3918 panic("Couldn't register /dev/tty0 driver\n"); 3919 panic("Couldn't register /dev/tty0 driver\n");
3919 class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); 3920 device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), "tty0");
3920 3921
3921 vty_init(); 3922 vty_init();
3922#endif 3923#endif