Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp764156ybg; Fri, 18 Oct 2019 07:05:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyP/NFJ/3UpRZfztb+nwO+THcyIANtbF855hksHQTFTzy5WImkgMW5+GkKT5bIcw8gZgl9C X-Received: by 2002:a05:6402:557:: with SMTP id i23mr9668247edx.71.1571407555799; Fri, 18 Oct 2019 07:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571407555; cv=none; d=google.com; s=arc-20160816; b=BV0cP0XQOeVyfy0t55MXME9HiHNvgXodUFE5ay6qwLetfWuDbHT2OurxL1b4k/r0AZ CYRkyS4yyAnGSmR6fJEbDTTKSVS6CyDd0l7CuEKI4LBxpKYQR1pWzVSDc8YNjK71wH7Z 8I94YXMrRjdxEBKclgdD4bXMWAk4R1ZUkTc5tXsPHJ076Vi3lKe+YBqbmzMKF6pnwrb6 HRR4yJRborA6KBj7pTNkUEUd36d8Kh+ouJ2nYuwc9ahe4oU17o8gd4Gcx0LEcHuq55Jc EnWUqR9uf/H99lOZJhP++KwQh6aSLoOnlsDLkVQ5XaFuzpwqXKxiRvNaTBPl4gQMwNrV 0MWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organisation:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=y8bc/H1fZMp18f3u2ynh2hpH2UQXjjlW01ofsUAJXc4=; b=APoNh+ko9UU25YJ7L+xGQSFRcRZ2a1Ys1s93iRdm/uNXl1XjGXR6M2yuoYy82KACTD KAgG9sESkpCfpEE9+1uXZC0e1jbYqhBNyCw/iffOUlPbUUL326MKYKrAcNivda0G0Z9Y 3e1O1GGdOgAoeL0Tu8Zy8O2y9pBtipIqyYiRpOxF/6EorsAgX2/1RxXIk52ko7B8Ra9C yGnntb0gmFBszwYZ/qK+SYrQ2zzQ0u3LDF1BHnD+AyqxWuGkMJAlvvM3MWlqCo0tDud2 eAUpqtSjQi7jv5vZYBnzZc2XjmZ2zMRz08wK2sqKhe61HcDGId+nUehrqHZTeL7Nyiwl mMLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g31si3955902eda.399.2019.10.18.07.05.30; Fri, 18 Oct 2019 07:05:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404618AbfJQKAk (ORCPT + 99 others); Thu, 17 Oct 2019 06:00:40 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:59686 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726638AbfJQKAj (ORCPT ); Thu, 17 Oct 2019 06:00:39 -0400 Received: from reginn.horms.nl (watermunt.horms.nl [80.127.179.77]) by kirsty.vergenet.net (Postfix) with ESMTPA id 89FC525B76F; Thu, 17 Oct 2019 21:00:36 +1100 (AEDT) Received: by reginn.horms.nl (Postfix, from userid 7100) id 6D2FC9403D6; Thu, 17 Oct 2019 12:00:34 +0200 (CEST) Date: Thu, 17 Oct 2019 12:00:34 +0200 From: Simon Horman To: Geert Uytterhoeven Cc: Yoshihiro Shimoda , "linux-kernel@lists.codethink.co.uk" , Greg Kroah-Hartman , Geert Uytterhoeven , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Ben Dooks (Codethink)" Subject: Re: [PATCH] usb: renesas_usbhs: fix __le16 warnings Message-ID: <20191017100034.qif4kcrcrvzkz5t3@verge.net.au> References: <20191015155044.11858-1-ben.dooks@codethink.co.uk> <20191016122656.3jpmes4rnz47u5wc@verge.net.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organisation: Horms Solutions BV User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > wrote: > > > From: Simon Horman, Sent: Wednesday, October 16, 2019 9:27 PM > > > > > > 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 >