[RFC][PATCH 1/13] SST driver: tty_register_device() change

From: Straub, Michael
Date: Thu Jun 22 2006 - 09:05:18 EST


Adds Equinox multi-port serial (SST) driver.

Part 1: Modifies the tty subsystem routine tty_register_device so that
it
returns the class_device allocated for the tty device, thus making it
available to the tty driver. The class_device is used by this driver to
add additional sysfs-based attribute files used for status and
diagnostics.

Signed-off-by: Mike Straub <michael.straub@xxxxxxxxxxx>

---
drivers/char/tty_io.c | 8 ++++----
include/linux/tty.h | 4 +++-
2 files changed, 7 insertions(+), 5 deletions(-)

diff -Naurp -X dontdiff linux-2.6.17/include/linux/tty.h
linux-2.6.17.eqnx/include/linux/tty.h
--- linux-2.6.17/include/linux/tty.h 2006-06-17 21:49:35.000000000
-0400
+++ linux-2.6.17.eqnx/include/linux/tty.h 2006-06-20
09:49:54.000000000 -0400
@@ -291,7 +291,9 @@ extern int tty_register_ldisc(int disc,
extern int tty_unregister_ldisc(int disc);
extern int tty_register_driver(struct tty_driver *driver);
extern int tty_unregister_driver(struct tty_driver *driver);
-extern void tty_register_device(struct tty_driver *driver, unsigned
index, struct device *dev);
+extern struct class_device *tty_register_device(struct tty_driver
*driver,
+ unsigned index,
+ struct device *dev);
extern void tty_unregister_device(struct tty_driver *driver, unsigned
index);
extern int tty_read_raw_data(struct tty_struct *tty, unsigned char
*bufp,
int buflen);
diff -Naurp -X dontdiff linux-2.6.17/drivers/char/tty_io.c
linux-2.6.17.eqnx/drivers/char/tty_io.c
--- linux-2.6.17/drivers/char/tty_io.c 2006-06-17 21:49:35.000000000
-0400
+++ linux-2.6.17.eqnx/drivers/char/tty_io.c 2006-06-20
09:49:54.000000000 -0400
@@ -2965,8 +2965,8 @@ static struct class *tty_class;
* 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 +2974,7 @@ void tty_register_device(struct tty_driv
if (index >= driver->num) {
printk(KERN_ERR "Attempt to register invalid tty line
number "
" (%d).\n", index);
- return;
+ return NULL;
}

devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR,
@@ -2984,7 +2984,7 @@ void tty_register_device(struct tty_driv
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));
}

/**
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/