From: Akinobu Mita Date: Mon, 9 Jun 2008 23:39:57 +0000 (-0700) Subject: USB: usbmon: use simple_read_from_buffer() X-Git-Tag: v2.6.27-rc1~946^2~38 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=518386c7d4cc3eb8e6b815e0b11ed2cec6245907;p=linux-2.6-omap-h63xx.git USB: usbmon: use simple_read_from_buffer() Signed-off-by: Akinobu Mita Acked-by: Pete Zaitcev Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/mon/mon_stat.c b/drivers/usb/mon/mon_stat.c index c7a595cd648..ac8b0d5ce7f 100644 --- a/drivers/usb/mon/mon_stat.c +++ b/drivers/usb/mon/mon_stat.c @@ -9,6 +9,7 @@ #include #include +#include #include #include "usb_mon.h" @@ -42,19 +43,8 @@ static ssize_t mon_stat_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { struct snap *sp = file->private_data; - loff_t pos = *ppos; - int cnt; - if (pos < 0 || pos >= sp->slen) - return 0; - if (nbytes == 0) - return 0; - if ((cnt = sp->slen - pos) > nbytes) - cnt = nbytes; - if (copy_to_user(buf, sp->str + pos, cnt)) - return -EFAULT; - *ppos = pos + cnt; - return cnt; + return simple_read_from_buffer(buf, nbytes, ppos, sp->str, sp->slen); } static int mon_stat_release(struct inode *inode, struct file *file)