aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2008-06-09 19:39:57 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-21 18:16:31 -0400
commit518386c7d4cc3eb8e6b815e0b11ed2cec6245907 (patch)
tree68e3a61a64b91e26b71fc82b1c2f8cd37cdf2144
parentbef4665a2e5145737fa925a5a1a7a8afd1b91acc (diff)
USB: usbmon: use simple_read_from_buffer()
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/mon/mon_stat.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/usb/mon/mon_stat.c b/drivers/usb/mon/mon_stat.c
index c7a595cd648a..ac8b0d5ce7f8 100644
--- a/drivers/usb/mon/mon_stat.c
+++ b/drivers/usb/mon/mon_stat.c
@@ -9,6 +9,7 @@
9 9
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/usb.h> 11#include <linux/usb.h>
12#include <linux/fs.h>
12#include <asm/uaccess.h> 13#include <asm/uaccess.h>
13 14
14#include "usb_mon.h" 15#include "usb_mon.h"
@@ -42,19 +43,8 @@ static ssize_t mon_stat_read(struct file *file, char __user *buf,
42 size_t nbytes, loff_t *ppos) 43 size_t nbytes, loff_t *ppos)
43{ 44{
44 struct snap *sp = file->private_data; 45 struct snap *sp = file->private_data;
45 loff_t pos = *ppos;
46 int cnt;
47 46
48 if (pos < 0 || pos >= sp->slen) 47 return simple_read_from_buffer(buf, nbytes, ppos, sp->str, sp->slen);
49 return 0;
50 if (nbytes == 0)
51 return 0;
52 if ((cnt = sp->slen - pos) > nbytes)
53 cnt = nbytes;
54 if (copy_to_user(buf, sp->str + pos, cnt))
55 return -EFAULT;
56 *ppos = pos + cnt;
57 return cnt;
58} 48}
59 49
60static int mon_stat_release(struct inode *inode, struct file *file) 50static int mon_stat_release(struct inode *inode, struct file *file)