diff mbox

[v3,09/17] m68k: io: implement dummy relaxed accessor macros for writes

Message ID 20140925093309.GG20043@arm.com
State New
Headers show

Commit Message

Will Deacon Sept. 25, 2014, 9:33 a.m. UTC
On Thu, Sep 25, 2014 at 02:05:43AM +0100, Greg Ungerer wrote:
> Hi Will

Hi Greg,

Thanks for taking a look.

> On 25/09/14 03:17, Will Deacon wrote:
> > write{b,w,l}_relaxed are implemented by some architectures in order to
> > permit memory-mapped I/O accesses with weaker barrier semantics than the
> > non-relaxed variants.
> > 
> > This patch adds dummy macros for the write accessors to m68k, in the
> > same vein as the dummy definitions for the relaxed read accessors.
> > Additionally, the existing relaxed read accessors are moved into
> > asm/io.h, so that they can be used by m68k targets with an MMU.
> > 
> > Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > Signed-off-by: Will Deacon <will.deacon@arm.com>
> > ---
> >  arch/m68k/include/asm/io.h    | 8 ++++++++
> >  arch/m68k/include/asm/io_no.h | 4 ----
> >  2 files changed, 8 insertions(+), 4 deletions(-)
> > 
> > diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h
> > index c70cc9155003..bccd5a914eb6 100644
> > --- a/arch/m68k/include/asm/io.h
> > +++ b/arch/m68k/include/asm/io.h
> > @@ -3,3 +3,11 @@
> >  #else
> >  #include <asm/io_mm.h>
> >  #endif
> > +
> > +#define readb_relaxed(addr)	readb(addr)
> > +#define readw_relaxed(addr)	readw(addr)
> > +#define readl_relaxed(addr)	readl(addr)
> > +
> > +#define writeb_relaxed(b, addr)	writeb(b, addr)
> > +#define writew_relaxed(b, addr)	writew(b, addr)
> > +#define writel_relaxed(b, addr)	writel(b, addr)
> 
> Putting them here means they won't have any multiple include protection
> (there is no "#ifndef _IO_H" around them). Doesn't seem to lead to
> any problems in practice. Just flagging it...

That's easy enough to fix, and actually, we should have __KERNEL__ checks
here too. Fixup below.

Will

--->8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Comments

Geert Uytterhoeven Sept. 25, 2014, 9:51 a.m. UTC | #1
On Thu, Sep 25, 2014 at 11:33 AM, Will Deacon <will.deacon@arm.com> wrote:
>> Putting them here means they won't have any multiple include protection
>> (there is no "#ifndef _IO_H" around them). Doesn't seem to lead to
>> any problems in practice. Just flagging it...
>
> That's easy enough to fix, and actually, we should have __KERNEL__ checks
> here too. Fixup below.

Why do we need __KERNEL__ checks? <asm/io.h> is not exported.
BTW, it seems there are many __KERNEL__ checks in arch/*/include/asm/
we don't need.

Or do I need more coffee?

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Will Deacon Sept. 25, 2014, 10:33 a.m. UTC | #2
On Thu, Sep 25, 2014 at 10:51:10AM +0100, Geert Uytterhoeven wrote:
> On Thu, Sep 25, 2014 at 11:33 AM, Will Deacon <will.deacon@arm.com> wrote:
> >> Putting them here means they won't have any multiple include protection
> >> (there is no "#ifndef _IO_H" around them). Doesn't seem to lead to
> >> any problems in practice. Just flagging it...
> >
> > That's easy enough to fix, and actually, we should have __KERNEL__ checks
> > here too. Fixup below.
> 
> Why do we need __KERNEL__ checks? <asm/io.h> is not exported.
> BTW, it seems there are many __KERNEL__ checks in arch/*/include/asm/
> we don't need.
> 
> Or do I need more coffee?

No, I think you're quite right. I just saw the __KERNEL__ checks in io_no.h
and io_mm.h -- the latter even has some code outside of the guards:


#endif /* __KERNEL__ */

#define __ARCH_HAS_NO_PAGE_ZERO_MAPPED		1

/*
 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
 * access
 */
#define xlate_dev_mem_ptr(p)	__va(p)

/*
 * Convert a virtual cached pointer to an uncached pointer
 */
#define xlate_dev_kmem_ptr(p)	p

#define ioport_map(port, nr)	((void __iomem *)(port))

#endif /* _IO_H */


Will
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/arch/m68k/include/asm/io.h b/arch/m68k/include/asm/io.h
index bccd5a914eb6..ded201916560 100644
--- a/arch/m68k/include/asm/io.h
+++ b/arch/m68k/include/asm/io.h
@@ -1,9 +1,14 @@ 
+#ifndef _M68K_IO_H
+#define _M68K_IO_H
+
 #ifdef __uClinux__
 #include <asm/io_no.h>
 #else
 #include <asm/io_mm.h>
 #endif
 
+#ifdef __KERNEL__
+
 #define readb_relaxed(addr)    readb(addr)
 #define readw_relaxed(addr)    readw(addr)
 #define readl_relaxed(addr)    readl(addr)
@@ -11,3 +16,6 @@ 
 #define writeb_relaxed(b, addr)        writeb(b, addr)
 #define writew_relaxed(b, addr)        writew(b, addr)
 #define writel_relaxed(b, addr)        writel(b, addr)
+
+#endif /* __KERNEL__ */
+#endif /* _M68K_IO_H */