Geert Uytterhoeven
2020-Jan-08 08:10 UTC
[Nouveau] [RFT 02/13] alpha: Constify ioreadX() iomem argument (as in generic implementation)
Hi Krzysztof, On Tue, Jan 7, 2020 at 5:53 PM Krzysztof Kozlowski <krzk at kernel.org> wrote:> The ioreadX() helpers have inconsistent interface. On some architectures > void *__iomem address argument is a pointer to const, on some not. > > Implementations of ioreadX() do not modify the memory under the address > so they can be converted to a "const" version for const-safety and > consistency among architectures. > > Signed-off-by: Krzysztof Kozlowski <krzk at kernel.org>> --- a/arch/alpha/include/asm/io.h > +++ b/arch/alpha/include/asm/io.h > @@ -151,9 +151,9 @@ static inline void generic_##NAME(TYPE b, QUAL void __iomem *addr) \ > alpha_mv.mv_##NAME(b, addr); \ > } > > -REMAP1(unsigned int, ioread8, /**/) > -REMAP1(unsigned int, ioread16, /**/) > -REMAP1(unsigned int, ioread32, /**/) > +REMAP1(unsigned int, ioread8, const) > +REMAP1(unsigned int, ioread16, const) > +REMAP1(unsigned int, ioread32, const)If these would become "const volatile", there would no longer be a need for the last parameter of the REMAP1() macro.> REMAP1(u8, readb, const volatile) > REMAP1(u16, readw, const volatile) > REMAP1(u32, readl, const volatile)Same for REMAP2() macro below, for iowrite*(). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at 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
Krzysztof Kozlowski
2020-Jan-08 09:07 UTC
[Nouveau] [RFT 02/13] alpha: Constify ioreadX() iomem argument (as in generic implementation)
On Wed, Jan 08, 2020 at 09:10:06AM +0100, Geert Uytterhoeven wrote:> Hi Krzysztof, > > On Tue, Jan 7, 2020 at 5:53 PM Krzysztof Kozlowski <krzk at kernel.org> wrote: > > The ioreadX() helpers have inconsistent interface. On some architectures > > void *__iomem address argument is a pointer to const, on some not. > > > > Implementations of ioreadX() do not modify the memory under the address > > so they can be converted to a "const" version for const-safety and > > consistency among architectures. > > > > Signed-off-by: Krzysztof Kozlowski <krzk at kernel.org> > > > --- a/arch/alpha/include/asm/io.h > > +++ b/arch/alpha/include/asm/io.h > > @@ -151,9 +151,9 @@ static inline void generic_##NAME(TYPE b, QUAL void __iomem *addr) \ > > alpha_mv.mv_##NAME(b, addr); \ > > } > > > > -REMAP1(unsigned int, ioread8, /**/) > > -REMAP1(unsigned int, ioread16, /**/) > > -REMAP1(unsigned int, ioread32, /**/) > > +REMAP1(unsigned int, ioread8, const) > > +REMAP1(unsigned int, ioread16, const) > > +REMAP1(unsigned int, ioread32, const) > > If these would become "const volatile", there would no longer be a need > for the last parameter of the REMAP1() macro. > > > REMAP1(u8, readb, const volatile) > > REMAP1(u16, readw, const volatile) > > REMAP1(u32, readl, const volatile) > > Same for REMAP2() macro below, for iowrite*().Good point, thanks! Best regards, Krzysztof
Apparently Analagous Threads
- [RFT 02/13] alpha: Constify ioreadX() iomem argument (as in generic implementation)
- [RFT 03/13] alpha: Constify ioreadX() iomem argument (as in generic implementation)
- [RFT 02/13] alpha: Constify ioreadX() iomem argument (as in generic implementation)
- [RFT 05/13] powerpc: Constify ioreadX() iomem argument (as in generic implementation)
- [RFT 07/13] drm/mgag200: Constify ioreadX() iomem argument (as in generic implementation)