lkml.org 
[lkml]   [2023]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH] m68k: asm/io.h: mark mmio read addresses as const
    Hi Arnd,

    On Mon, Sep 25, 2023 at 5:53 PM Arnd Bergmann <arnd@kernel.org> wrote:
    > From: Arnd Bergmann <arnd@arndb.de>
    >
    > Passing constant __iomem tokens into the readl() family of helpers
    > or any of the others causes a warning on m68k:
    >
    > include/asm-generic/io.h: In function 'ioread8_rep':
    > arch/m68k/include/asm/io_mm.h:375:44: warning: passing argument 1 of 'raw_insb' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
    > 375 | #define readsb(port, buf, nr) raw_insb((port), (u8
    >
    > Add a 'const' modifier to the pointers to shut up the warnings here.
    >
    > Closes: https://lore.kernel.org/oe-kbuild-all/202309251926.bPl23AhG-lkp@intel.com/
    > Reported-by: kernel test robot <lkp@intel.com>
    > Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    Thanks for your patch!

    > --- a/arch/m68k/include/asm/raw_io.h
    > +++ b/arch/m68k/include/asm/raw_io.h
    > @@ -17,15 +17,15 @@
    > * two accesses to memory, which may be undesirable for some devices.
    > */
    > #define in_8(addr) \
    > - ({ u8 __v = (*(__force volatile u8 *) (unsigned long)(addr)); __v; })
    > + ({ u8 __v = (*(__force const volatile u8 *) (unsigned long)(addr)); __v; })
    > #define in_be16(addr) \
    > - ({ u16 __v = (*(__force volatile u16 *) (unsigned long)(addr)); __v; })
    > + ({ u16 __v = (*(__force const volatile u16 *) (unsigned long)(addr)); __v; })
    > #define in_be32(addr) \
    > - ({ u32 __v = (*(__force volatile u32 *) (unsigned long)(addr)); __v; })
    > + ({ u32 __v = (*(__force const volatile u32 *) (unsigned long)(addr)); __v; })
    > #define in_le16(addr) \
    > - ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (unsigned long)(addr)); __v; })
    > + ({ u16 __v = le16_to_cpu(*(__force const volatile __le16 *) (unsigned long)(addr)); __v; })
    > #define in_le32(addr) \
    > - ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (unsigned long)(addr)); __v; })
    > + ({ u32 __v = le32_to_cpu(*(__force const volatile __le32 *) (unsigned long)(addr)); __v; })
    >
    > #define out_8(addr,b) (void)((*(__force volatile u8 *) (unsigned long)(addr)) = (b))
    > #define out_be16(addr,w) (void)((*(__force volatile u16 *) (unsigned long)(addr)) = (w))

    Shouldn't a similar change be made to rom_in_{8,be16,le16}()?

    I can do that while applying...

    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

    \
     
     \ /
      Last update: 2023-10-02 15:13    [W:4.988 / U:0.076 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site