Thread (30 messages) 30 messages, 6 authors, 2012-09-06

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

From: Greg KH <gregkh@linuxfoundation.org>
Date: 2012-09-05 20:39:22
Also in: lkml

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 <redacted>
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help