lkml.org 
[lkml]   [2008]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2008-11-24 00:59    [from the cache]
©2003-2011 Jasper Spaans