All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
	"linux-kernel@lists.codethink.co.uk" 
	<linux-kernel@lists.codethink.co.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Ben Dooks (Codethink)" <ben.dooks@codethink.co.uk>
Subject: Re: [PATCH] usb: renesas_usbhs: fix __le16 warnings
Date: Thu, 17 Oct 2019 12:00:34 +0200	[thread overview]
Message-ID: <20191017100034.qif4kcrcrvzkz5t3@verge.net.au> (raw)
In-Reply-To: <CAMuHMdWsRDyUh0MzYNX=mQuuPem1NxArFOqXGVAba3TWGEXxWg@mail.gmail.com>

On Thu, Oct 17, 2019 at 08:57:26AM +0200, Geert Uytterhoeven wrote:
> Hi Shimoda-san, Simon,
> 
> On Thu, Oct 17, 2019 at 4:18 AM Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@renesas.com> wrote:
> > > From: Simon Horman, Sent: Wednesday, October 16, 2019 9:27 PM
> > <snip>
> > > > diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
> > > > index 4c3de777ef6c..a3c30b609433 100644
> > > > --- a/drivers/usb/renesas_usbhs/common.c
> > > > +++ b/drivers/usb/renesas_usbhs/common.c
> > > > @@ -162,17 +162,17 @@ void usbhs_usbreq_get_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
> > > >     req->bRequest           = (val >> 8) & 0xFF;
> > > >     req->bRequestType       = (val >> 0) & 0xFF;
> > > >
> > > > -   req->wValue     = usbhs_read(priv, USBVAL);
> > > > -   req->wIndex     = usbhs_read(priv, USBINDX);
> > > > -   req->wLength    = usbhs_read(priv, USBLENG);
> > > > +   req->wValue     = cpu_to_le16(usbhs_read(priv, USBVAL));
> > > > +   req->wIndex     = cpu_to_le16(usbhs_read(priv, USBINDX));
> > > > +   req->wLength    = cpu_to_le16(usbhs_read(priv, USBLENG));
> > >
> > > usbhs_read is backed by readl which performs
> > > a le->cpu conversion. Rather than have a double conversion
> > > perhaps it would be nicer to introduce usbhs_read_le.
> > > Likewise for write.
> >
> > I'm afraid but, I could not understand these comments.
> > At the moment, the usbhs_{read,write}() call io{read,write}16(),
> > not {read,write}l().
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/renesas_usbhs/common.c?h=v5.4-rc3#n62
> 
> ioread16() and readw() don't do byteswapping on ARM, as ARM is
> little-endian. Likewise, cpu_to_le16() is a no-op on ARM.
> 
> Double swapping would matter only on a big-endian platform, and could
> indeed be avoided by introducing usbhs_read_le*() functions that are
> just wrappers around __raw_read16() on big-endian.
> However, until the Renesas USBHS IP core ends up on a big-endian
> platform, it's not worth doing that, IMHO.

Yes, that is all true.
I'm fine with this patch as it is.

> 
> > > >  }
> > > >
> > > >  void usbhs_usbreq_set_val(struct usbhs_priv *priv, struct usb_ctrlrequest *req)
> > > >  {
> > > >     usbhs_write(priv, USBREQ,  (req->bRequest << 8) | req->bRequestType);
> > > > -   usbhs_write(priv, USBVAL,  req->wValue);
> > > > -   usbhs_write(priv, USBINDX, req->wIndex);
> > > > -   usbhs_write(priv, USBLENG, req->wLength);
> > > > +   usbhs_write(priv, USBVAL,  le16_to_cpu(req->wValue));
> > > > +   usbhs_write(priv, USBINDX, le16_to_cpu(req->wIndex));
> > > > +   usbhs_write(priv, USBLENG, le16_to_cpu(req->wLength));
> > > >
> > > >     usbhs_bset(priv, DCPCTR, SUREQ, SUREQ);
> > > >  }
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
> 

      reply	other threads:[~2019-10-17 10:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 15:50 [PATCH] usb: renesas_usbhs: fix __le16 warnings Ben Dooks (Codethink)
2019-10-15 16:45 ` Geert Uytterhoeven
2019-10-16  2:35 ` Yoshihiro Shimoda
2019-10-16 12:26 ` Simon Horman
2019-10-17  2:18   ` Yoshihiro Shimoda
2019-10-17  6:57     ` Geert Uytterhoeven
2019-10-17 10:00       ` Simon Horman [this message]

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=20191017100034.qif4kcrcrvzkz5t3@verge.net.au \
    --to=horms@verge.net.au \
    --cc=ben.dooks@codethink.co.uk \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@lists.codethink.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.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.