From: Tobias Klauser <tklauser@distanz.ch>
To: Greg Kroah-Hartman <gregkh@suse.de>, linux-serial@vger.kernel.org
Cc: nios2-dev@sopc.et.ntust.edu.tw, linux-kernel@vger.kernel.org,
Anton Vorontsov <cbouatmailru@gmail.com>
Subject: [PATCH 2/4] tty: serial: altera_uart: Use port->regshift to store bus shift
Date: Wed, 9 Feb 2011 10:57:04 +0100 [thread overview]
Message-ID: <6ced1dcb96fc56fcdc8fb0daab898a773a7a320c.1297245277.git.tklauser@distanz.ch> (raw)
In-Reply-To: <cover.1297245277.git.tklauser@distanz.ch>
Use the regshift member of struct uart_port to store the address stride
from platform data. This way we can save one dereference per call of
altera_uart_readl and altera_uart_writel.
This also allows us to use the driver without platform data, which is
needed for device tree support in the Nios2 port.
Cc: Anton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
drivers/tty/serial/altera_uart.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c
index dee7a0e..3a57352 100644
--- a/drivers/tty/serial/altera_uart.c
+++ b/drivers/tty/serial/altera_uart.c
@@ -86,16 +86,12 @@ struct altera_uart {
static u32 altera_uart_readl(struct uart_port *port, int reg)
{
- struct altera_uart_platform_uart *platp = port->private_data;
-
- return readl(port->membase + (reg << platp->bus_shift));
+ return readl(port->membase + (reg << port->regshift));
}
static void altera_uart_writel(struct uart_port *port, u32 dat, int reg)
{
- struct altera_uart_platform_uart *platp = port->private_data;
-
- writel(dat, port->membase + (reg << platp->bus_shift));
+ writel(dat, port->membase + (reg << port->regshift));
}
static unsigned int altera_uart_tx_empty(struct uart_port *port)
@@ -546,13 +542,17 @@ static int __devinit altera_uart_probe(struct platform_device *pdev)
if (!port->membase)
return -ENOMEM;
+ if (platp)
+ port->regshift = platp->bus_shift;
+ else
+ port->regshift = 0;
+
port->line = i;
port->type = PORT_ALTERA_UART;
port->iotype = SERIAL_IO_MEM;
port->uartclk = platp->uartclk;
port->ops = &altera_uart_ops;
port->flags = UPF_BOOT_AUTOCONF;
- port->private_data = platp;
uart_add_one_port(&altera_uart_driver, port);
--
1.7.0.4
next prev parent reply other threads:[~2011-02-09 9:57 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-09 9:51 [PATCH 0/4] *** SUBJECT HERE *** Tobias Klauser
2011-02-09 9:51 ` [PATCH 1/4] tty: serial: altera_uart: Handle pdev->id == -1 in altera_uart_remove Tobias Klauser
2011-02-09 9:56 ` Tobias Klauser
2011-02-09 9:53 ` [PATCH 0/4] *** SUBJECT HERE *** Tobias Klauser
2011-02-09 9:55 ` [PATCH 0/4] tty: serial: Updates for altera_uart driver Tobias Klauser
2011-02-09 9:56 ` [PATCH 1/4] tty: serial: altera_uart: Handle pdev->id == -1 in altera_uart_remove Tobias Klauser
2011-02-09 10:46 ` Anton Vorontsov
2011-02-09 9:57 ` Tobias Klauser [this message]
2011-02-09 10:46 ` [PATCH 2/4] tty: serial: altera_uart: Use port->regshift to store bus shift Anton Vorontsov
2011-02-09 9:58 ` [PATCH 3/4] tty: serial: altera_uart: Add devicetree support Tobias Klauser
2011-02-16 4:32 ` Grant Likely
2011-02-16 7:43 ` Tobias Klauser
2011-02-16 12:07 ` Grant Likely
2011-02-16 16:12 ` [PATHV v2] " Tobias Klauser
2011-02-17 2:24 ` [Nios2-dev] " Thomas Chou
2011-02-17 7:48 ` Tobias Klauser
2011-02-18 1:28 ` Thomas Chou
2011-02-18 8:08 ` Grant Likely
2011-02-18 8:15 ` Tobias Klauser
2011-02-18 10:35 ` [PATCH 3/4 v3] " Tobias Klauser
2011-02-25 17:58 ` Greg KH
2011-02-28 8:31 ` Grant Likely
2011-02-09 9:58 ` [PATCH 4/4] MAINTAINERS: Add myself as a maintainer for altera_uart/altera_jtaguart Tobias Klauser
2011-02-17 3:16 ` [Nios2-dev] " Thomas Chou
2011-02-17 7:51 ` Tobias Klauser
2011-02-17 18:02 ` Arnd Bergmann
2011-02-17 19:29 ` Tobias Klauser
2011-02-17 19:32 ` [PATCH 0/4] tty: serial: Updates for altera_uart driver Greg KH
2011-02-17 19:38 ` Tobias Klauser
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=6ced1dcb96fc56fcdc8fb0daab898a773a7a320c.1297245277.git.tklauser@distanz.ch \
--to=tklauser@distanz.ch \
--cc=cbouatmailru@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=nios2-dev@sopc.et.ntust.edu.tw \
/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
all inboxes | Powered by JetHome®