Re: [PATCH 2.6.17-rc2 1/2] return class device pointer from tty_register_device()

From: Greg KH
Date: Sat Apr 22 2006 - 15:55:55 EST


On Fri, Apr 21, 2006 at 06:14:29PM -0700, Andrew Morton wrote:
> Tilman Schmidt <tilman@xxxxxxx> wrote:
> >
> > + * Returns a pointer to the class device (or NULL 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)
> > {
>
> It would be better to make this return ERR_PTR(-Efoo) on error, rather than
> NULL.
>
> That way, tty_register_device() ends with
>
> - class_device_create(tty_class, NULL, dev, device, "%s", name);
> + return class_device_create(tty_class, NULL, dev, device, "%s", name);
> }
>
> which is neat.

I agree, that would be nicer.

thanks,

greg k-h
-
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/