From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com. [209.85.208.66]) by gmr-mx.google.com with ESMTPS id z20si770932ejx.1.2020.02.24.06.44.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Feb 2020 06:44:19 -0800 (PST) Received: by mail-ed1-f66.google.com with SMTP id r21so12182458edq.0 for ; Mon, 24 Feb 2020 06:44:19 -0800 (PST) Return-Path: Date: Mon, 24 Feb 2020 15:44:13 +0100 From: Krzysztof Kozlowski Subject: Re: [RESEND PATCH v2 9/9] ath5k: Constify ioreadX() iomem argument (as in generic implementation) Message-ID: <20200224144413.GA2054@pi3> References: <20200219175007.13627-1-krzk@kernel.org> <20200219175007.13627-10-krzk@kernel.org> <518a9023-f802-17b3-fca5-582400bc34ae@gmail.com> <20200224124744.GA1949@pi3> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: To: Geert Uytterhoeven Cc: Jiri Slaby , Richard Henderson , Ivan Kokshaysky , Matt Turner , Alexey Brodkin , Vineet Gupta , "James E.J. Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Yoshinori Sato , Rich Felker , Dave Airlie , David Airlie , Daniel Vetter , Ben Skeggs , Mauro Carvalho Chehab , Nick Kossifidis , Luis Chamberlain , Kalle Valo , "David S. Miller" , Dave Jiang , Jon Mason , Allen Hubbe , "Michael S. Tsirkin" , Jason Wang , Arnd Bergmann , Geert Uytterhoeven , Andrew Morton , Thomas Gleixner , alpha , Linux Kernel Mailing List , arcml , Parisc List , linuxppc-dev , Linux-sh list , DRI Development , nouveau@lists.freedesktop.org, Linux Media Mailing List , linux-wireless , netdev , linux-ntb@googlegroups.com, virtualization@lists.linux-foundation.org, Linux-Arch List-ID: On Mon, Feb 24, 2020 at 01:54:00PM +0100, Geert Uytterhoeven wrote: > Hi Krzysztof, >=20 > On Mon, Feb 24, 2020 at 1:47 PM Krzysztof Kozlowski wro= te: > > On Thu, Feb 20, 2020 at 10:48:33AM +0100, Jiri Slaby wrote: > > > On 19. 02. 20, 18:50, Krzysztof Kozlowski wrote: > > > > The ioreadX() helpers have inconsistent interface. On some archite= ctures > > > > void *__iomem address argument is a pointer to const, on some not. > > > > > > > > Implementations of ioreadX() do not modify the memory under the add= ress > > > > so they can be converted to a "const" version for const-safety and > > > > consistency among architectures. > > > > > > > > Signed-off-by: Krzysztof Kozlowski > > > > Acked-by: Kalle Valo > > > > --- > > > > drivers/net/wireless/ath/ath5k/ahb.c | 10 +++++----- > > > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > > > > > diff --git a/drivers/net/wireless/ath/ath5k/ahb.c b/drivers/net/wir= eless/ath/ath5k/ahb.c > > > > index 2c9cec8b53d9..8bd01df369fb 100644 > > > > --- a/drivers/net/wireless/ath/ath5k/ahb.c > > > > +++ b/drivers/net/wireless/ath/ath5k/ahb.c > > > > @@ -138,18 +138,18 @@ static int ath_ahb_probe(struct platform_devi= ce *pdev) > > > > > > > > if (bcfg->devid >=3D AR5K_SREV_AR2315_R6) { > > > > /* Enable WMAC AHB arbitration */ > > > > - reg =3D ioread32((void __iomem *) AR5K_AR2315_AHB_ARB_C= TL); > > > > + reg =3D ioread32((const void __iomem *) AR5K_AR2315_AHB= _ARB_CTL); > > > > > > While I understand why the parameter of ioread32 should be const, I > > > don't see a reason for these casts on the users' side. What does it > > > bring except longer code to read? > > > > Because the argument is an int: > > > > drivers/net/wireless/ath/ath5k/ahb.c: In function =E2=80=98ath_ahb_prob= e=E2=80=99: > > drivers/net/wireless/ath/ath5k/ahb.c:141:18: warning: passing argument = 1 of =E2=80=98ioread32=E2=80=99 makes pointer from integer without a cast [= -Wint-conversion] > > reg =3D ioread32(AR5K_AR2315_AHB_ARB_CTL); >=20 > That's an argument for keeping the cast to "void __iomem *", not for > adding the "const", right? Yes, correct. Maybe I misunderstood the question... The const on the other hand does not have to be in the cast. It is merely for making it consistent with interface. It is not required. I also mentioned it in the cover letter: "PAtches 5-9 are optional cleanup, without actual impact" Feel free to ignore this one if it is not worth the effort. Best regards, Krzysztof