X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=drivers%2Fusb%2Fmon%2Fmon_stat.c;h=ac8b0d5ce7f852c663dca9af9fbb8dc389348591;hb=8c82a17e9c924c0e9f13e75e4c2f6bca19a4b516;hp=c7a595cd648ae2b2f473390b94d0f89b0fb2214f;hpb=77a50df2b14c8d3ee3c58c21c4a0e0157570df09;p=linux-2.6-omap-h63xx.git 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)