Re: [PATCHv4 1/1] [RFC] uartclk from serial_core exposed to sysfs

From: Greg KH
Date: Wed Sep 05 2012 - 16:39:13 EST


On Sun, Aug 19, 2012 at 08:34:45PM +0200, Tomas Hlavacek wrote:
> Added file /sys/devices/.../tty/ttySX/uartclk to allow reading
> uartclk value in struct uart_port in serial_core via sysfs.
>
> It simplifies initialization verification of no-name cards that
> have non-standard oscillator speed while having no distinguishing
> PCI IDs to allow autodetection.
>
> tty_register_device() has been generalized and refactored in order
> to add support for setting drvdata and attribute_group to the device.
>
> Signed-off-by: Tomas Hlavacek <tmshlvck@xxxxxxxxx>

This looks good, but it doesn't apply to my tty-next branch in
linux-next, so I can't apply it.

But, when you redo it, here's one tiny thing to change:

> +/**
> + * tty_register_device_attr - register a tty device
> + * @driver: the tty driver that describes the tty device
> + * @index: the index in the tty driver for this tty device
> + * @device: a struct device that is associated with this tty device.
> + * This field is optional, if there is no known struct device
> + * for this tty device it can be set to NULL safely.
> + * @drvdata: Driver data to be set to device (NULL = do not touch).
> + * @attr_grp: Attribute group to be set on device (NULL = do not touch).

No need to mention the NULL thing here, "do not touch" doesn't mean
much to me.

> + if (attr_grp)
> + dev->groups = attr_grp;
> + if (drvdata)
> + dev_set_drvdata(dev, drvdata);

No need to test for NULL, just set them, it can't really hurt, right?

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/