From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: linux-serial@vger.kernel.org, greg@kroah.com
Subject: [PATCH 1/3] uart: update the sysfs handler to use uart_get_info
Date: Mon, 29 Oct 2012 15:19:57 +0000 [thread overview]
Message-ID: <20121029151901.9451.41783.stgit@localhost.localdomain> (raw)
From: Alan Cox <alan@linux.intel.com>
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>
---
drivers/tty/serial/serial_core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 0fcfd98..477e079 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -2329,15 +2329,15 @@ struct tty_driver *uart_console_device(struct console *co, int *index)
static ssize_t uart_get_attr_uartclk(struct device *dev,
struct device_attribute *attr, char *buf)
{
- int ret;
+ struct serial_struct tmp;
struct tty_port *port = dev_get_drvdata(dev);
struct uart_state *state = container_of(port, struct uart_state, port);
- mutex_lock(&state->port.mutex);
- ret = snprintf(buf, PAGE_SIZE, "%d\n", state->uart_port->uartclk);
- mutex_unlock(&state->port.mutex);
+ mutex_lock(&port->mutex);
+ uart_get_info(port, state, &tmp);
+ mutex_unlock(&port->mutex);
- return ret;
+ return snprintf(buf, PAGE_SIZE, "%d\n", tmp.baud_base * 16);
}
static DEVICE_ATTR(uartclk, S_IRUSR | S_IRGRP, uart_get_attr_uartclk, NULL);
next reply other threads:[~2012-10-29 15:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-29 15:19 Alan Cox [this message]
2012-10-29 15:20 ` [PATCH 2/3] uart: tidy the uart_get_info API Alan Cox
2012-10-29 15:20 ` [PATCH 3/3] uart: add other serial core layer get attributes Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121029151901.9451.41783.stgit@localhost.localdomain \
--to=alan@lxorguk.ukuu.org.uk \
--cc=greg@kroah.com \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).