Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

uart: update the sysfs handler to use uart_get_info

The two patches needed are now in the tree. The first added the sysfs
interface and directly accesses the uartclk. The second provides a
proper interface for getting the values.

Wire them together.

This formes a basis for both get and set methods for any of the other uart
properties and we can now fill them out further.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alan Cox and committed by
Greg Kroah-Hartman
bebe73e3 15a12e83

+5 -5
+5 -5
drivers/tty/serial/serial_core.c
··· 2329 2329 static ssize_t uart_get_attr_uartclk(struct device *dev, 2330 2330 struct device_attribute *attr, char *buf) 2331 2331 { 2332 - int ret; 2332 + struct serial_struct tmp; 2333 2333 struct tty_port *port = dev_get_drvdata(dev); 2334 2334 struct uart_state *state = container_of(port, struct uart_state, port); 2335 2335 2336 - mutex_lock(&state->port.mutex); 2337 - ret = snprintf(buf, PAGE_SIZE, "%d\n", state->uart_port->uartclk); 2338 - mutex_unlock(&state->port.mutex); 2336 + mutex_lock(&port->mutex); 2337 + uart_get_info(port, state, &tmp); 2338 + mutex_unlock(&port->mutex); 2339 2339 2340 - return ret; 2340 + return snprintf(buf, PAGE_SIZE, "%d\n", tmp.baud_base * 16); 2341 2341 } 2342 2342 2343 2343 static DEVICE_ATTR(uartclk, S_IRUSR | S_IRGRP, uart_get_attr_uartclk, NULL);