All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Noam Camus <noamc@ezchip.com>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Subject: Re: [v2 2/3] serial: 8250_dw: dw8250_setup_port() use endianness aware read.
Date: Mon, 3 Aug 2015 16:42:21 -0700	[thread overview]
Message-ID: <20150803234221.GA5257@kroah.com> (raw)
In-Reply-To: <1437886478-29273-3-git-send-email-noamc@ezchip.com>

On Sun, Jul 26, 2015 at 07:54:37AM +0300, Noam Camus wrote:
> From: Noam Camus <noamc@ezchip.com>
> 
> readl() for UCV and CPR will not work for port type UPIO_MEM32BE.
> Instead we use ioread32be for uart port of type UPIO_MEM32BE.
> 
> Signed-off-by: Noam Camus <noamc@ezchip.com>
> ---
>  drivers/tty/serial/8250/8250_dw.c |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index 5c60ec8..9bc4cac 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -291,7 +291,9 @@ static bool dw8250_dma_filter(struct dma_chan *chan, void *param)
>  static void dw8250_setup_port(struct uart_8250_port *up)
>  {
>  	struct uart_port	*p = &up->port;
> -	u32			reg = readl(p->membase + DW_UART_UCV);
> +	u32			reg = (p->iotype == UPIO_MEM32BE) ?
> +					ioread32be(p->membase + DW_UART_UCV) :
> +					readl(p->membase + DW_UART_UCV);

Ugh.  Just use a "real" if statement for this please.  Don't abuse ? :
lines for no reason.


>  
>  	/*
>  	 * If the Component Version Register returns zero, we know that
> @@ -303,7 +305,9 @@ static void dw8250_setup_port(struct uart_8250_port *up)
>  	dev_dbg_ratelimited(p->dev, "Designware UART version %c.%c%c\n",
>  		(reg >> 24) & 0xff, (reg >> 16) & 0xff, (reg >> 8) & 0xff);
>  
> -	reg = readl(p->membase + DW_UART_CPR);
> +	reg = (p->iotype == UPIO_MEM32BE) ?
> +		ioread32be(p->membase + DW_UART_CPR) :
> +		readl(p->membase + DW_UART_CPR);

Same here.

And shouldn't all of this be "hidden" behind something else?  You should
not have to do this for each readl call...

thanks,

greg k-h

  parent reply	other threads:[~2015-08-03 23:42 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-22  9:34 [PATCH 0/4] *** 8250_dw *** Noam Camus
2015-07-22  9:34 ` Noam Camus
2015-07-22  9:34 ` [PATCH 1/4] serial: 8250_dw: Add support for big-endian MMIO accesses Noam Camus
2015-07-22  9:34   ` Noam Camus
2015-07-22  9:34   ` [PATCH 2/4] serial: 8250_dw: Add UPF_SKIP_TEST to flags depend on device tree Noam Camus
2015-07-22  9:34     ` Noam Camus
2015-07-22  9:34     ` [PATCH 3/4] serial: 8250_dw: Add UPF_FIXED_TYPE to flags Noam Camus
2015-07-22  9:34       ` Noam Camus
2015-07-22  9:34       ` [PATCH 4/4] serial: 8250_dw: use serial_in() and not readl() Noam Camus
2015-07-22  9:34         ` Noam Camus
2015-07-22 12:51         ` Peter Hurley
2015-07-23 10:40           ` Noam Camus
2015-07-23 10:40             ` Noam Camus
2015-07-22 12:38       ` [PATCH 3/4] serial: 8250_dw: Add UPF_FIXED_TYPE to flags Peter Hurley
2015-07-23 10:38         ` Noam Camus
2015-07-23 10:38           ` Noam Camus
2015-07-22 12:20     ` [PATCH 2/4] serial: 8250_dw: Add UPF_SKIP_TEST to flags depend on device tree Peter Hurley
2015-07-23  6:21       ` Noam Camus
2015-07-23  6:21         ` Noam Camus
2015-07-23  6:46         ` Frans Klaver
2015-07-22 12:19   ` [PATCH 1/4] serial: 8250_dw: Add support for big-endian MMIO accesses Peter Hurley
2015-07-22 12:41     ` Peter Hurley
2015-07-23  6:15       ` Noam Camus
2015-07-23  6:15         ` Noam Camus
2015-07-23  6:13     ` Noam Camus
2015-07-23  6:13       ` Noam Camus
     [not found] ` <1437886478-29273-1-git-send-email-noamc@ezchip.com>
     [not found]   ` <1437886478-29273-2-git-send-email-noamc@ezchip.com>
     [not found]     ` <1437886478-29273-3-git-send-email-noamc@ezchip.com>
2015-08-03 23:42       ` Greg KH [this message]
2015-08-10 19:13         ` [v2 2/3] serial: 8250_dw: dw8250_setup_port() use endianness aware read Noam Camus
     [not found]       ` <1437886478-29273-4-git-send-email-noamc@ezchip.com>
2015-08-03 23:44         ` [v2 3/3] serial: 8250_dw: Add UPF_SKIP_TEST to flags depend on device tree Greg KH
2015-08-10 19:21           ` Noam Camus
2015-08-03 23:43     ` [v2 1/3] serial: 8250_dw: Add support for big-endian MMIO accesses Greg KH
2015-08-10 19:08       ` Noam Camus
     [not found]   ` <1439378312-6463-1-git-send-email-noamc@ezchip.com>
     [not found]     ` <1439378312-6463-2-git-send-email-noamc@ezchip.com>
     [not found]       ` <1439378312-6463-3-git-send-email-noamc@ezchip.com>
     [not found]         ` <1439378312-6463-4-git-send-email-noamc@ezchip.com>
2015-08-12 13:16           ` [v3 3/3] serial: 8250_dw: Add UPF_SKIP_TEST to flags depend on device tree Peter Hurley
2015-08-12 15:51             ` Noam Camus
2015-08-12 15:51               ` Noam Camus
2015-08-13 14:20               ` Vineet Gupta
2015-08-21 10:33   ` [v4 0/2] *** 8250_dw *** Noam Camus
2015-08-21 10:33     ` Noam Camus
2015-08-21 10:33     ` [v4 1/2] serial: 8250_dw: Add support for big-endian MMIO accesses Noam Camus
2015-08-21 10:33       ` Noam Camus
2015-08-21 10:33       ` [v4 2/2] serial: 8250_dw: dw8250_setup_port() use endianness aware read Noam Camus
2015-08-21 10:33         ` Noam Camus
2015-08-21 10:41         ` Vineet Gupta
2015-08-25  8:57   ` [v5] *** 8250_dw *** Noam Camus
2015-08-25  8:57     ` Noam Camus
2015-08-25  8:57     ` [v5] serial: 8250_dw: Add support for big-endian MMIO accesses Noam Camus
2015-08-25  8:57       ` Noam Camus
2015-10-04 17:37       ` Greg KH
2015-10-06  6:39       ` [v6] *** 8250_dw *** Noam Camus
2015-10-06  6:39         ` Noam Camus
2015-10-06  6:39         ` [v6] serial: 8250_dw: Add support for big-endian MMIO accesses Noam Camus
2015-10-06  6:39           ` Noam Camus
2015-10-06  7:25           ` kbuild test robot
2015-10-06  7:25             ` kbuild test robot
2015-10-06  7:27           ` kbuild test robot
2015-10-06  7:27             ` kbuild test robot
2015-10-06  7:56           ` Greg KH
2015-10-06  8:01           ` kbuild test robot
2015-10-06  8:01             ` kbuild test robot
2015-10-06  8:53         ` [v7] *** 8250_dw *** Noam Camus
2015-10-06  8:53           ` Noam Camus
2015-10-06  8:53           ` [v7] serial: 8250_dw: Add support for big-endian MMIO accesses Noam Camus
2015-10-06  8:53             ` Noam Camus
2015-10-18  4:06             ` Greg KH
2015-10-18  5:30               ` Noam Camus
2015-10-18  5:57                 ` Greg KH
2015-12-08 22:57                   ` Noam Camus
2015-12-09 14:18                     ` Andy Shevchenko
2015-12-10  7:30                       ` Noam Camus
2015-12-10  7:30                         ` Noam Camus
2015-10-18  9:01         ` [PATCH-v8] " Noam Camus
2015-10-18  9:01           ` Noam Camus
2015-12-09 13:19           ` Heikki Krogerus
2015-12-09 13:21             ` Heikki Krogerus
2015-12-10  7:26             ` Noam Camus
2015-12-10  9:31               ` Heikki Krogerus
2015-12-10 10:33                 ` Heikki Krogerus

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=20150803234221.GA5257@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=noamc@ezchip.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.