diff options
author | Hansjoerg Lipp <hjlipp@web.de> | 2006-04-22 18:36:53 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 12:40:47 -0700 |
commit | 1cdcb6b43fda7424b7435dac8f80b2b5d8a48899 (patch) | |
tree | 3090342c60b9b8f0f8144f67962d3cb3ce2a9207 /drivers/char | |
parent | 53877d06d53a412d901bb323f080296c363d8b51 (diff) | |
download | linux-3.10-1cdcb6b43fda7424b7435dac8f80b2b5d8a48899.tar.gz linux-3.10-1cdcb6b43fda7424b7435dac8f80b2b5d8a48899.tar.bz2 linux-3.10-1cdcb6b43fda7424b7435dac8f80b2b5d8a48899.zip |
[PATCH] TTY: return class device pointer from tty_register_device()
Let tty_register_device() return a pointer to the class device it creates.
This allows registrants to add their own sysfs files under the class
device node.
Signed-off-by: Hansjoerg Lipp <hjlipp@web.de>
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/tty_io.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index a88b94a82b1..8b2a5996986 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@ -2961,12 +2961,14 @@ static struct class *tty_class; * This field is optional, if there is no known struct device for this * tty device it can be set to NULL safely. * + * Returns a pointer to the class device (or ERR_PTR(-EFOO) on error). + * * This call is required to be made to register an individual tty device if * the tty driver's flags have the TTY_DRIVER_NO_DEVFS bit set. If that * bit is not set, this function should not be called. */ -void tty_register_device(struct tty_driver *driver, unsigned index, - struct device *device) +struct class_device *tty_register_device(struct tty_driver *driver, + unsigned index, struct device *device) { char name[64]; dev_t dev = MKDEV(driver->major, driver->minor_start) + index; @@ -2974,7 +2976,7 @@ void tty_register_device(struct tty_driver *driver, unsigned index, if (index >= driver->num) { printk(KERN_ERR "Attempt to register invalid tty line number " " (%d).\n", index); - return; + return ERR_PTR(-EINVAL); } devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR, @@ -2984,7 +2986,8 @@ void tty_register_device(struct tty_driver *driver, unsigned index, pty_line_name(driver, index, name); else tty_line_name(driver, index, name); - class_device_create(tty_class, NULL, dev, device, "%s", name); + + return class_device_create(tty_class, NULL, dev, device, "%s", name); } /** |