m68k: introduce iomem() macro for __iomem conversions
authorGreg Ungerer <gerg@linux-m68k.org>
Sun, 8 Apr 2018 13:12:55 +0000 (23:12 +1000)
committerGreg Ungerer <gerg@linux-m68k.org>
Sun, 27 May 2018 23:45:27 +0000 (09:45 +1000)
commit48074d2615add385e6357fc1333959fc778557f9
treee7bd3898d13a2ed5494c32fedfee146c8be9b93c
parent4a2e130cce1f6ad1b70f0fa8ca1852377fc285ae
m68k: introduce iomem() macro for __iomem conversions

A lot of the ColdFire internal peripherals (clocks, timers, interrupt
controllers, etc) are addressed using constants. The only problem with
that is they are not type clean when used with __raw_read/__raw_write
and read/write - they should be of type "void __iomem". This isn't
a problem currently because the IO access functions are local macros.

To switch to using the asm-generic implementations of these we need to
clean up the types. Otherwise you get warnings like this:

    In file included from ./arch/m68k/include/asm/mcfsim.h:24:0,
                     from arch/m68k/coldfire/intc-simr.c:20:
    arch/m68k/coldfire/intc-simr.c: In function ‘init_IRQ’:
    ./arch/m68k/include/asm/m520xsim.h:40:29: warning: passing argument 2 of ‘__raw_writeb’ makes pointer from integer without a cast [-Wint-conversion]
     #define MCFINTC0_SIMR       (MCFICM_INTC0 + MCFINTC_SIMR)
                                 ^
    arch/m68k/coldfire/intc-simr.c:182:21: note: in expansion of macro ‘MCFINTC0_SIMR’
      __raw_writeb(0xff, MCFINTC0_SIMR);
                         ^
    In file included from ./arch/m68k/include/asm/io_no.h:120:0,
                     from ./arch/m68k/include/asm/io.h:3,
                     from ./include/linux/io.h:25,
                     from ./include/linux/irq.h:25,
                     from ./include/asm-generic/hardirq.h:13,
                     from ./arch/m68k/include/asm/hardirq.h:25,
                     from ./include/linux/hardirq.h:9,
                     from ./include/linux/interrupt.h:13,
                     from arch/m68k/coldfire/intc-simr.c:16:
    ./include/asm-generic/io.h:71:22: note: expected ‘volatile void *’ but argument is of type ‘unsigned int’
     #define __raw_writeb __raw_writeb
                          ^
    ./include/asm-generic/io.h:72:20: note: in expansion of macro ‘__raw_writeb’
     static inline void __raw_writeb(u8 value, volatile void __iomem *addr)
                        ^

To start this clean up process introduce a macro, iomem(), that converts
a constant address to the correct "void __iomem *" type.

Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
Tested-by: Angelo Dureghello <angelo@sysam.it>
arch/m68k/include/asm/io_no.h