diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-05-21 15:52:33 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-07-22 00:54:41 -0400 |
commit | 47aa5793f78c274d51711f6a621fa6b02d4e6402 (patch) | |
tree | 88c45b3a90fc7d7b4210bf5727497294b0a951eb /drivers/char/tty_io.c | |
parent | f79f060561d04a38d41e773ade9baafce3c96179 (diff) |
device create: char: convert device_create to device_create_drvdata
device_create() is race-prone, so use the race-free
device_create_drvdata() instead as device_create() is going away.
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/tty_io.c')
-rw-r--r-- | drivers/char/tty_io.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 82f6a8c86332..dc9202d2dd63 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -4045,7 +4045,7 @@ struct device *tty_register_device(struct tty_driver *driver, unsigned index, | |||
4045 | else | 4045 | else |
4046 | tty_line_name(driver, index, name); | 4046 | tty_line_name(driver, index, name); |
4047 | 4047 | ||
4048 | return device_create(tty_class, device, dev, name); | 4048 | return device_create_drvdata(tty_class, device, dev, NULL, name); |
4049 | } | 4049 | } |
4050 | 4050 | ||
4051 | /** | 4051 | /** |
@@ -4323,20 +4323,22 @@ static int __init tty_init(void) | |||
4323 | if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || | 4323 | if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) || |
4324 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) | 4324 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0) |
4325 | panic("Couldn't register /dev/tty driver\n"); | 4325 | panic("Couldn't register /dev/tty driver\n"); |
4326 | device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), "tty"); | 4326 | device_create_drvdata(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, |
4327 | "tty"); | ||
4327 | 4328 | ||
4328 | cdev_init(&console_cdev, &console_fops); | 4329 | cdev_init(&console_cdev, &console_fops); |
4329 | if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || | 4330 | if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) || |
4330 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) | 4331 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0) |
4331 | panic("Couldn't register /dev/console driver\n"); | 4332 | panic("Couldn't register /dev/console driver\n"); |
4332 | device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), "console"); | 4333 | device_create_drvdata(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, |
4334 | "console"); | ||
4333 | 4335 | ||
4334 | #ifdef CONFIG_UNIX98_PTYS | 4336 | #ifdef CONFIG_UNIX98_PTYS |
4335 | cdev_init(&ptmx_cdev, &ptmx_fops); | 4337 | cdev_init(&ptmx_cdev, &ptmx_fops); |
4336 | if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || | 4338 | if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) || |
4337 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) | 4339 | register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0) |
4338 | panic("Couldn't register /dev/ptmx driver\n"); | 4340 | panic("Couldn't register /dev/ptmx driver\n"); |
4339 | device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), "ptmx"); | 4341 | device_create_drvdata(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx"); |
4340 | #endif | 4342 | #endif |
4341 | 4343 | ||
4342 | #ifdef CONFIG_VT | 4344 | #ifdef CONFIG_VT |
@@ -4344,7 +4346,7 @@ static int __init tty_init(void) | |||
4344 | if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || | 4346 | if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) || |
4345 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) | 4347 | register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0) |
4346 | panic("Couldn't register /dev/tty0 driver\n"); | 4348 | panic("Couldn't register /dev/tty0 driver\n"); |
4347 | device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), "tty0"); | 4349 | device_create_drvdata(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0"); |
4348 | 4350 | ||
4349 | vty_init(); | 4351 | vty_init(); |
4350 | #endif | 4352 | #endif |