From: Roland Dreier <roland@topspin.com>
To: ak@muc.de
Cc: linux-kernel@vger.kernel.org
Subject: memcpy_to/fromio cleanups for x86_64
Date: 17 May 2004 11:28:37 -0700 [thread overview]
Message-ID: <5265auvrfu.fsf@topspin.com> (raw)
In-Reply-To: <52lljrwvhq.fsf@topspin.com>
My query about the types of the parameters for memcpy_toio and
memcpy_fromio was met with silence. Maybe some code can speak a
little louder.
Here is a patch for x86_64 that brings memcpy_toio and memcpy_fromio
more into line with other architectures (my approach is based on what
ia64 does), and cleans things up a little.
First of all, it makes the IO address parameter an unsigned long, so
that code that treats IO addresses as unsigned long does not get
warnings like
warning: passing arg 1 of `memcpy_toio' makes pointer from integer without a cast
Second, I moved the EXPORT_SYMBOL directly into io.c (shrinking
x8664_ksyms.c by a few lines). This means that io.o should be moved
from lib-y to obj-y, since otherwise __memcpy_toio and __memcpy_fromio
might not be included in the kernel.
Comments? Look good? Does anyone care :)?
Thanks,
Roland
Index: linux-2.6.6/arch/x86_64/kernel/x8664_ksyms.c
===================================================================
--- linux-2.6.6.orig/arch/x86_64/kernel/x8664_ksyms.c 2004-05-09 19:32:01.000000000 -0700
+++ linux-2.6.6/arch/x86_64/kernel/x8664_ksyms.c 2004-05-17 10:33:54.000000000 -0700
@@ -216,6 +216,3 @@
#endif
EXPORT_SYMBOL(sys_ioctl);
-
-EXPORT_SYMBOL(memcpy_toio);
-EXPORT_SYMBOL(memcpy_fromio);
Index: linux-2.6.6/arch/x86_64/lib/Makefile
===================================================================
--- linux-2.6.6.orig/arch/x86_64/lib/Makefile 2004-05-09 19:32:01.000000000 -0700
+++ linux-2.6.6/arch/x86_64/lib/Makefile 2004-05-17 11:17:09.000000000 -0700
@@ -4,9 +4,11 @@
CFLAGS_csum-partial.o := -funroll-loops
+obj-y := io.o
+
lib-y := csum-partial.o csum-copy.o csum-wrappers.o delay.o \
usercopy.o getuser.o putuser.o \
- thunk.o io.o clear_page.o copy_page.o bitstr.o
+ thunk.o clear_page.o copy_page.o bitstr.o
lib-y += memcpy.o memmove.o memset.o copy_user.o
lib-$(CONFIG_HAVE_DEC_LOCK) += dec_and_lock.o
Index: linux-2.6.6/arch/x86_64/lib/io.c
===================================================================
--- linux-2.6.6.orig/arch/x86_64/lib/io.c 2004-05-09 19:31:59.000000000 -0700
+++ linux-2.6.6/arch/x86_64/lib/io.c 2004-05-17 10:44:08.000000000 -0700
@@ -2,12 +2,14 @@
#include <asm/io.h>
#include <linux/module.h>
-void *memcpy_toio(void *dst,const void*src,unsigned len)
+void *__memcpy_toio(unsigned long dst,const void*src,unsigned len)
{
- return __inline_memcpy(dst,src,len);
+ return __inline_memcpy((void *) dst,src,len);
}
+EXPORT_SYMBOL(__memcpy_toio);
-void *memcpy_fromio(void *dst,const void*src,unsigned len)
+void *__memcpy_fromio(void *dst,unsigned long src,unsigned len)
{
- return __inline_memcpy(dst,src,len);
+ return __inline_memcpy(dst,(const void *) src,len);
}
+EXPORT_SYMBOL(__memcpy_fromio);
Index: linux-2.6.6/include/asm-x86_64/io.h
===================================================================
--- linux-2.6.6.orig/include/asm-x86_64/io.h 2004-05-09 19:32:28.000000000 -0700
+++ linux-2.6.6/include/asm-x86_64/io.h 2004-05-17 10:35:03.000000000 -0700
@@ -195,8 +195,13 @@
#define __raw_writel writel
#define __raw_writeq writeq
-void *memcpy_fromio(void*,const void*,unsigned);
-void *memcpy_toio(void*,const void*,unsigned);
+void *__memcpy_fromio(void*,unsigned long,unsigned);
+void *__memcpy_toio(unsigned long,const void*,unsigned);
+
+#define memcpy_fromio(to,from,len) \
+ __memcpy_fromio((to),(unsigned long)(from),(len))
+#define memcpy_toio(to,from,len) \
+ __memcpy_toio((unsigned long)(to),(from),(len))
#define memset_io(a,b,c) memset((void *)(a),(b),(c))
/*
prev parent reply other threads:[~2004-05-17 18:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-17 4:03 What types are the parameters of memcpy_toio? Roland Dreier
2004-05-17 18:28 ` Roland Dreier [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=5265auvrfu.fsf@topspin.com \
--to=roland@topspin.com \
--cc=ak@muc.de \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.