Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7429513ybp; Wed, 16 Oct 2019 08:31:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyylMPvGqhb+dwZqJ1QFxglY5z0BWsYagR6hxAVUDwDMD2Vz4Zqe/RHRXCPeMotedYkee2X X-Received: by 2002:a17:906:7257:: with SMTP id n23mr41640821ejk.132.1571239898661; Wed, 16 Oct 2019 08:31:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571239898; cv=none; d=google.com; s=arc-20160816; b=jQNMXI4ENSAJS2y3kPROqx1JYqmI9cpkr2eqNkf3ebORXro9uYC/A2ciQZoxrKR0LU FD61jul3U7ltvdo5B/IiAzeMxhHtsntYaFuxsyPbOPPbdRxj9gRPeZwwvZaEzTIzmQJI y7Ynu7DhWF7EzXF45hLerOoL5BKxJWcHVfE74acZ1ariGT8V95XTKl5TEUI1JJxNPenB paLtvOckwe7bFtecQ81/eW8eKSindsOYn0c8pWjVgvipqC6lWL/U95n+0b9xs/NrJqhv SiKIRls7dHaeqFk28Xl2cM7Mhd8dOum2XUwkUT/s8iuc1BD52jJEyhWWUeGPoEGt3FGj 8MJg== 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=e2wY7gGHUqrZbIlw6fccFXQWZBsZ26PnwKpX0/d4IX0=; b=c0xsF7QNKX1yGKgI2bb5Bb2qBCgbllVYcfpRsYVdjLN+HGWMYykRYbDrfnyQyokzxm F02XxNqtIgNwUt0AMa8bl/XmtDkKlhKW7l/0ce2JpTXYVELE1toVqoSba9i2+C+hs6F6 RZFy4LwIrVTtxXmsyKm/MNATOHgF4jZSPXgazModdrMclRfEtfev1yah20whI7Qloy/i h1cbCpV6tYDadRha2Mw0W0FTrDAyUA7fyPZpgCrlLzkl7Ko83mCo9k7IQ7fVS62sqUdT tdIMjQWuGLGQEzM3Moreb74AEn+gDSZuicxMa5FWCYACvqMjXJnAbcpI3TUhJWYFYfZt 3x2A== 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 x9si15689251eju.147.2019.10.16.08.31.15; Wed, 16 Oct 2019 08:31:38 -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 S2393034AbfJPM1A (ORCPT + 99 others); Wed, 16 Oct 2019 08:27:00 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:33866 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390650AbfJPM1A (ORCPT ); Wed, 16 Oct 2019 08:27:00 -0400 Received: from penelope.horms.nl (ip4dab7138.direct-adsl.nl [77.171.113.56]) by kirsty.vergenet.net (Postfix) with ESMTPA id 530E325AD78; Wed, 16 Oct 2019 23:26:58 +1100 (AEDT) Received: by penelope.horms.nl (Postfix, from userid 7100) id 40923E22490; Wed, 16 Oct 2019 14:26:56 +0200 (CEST) Date: Wed, 16 Oct 2019 14:26:56 +0200 From: Simon Horman To: "Ben Dooks (Codethink)" Cc: linux-kernel@lists.codethink.co.uk, Greg Kroah-Hartman , Yoshihiro Shimoda , Geert Uytterhoeven , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: renesas_usbhs: fix __le16 warnings Message-ID: <20191016122656.3jpmes4rnz47u5wc@verge.net.au> References: <20191015155044.11858-1-ben.dooks@codethink.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191015155044.11858-1-ben.dooks@codethink.co.uk> 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 Tue, Oct 15, 2019 at 04:50:44PM +0100, Ben Dooks (Codethink) wrote: > Fix the warnings generated by casting to/from __le16 without > using the correct functions. > > Fixes the following sparse warnings: > > drivers/usb/renesas_usbhs/common.c:165:25: warning: incorrect type in assignment (different base types) > drivers/usb/renesas_usbhs/common.c:165:25: expected restricted __le16 [usertype] wValue > drivers/usb/renesas_usbhs/common.c:165:25: got unsigned short > drivers/usb/renesas_usbhs/common.c:166:25: warning: incorrect type in assignment (different base types) > drivers/usb/renesas_usbhs/common.c:166:25: expected restricted __le16 [usertype] wIndex > drivers/usb/renesas_usbhs/common.c:166:25: got unsigned short > drivers/usb/renesas_usbhs/common.c:167:25: warning: incorrect type in assignment (different base types) > drivers/usb/renesas_usbhs/common.c:167:25: expected restricted __le16 [usertype] wLength > drivers/usb/renesas_usbhs/common.c:167:25: got unsigned short > drivers/usb/renesas_usbhs/common.c:173:39: warning: incorrect type in argument 3 (different base types) > drivers/usb/renesas_usbhs/common.c:173:39: expected unsigned short [usertype] data > drivers/usb/renesas_usbhs/common.c:173:39: got restricted __le16 [usertype] wValue > drivers/usb/renesas_usbhs/common.c:174:39: warning: incorrect type in argument 3 (different base types) > drivers/usb/renesas_usbhs/common.c:174:39: expected unsigned short [usertype] data > drivers/usb/renesas_usbhs/common.c:174:39: got restricted __le16 [usertype] wIndex > drivers/usb/renesas_usbhs/common.c:175:39: warning: incorrect type in argument 3 (different base types) > drivers/usb/renesas_usbhs/common.c:175:39: expected unsigned short [usertype] data > > Note. I belive this to be correct, and should be a no-op on arm. > > Signed-off-by: Ben Dooks > --- > Cc: Greg Kroah-Hartman > Cc: Yoshihiro Shimoda > Cc: Simon Horman > Cc: Geert Uytterhoeven > Cc: linux-usb@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > --- > drivers/usb/renesas_usbhs/common.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > 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. > } > > 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); > } > -- > 2.23.0 >