diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-10 14:13:35 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-10 14:13:35 -0700 |
commit | a92b166e6b8c3c0037493690b2800b0b0dd92063 (patch) | |
tree | 0d9d52d09d5145f2a058b546077c641413786b48 /drivers | |
parent | 0d6ffdb8f151a2b685c7b45bde7ab2d49fc1bb00 (diff) | |
parent | 2190a1e7705456c2298873b2547a6eb19b8e31ae (diff) | |
download | blackbird-op-linux-a92b166e6b8c3c0037493690b2800b0b0dd92063.tar.gz blackbird-op-linux-a92b166e6b8c3c0037493690b2800b0b0dd92063.zip |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
zorro: Fix reading of proc/bus/zorro/* in small chunks
zorro: BKL removal
m68k/mac: Fix RTC on PMU machines
m68k/mac: Add color classic ii support
arch/m68k/sun3/leds.c: Checkpatch cleanup
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/zorro/proc.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index 3c7046d79654..cafc50454292 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c @@ -22,8 +22,9 @@ static loff_t proc_bus_zorro_lseek(struct file *file, loff_t off, int whence) { loff_t new = -1; + struct inode *inode = file->f_path.dentry->d_inode; - lock_kernel(); + mutex_lock(&inode->i_mutex); switch (whence) { case 0: new = off; @@ -35,12 +36,12 @@ proc_bus_zorro_lseek(struct file *file, loff_t off, int whence) new = sizeof(struct ConfigDev) + off; break; } - if (new < 0 || new > sizeof(struct ConfigDev)) { - unlock_kernel(); - return -EINVAL; - } - unlock_kernel(); - return (file->f_pos = new); + if (new < 0 || new > sizeof(struct ConfigDev)) + new = -EINVAL; + else + file->f_pos = new; + mutex_unlock(&inode->i_mutex); + return new; } static ssize_t @@ -67,7 +68,7 @@ proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t * cd.cd_BoardAddr = (void *)zorro_resource_start(z); cd.cd_BoardSize = zorro_resource_len(z); - if (copy_to_user(buf, &cd, nbytes)) + if (copy_to_user(buf, (void *)&cd + pos, nbytes)) return -EFAULT; *ppos += nbytes; |