From: Wu Fengguang <fengguang.wu@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andi Kleen <ak@linux.intel.com>, Avi Kivity <avi@qumranet.com>,
Greg Kroah-Hartman <gregkh@suse.de>,
Johannes Berg <johannes@sipsolutions.net>,
Marcelo Tosatti <mtosatti@redhat.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Wu Fengguang <fengguang.wu@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/3] devmem: remove redundant parameter from do_write_kmem()
Date: Sat, 12 Sep 2009 23:20:42 +0800 [thread overview]
Message-ID: <20090912152259.384529634@intel.com> (raw)
In-Reply-To: 20090912152039.479536123@intel.com
[-- Attachment #1: kmem-remove-realp.patch --]
[-- Type: text/plain, Size: 2233 bytes --]
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
drivers/char/mem.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
--- linux-mm.orig/drivers/char/mem.c 2009-09-12 23:17:12.000000000 +0800
+++ linux-mm/drivers/char/mem.c 2009-09-12 23:17:13.000000000 +0800
@@ -465,7 +465,7 @@ static ssize_t read_kmem(struct file *fi
static inline ssize_t
-do_write_kmem(void *p, unsigned long realp, const char __user * buf,
+do_write_kmem(unsigned long p, const char __user * buf,
size_t count, loff_t *ppos)
{
ssize_t written, sz;
@@ -474,12 +474,11 @@ do_write_kmem(void *p, unsigned long rea
written = 0;
#ifdef __ARCH_HAS_NO_PAGE_ZERO_MAPPED
/* we don't have page 0 mapped on sparc and m68k.. */
- if (realp < PAGE_SIZE) {
- sz = size_inside_page(realp, count);
+ if (p < PAGE_SIZE) {
+ sz = size_inside_page(p, count);
/* Hmm. Do something? */
buf += sz;
p += sz;
- realp += sz;
count -= sz;
written += sz;
}
@@ -488,14 +487,14 @@ do_write_kmem(void *p, unsigned long rea
while (count > 0) {
char *ptr;
- sz = size_inside_page(realp, count);
+ sz = size_inside_page(p, count);
/*
* On ia64 if a page has been mapped somewhere as
* uncached, then it must also be accessed uncached
* by the kernel or data corruption may occur
*/
- ptr = xlate_dev_kmem_ptr(p);
+ ptr = xlate_dev_kmem_ptr((char *)p);
copied = copy_from_user(ptr, buf, sz);
if (copied) {
@@ -506,7 +505,6 @@ do_write_kmem(void *p, unsigned long rea
}
buf += sz;
p += sz;
- realp += sz;
count -= sz;
written += sz;
}
@@ -530,7 +528,7 @@ static ssize_t write_kmem(struct file *
if (p < (unsigned long) high_memory) {
unsigned long to_write = min_t(unsigned long, count,
(unsigned long)high_memory - p);
- wrote = do_write_kmem((void *)p, p, buf, to_write, ppos);
+ wrote = do_write_kmem(p, buf, to_write, ppos);
if (wrote != to_write)
return wrote;
p += wrote;
--
next prev parent reply other threads:[~2009-09-12 15:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-12 15:20 [PATCH 0/3] more /dev/[k]mem cleanups Wu Fengguang
2009-09-12 15:20 ` [PATCH 1/3] devmem: make size_inside_page() logic straight Wu Fengguang
2009-09-12 15:20 ` [PATCH 2/3] devmem: remove the "written" variable in write_kmem() Wu Fengguang
2009-09-12 15:20 ` Wu Fengguang [this message]
2009-09-12 15:30 ` [PATCH 3/3] devmem: remove redundant parameter from do_write_kmem() Daniel Walker
2009-09-12 15:36 ` Wu Fengguang
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=20090912152259.384529634@intel.com \
--to=fengguang.wu@intel.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=avi@qumranet.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=gregkh@suse.de \
--cc=johannes@sipsolutions.net \
--cc=mtosatti@redhat.com \
/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.