[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4929ECB7.8080108@zytor.com>
Date: Sun, 23 Nov 2008 15:52:23 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Hitoshi Mitake <h.mitake@...il.com>
CC: Russell King <rmk+lkml@....linux.org.uk>,
Ralf Baechle <ralf@...ux-mips.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Doug Thompson <norsk5@...oo.com>, dougthompson@...ssion.com,
linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Subject: Re: [PATCH 1/1] edac x38: new MC driver module
Hitoshi Mitake wrote:
> --- a/arch/x86/include/asm/io.h
> +++ b/arch/x86/include/asm/io.h
> @@ -57,6 +57,14 @@ build_mmio_write(__writeq, "q", unsigned long, "r", )
> /* Let people know we have them */
> #define readq readq
> #define writeq writeq
> +
> +#else /* CONFIG_X86_32 */
> +
> +static inline unsigned long readq(const volatile void __iomem *addr)
> +{
> + return readl(addr) | (((u64)readl(addr + 4)) << 32);
> +}
> +
> #endif
>
Let's see:
* undefined ordering of operations (at least on x86, they really should
be performed in LSB first order.)
* Using "unsigned long" for a 64-bit number on a 32-bit architecture.
* Arithmetic on a void pointer.
Try something like:
static inline u64 readq(const volative void __iomem *addr)
{
volatile u32 __iomem *__p = addr;
u32 __l, __h;
__l = readl(p);
__h = readl(p+1);
return __l + ((u64)__h << 32);
}
-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists