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

From: Randy.Dunlap
Date: Fri Jun 23 2006 - 00:03:47 EST


On Thu, 22 Jun 2006 09:06:40 -0400 Straub, Michael wrote:

> 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

Your mailer or (exchange?) server likes to break lines where
they shouldn't be split, as above 2 (now 4) lines.

> 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));
> }

Don't use unneeded parens around the return value. Just:
return class_device_create(foo bar blah);


---
~Randy
-
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/