Commit 518386c7 authored by Akinobu Mita's avatar Akinobu Mita Committed by Greg Kroah-Hartman

USB: usbmon: use simple_read_from_buffer()

Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Acked-by: default avatarPete Zaitcev <zaitcev@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent bef4665a
......@@ -9,6 +9,7 @@
#include <linux/kernel.h>
#include <linux/usb.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment