Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262756AbUKMP0n (ORCPT ); Sat, 13 Nov 2004 10:26:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262763AbUKMP0n (ORCPT ); Sat, 13 Nov 2004 10:26:43 -0500 Received: from l247150.ppp.asahi-net.or.jp ([218.219.247.150]:14552 "EHLO mitou.ysato.dip.jp") by vger.kernel.org with ESMTP id S262756AbUKMP0j (ORCPT ); Sat, 13 Nov 2004 10:26:39 -0500 Date: Sun, 14 Nov 2004 00:26:37 +0900 Message-ID: From: Yoshinori Sato To: Joe Perches Cc: Linus Torvalds , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH] H8/300 read{b,w,l} / write{b,w,l} error fix In-Reply-To: <1100280300.27149.8.camel@localhost.localdomain> References: <1100280300.27149.8.camel@localhost.localdomain> User-Agent: Wanderlust/2.11.30 (Wonderwall) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.3 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2806 Lines: 74 At Fri, 12 Nov 2004 09:25:00 -0800, Joe Perches wrote: > > On Sat, 2004-11-13 at 01:42 +0900, Yoshinori Sato wrote: > > #define readb(addr) \ > > - ({ unsigned char __v = (*(volatile unsigned char *) ((addr) & 0x00ffffff)); __v; }) > > + ({ unsigned char __v = \ > > + *(volatile unsigned char *)((unsigned long)(addr) & 0x00ffffff); \ > > + __v; }) > > How about moving #define IO_SPACE_LIMIT up and using that instead? > It is so. Signed-off-by: Yoshinori Sato diff -Nru a/include/asm-h8300/io.h b/include/asm-h8300/io.h --- a/include/asm-h8300/io.h 2004-11-14 00:21:49 +09:00 +++ b/include/asm-h8300/io.h 2004-11-14 00:21:49 +09:00 @@ -69,16 +69,27 @@ #endif } +#define IO_SPACE_LIMIT 0xffffff + #define readb(addr) \ - ({ unsigned char __v = (*(volatile unsigned char *) ((addr) & 0x00ffffff)); __v; }) + ({ unsigned char __v = \ + *(volatile unsigned char *)((unsigned long)(addr) & IO_SPACE_LIMIT); \ + __v; }) #define readw(addr) \ - ({ unsigned short __v = (*(volatile unsigned short *) ((addr) & 0x00ffffff)); __v; }) + ({ unsigned short __v = \ + *(volatile unsigned short *)((unsigned long)(addr) & IO_SPACE_LIMIT); \ + __v; }) #define readl(addr) \ - ({ unsigned int __v = (*(volatile unsigned int *) ((addr) & 0x00ffffff)); __v; }) - -#define writeb(b,addr) (void)((*(volatile unsigned char *) ((addr) & 0x00ffffff)) = (b)) -#define writew(b,addr) (void)((*(volatile unsigned short *) ((addr) & 0x00ffffff)) = (b)) -#define writel(b,addr) (void)((*(volatile unsigned int *) ((addr) & 0x00ffffff)) = (b)) + ({ unsigned long __v = \ + *(volatile unsigned long *)((unsigned long)(addr) & IO_SPACE_LIMIT); \ + __v; }) + +#define writeb(b,addr) (void)((*(volatile unsigned char *) \ + ((unsigned long)(addr) & IO_SPACE_LIMIT)) = (b)) +#define writew(b,addr) (void)((*(volatile unsigned short *) \ + ((unsigned long)(addr) & IO_SPACE_LIMIT)) = (b)) +#define writel(b,addr) (void)((*(volatile unsigned long *) \ + ((unsigned long)(addr) & IO_SPACE_LIMIT)) = (b)) #define readb_relaxed(addr) readb(addr) #define readw_relaxed(addr) readw(addr) #define readl_relaxed(addr) readl(addr) @@ -224,9 +235,6 @@ #define insb(a,b,l) io_insb(a,b,l) #define insw(a,b,l) io_insw(a,b,l) #define insl(a,b,l) io_insl(a,b,l) - -#define IO_SPACE_LIMIT 0xffffff - /* Values for nocacheflag and cmode */ #define IOMAP_FULL_CACHING 0 -- Yoshinori Sato - 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/