Re: [PATCH 1/1] edac x38: new MC driver module

From: Hitoshi Mitake
Date: Mon Nov 24 2008 - 21:55:34 EST


On Mon, 24 Nov 2008 10:02:40 -0800
"H. Peter Anvin" <hpa@xxxxxxxxx> wrote:

Thanks for your reviews and advices, Peter and Tony.

> Luck, Tony wrote:
> >> volatile u32 __iomem *__p = addr;
> >> u32 __l, __h;
> >
> > Do we really need all the "__" inside an inline function? Why
> > not just call these "p", "l" and "h"?
>
> Sorry, user space habit (in userspace, and in anything that can be
> included from userspace, one needs the __ to keep the namespace clean.)

I think which need __ is variable type name, not each variable name.
Name of each local variables can't effect namespace.
And I found this comment in asm-generic/int-ll64.h,
/*
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
* header files exported to user space
*/

According to your advice, I rewrote the patch, how is this?

description of this patch: Adding config value to x86 architecture to determine existence of readq/writeq

Signed-off-by: Hitoshi Mitake <h.mitake@xxxxxxxxx>
---
arch/x86/Kconfig | 3 +++
arch/x86/include/asm/io.h | 17 +++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index ac22bb7..8f3c949 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -11,9 +11,12 @@ config 64BIT

config X86_32
def_bool !64BIT
+ select ARCH_HAS_READQ

config X86_64
def_bool 64BIT
+ select ARCH_HAS_READQ
+ select ARCH_HAS_WRITEQ

### Arch settings
config X86
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index ac2abc8..5322d18 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -4,6 +4,7 @@
#define ARCH_HAS_IOREMAP_WC

#include <linux/compiler.h>
+#include <asm-generic/int-ll64.h>

#define build_mmio_read(name, size, type, reg, barrier) \
static inline type name(const volatile void __iomem *addr) \
@@ -57,6 +58,22 @@ build_mmio_write(__writeq, "q", unsigned long, "r", )
/* Let people know we have them */
#define readq readq
#define writeq writeq
+
+#else /* CONFIG_X86_32 from here */
+
+static inline __u64 readq(const volatile void __iomem *addr)
+{
+ const volatile u32 __iomem *p = addr;
+ u32 l, h;
+
+ l = readl(p);
+ h = readl(p+1);
+
+ return l + ((u64)h << 32);
+}
+
+#define readq readq
+
#endif

extern int iommu_bio_merge;
--
1.5.6.5

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