Skip to content

Commit

Permalink
/dev/mem: remove redundant parameter from do_write_kmem()
Browse files Browse the repository at this point in the history
Signed-off-by: Wu Fengguang <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Avi Kivity <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Johannes Berg <[email protected]>
Cc: Marcelo Tosatti <[email protected]>
Cc: Mark Brown <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Wu Fengguang authored and torvalds committed Dec 15, 2009
1 parent 80ad89a commit ee32398
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ static ssize_t read_kmem(struct file *file, char __user *buf,


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;
Expand All @@ -470,12 +470,11 @@ do_write_kmem(void *p, unsigned long realp, const char __user * buf,
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;
}
Expand All @@ -484,14 +483,14 @@ do_write_kmem(void *p, unsigned long realp, const char __user * buf,
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) {
Expand All @@ -502,7 +501,6 @@ do_write_kmem(void *p, unsigned long realp, const char __user * buf,
}
buf += sz;
p += sz;
realp += sz;
count -= sz;
written += sz;
}
Expand All @@ -526,7 +524,7 @@ static ssize_t write_kmem(struct file * file, const char __user * buf,
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;
Expand Down

0 comments on commit ee32398

Please sign in to comment.