From: Yoshinori Sato <ysato@users.sourceforge.jp>
To: Joe Perches <joe@perches.com>
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] H8/300 read{b,w,l} / write{b,w,l} error fix
Date: Sun, 14 Nov 2004 00:26:37 +0900 [thread overview]
Message-ID: <m21xexsrbm.wl%ysato@users.sourceforge.jp> (raw)
In-Reply-To: <1100280300.27149.8.camel@localhost.localdomain>
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 <ysato@users.sourceforge.jp>
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
<ysato@users.sourceforge.jp>
prev parent reply other threads:[~2004-11-13 15:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-12 16:42 [PATCH] H8/300 read{b,w,l} / write{b,w,l} error fix Yoshinori Sato
[not found] ` <1100280300.27149.8.camel@localhost.localdomain>
2004-11-13 15:26 ` Yoshinori Sato [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m21xexsrbm.wl%ysato@users.sourceforge.jp \
--to=ysato@users.sourceforge.jp \
--cc=akpm@osdl.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox