Commit 518386c7d4cc3eb8e6b815e0b11ed2cec6245907
Committed by
Greg Kroah-Hartman
1 parent
bef4665a2e
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 2 additions and 12 deletions Side-by-side Diff
drivers/usb/mon/mon_stat.c
... | ... | @@ -9,6 +9,7 @@ |
9 | 9 | |
10 | 10 | #include <linux/kernel.h> |
11 | 11 | #include <linux/usb.h> |
12 | +#include <linux/fs.h> | |
12 | 13 | #include <asm/uaccess.h> |
13 | 14 | |
14 | 15 | #include "usb_mon.h" |
15 | 16 | |
... | ... | @@ -42,19 +43,8 @@ |
42 | 43 | size_t nbytes, loff_t *ppos) |
43 | 44 | { |
44 | 45 | struct snap *sp = file->private_data; |
45 | - loff_t pos = *ppos; | |
46 | - int cnt; | |
47 | 46 | |
48 | - if (pos < 0 || pos >= 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; | |
47 | + return simple_read_from_buffer(buf, nbytes, ppos, sp->str, sp->slen); | |
58 | 48 | } |
59 | 49 | |
60 | 50 | static int mon_stat_release(struct inode *inode, struct file *file) |