lkml.org 
[lkml]   [2008]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch -v2 09/23] usbmon: use simple_read_from_buffer
    Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
    Cc: Greg Kroah-Hartman <greg@kroah.com>
    ---
    drivers/usb/mon/mon_stat.c | 14 ++------------
    1 file changed, 2 insertions(+), 12 deletions(-)

    Index: 2.6-git/drivers/usb/mon/mon_stat.c
    ===================================================================
    --- 2.6-git.orig/drivers/usb/mon/mon_stat.c
    +++ 2.6-git/drivers/usb/mon/mon_stat.c
    @@ -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
    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)
    --


    \
     
     \ /
      Last update: 2008-06-02 01:33    [W:4.163 / U:0.128 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site