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

From: Andrew Morton
Date: Fri Apr 21 2006 - 21:15:27 EST


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.
-
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/