linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>,
	Rich Felker <dalias@libc.org>,
	Linux-sh list <linux-sh@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH] sh: clk: Fix discarding const qualifier warning
Date: Tue, 7 Jan 2020 14:32:56 +0100	[thread overview]
Message-ID: <20200107133256.GA648@pi3> (raw)
In-Reply-To: <CAJKOXPcbUfUcmU2O50M5Hs2y6ggg-m5qU-AJ6HjSL9dFTCp64A@mail.gmail.com>

On Tue, Jan 07, 2020 at 02:05:14PM +0100, Krzysztof Kozlowski wrote:
> On Tue, 7 Jan 2020 at 14:00, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> >
> > Hi Krzysztof,
> >
> > On Tue, Jan 7, 2020 at 1:26 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > > ioreadX() accepts pointer to non-const memory.  This fixes warnings
> > > like:
> > >
> > >     drivers/sh/clk/cpg.c: In function ‘r8’:
> > >     drivers/sh/clk/cpg.c:41:17: warning: passing argument 1 of ‘ioread8’
> > >         discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
> > >
> > > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> >
> > Thanks for your patch!
> >
> > > --- a/drivers/sh/clk/cpg.c
> > > +++ b/drivers/sh/clk/cpg.c
> > > @@ -36,17 +36,17 @@ static void sh_clk_write(int value, struct clk *clk)
> > >                 iowrite32(value, clk->mapped_reg);
> > >  }
> > >
> > > -static unsigned int r8(const void __iomem *addr)
> > > +static unsigned int r8(void __iomem *addr)
> > >  {
> > >         return ioread8(addr);
> > >  }
> >
> > Isn't the real issue that some implementations of ioreadX() take const,
> > while others don't?
> >
> > Even the generic ones disagree:
> >
> >     include/asm-generic/io.h:static inline u8 ioread8(const volatile
> > void __iomem *addr)
> >     include/asm-generic/iomap.h:extern unsigned int ioread8(void __iomem *);
> >
> > IMHO they all should take "const volatile void __iomem *".
> 
> Since this is a SuperH driver, I adjusted it to the SuperH
> implementation - lack of const. However iIndeed it makes sense to have
> them all taking "const"... Let me check, if I can fix it (without the
> real HW).

That will be non-trivial because many platforms define ioreadX() with
non-const. For example entire alpha with many its implementations of
ioread(). Even include/asm-generic/iomap.h defines them as non-const...

Best regards,
Krzysztof


  reply	other threads:[~2020-01-07 13:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 12:26 [PATCH] sh: clk: Fix discarding const qualifier warning Krzysztof Kozlowski
2020-01-07 13:00 ` Geert Uytterhoeven
2020-01-07 13:05   ` Krzysztof Kozlowski
2020-01-07 13:32     ` Krzysztof Kozlowski [this message]
2020-01-07 13:54       ` Arnd Bergmann
2020-01-07 14:04         ` Krzysztof Kozlowski

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=20200107133256.GA648@pi3 \
    --to=krzk@kernel.org \
    --cc=arnd@arndb.de \
    --cc=dalias@libc.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=ysato@users.sourceforge.jp \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).