lkml.org 
[lkml]   [2008]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 05/23] isdn: use simple_read_from_buffer
On Mon, Jun 02, 2008 at 12:00:22AM +0900, Akinobu@suse.de wrote:
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

Acked-by: Karsten Keil <kkeil@suse.de>

> Cc: Karsten Keil <kkeil@suse.de>
> ---
> drivers/isdn/hysdn/hysdn_procconf.c | 27 +++++++--------------------
> 1 file changed, 7 insertions(+), 20 deletions(-)
>
> Index: 2.6-git/drivers/isdn/hysdn/hysdn_procconf.c
> ===================================================================
> --- 2.6-git.orig/drivers/isdn/hysdn/hysdn_procconf.c
> +++ 2.6-git/drivers/isdn/hysdn/hysdn_procconf.c
> @@ -207,30 +207,17 @@ hysdn_conf_write(struct file *file, cons
> /* read conf file -> output card info data */
> /*******************************************/
> static ssize_t
> -hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t * off)
> +hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t *off)
> {
> char *cp;
> - int i;
>
> - if (file->f_mode & FMODE_READ) {
> - if (!(cp = file->private_data))
> - return (-EFAULT); /* should never happen */
> - i = strlen(cp); /* get total string length */
> - if (*off < i) {
> - /* still bytes to transfer */
> - cp += *off; /* point to desired data offset */
> - i -= *off; /* remaining length */
> - if (i > count)
> - i = count; /* limit length to transfer */
> - if (copy_to_user(buf, cp, i))
> - return (-EFAULT); /* copy error */
> - *off += i; /* adjust offset */
> - } else
> - return (0);
> - } else
> - return (-EPERM); /* no permission to read */
> + if (!(file->f_mode & FMODE_READ))
> + return -EPERM; /* no permission to read */
>
> - return (i);
> + if (!(cp = file->private_data))
> + return -EFAULT; /* should never happen */
> +
> + return simple_read_from_buffer(buf, count, off, cp, strlen(cp));
> } /* hysdn_conf_read */
>
> /******************/
>
> --

--
Karsten Keil
SuSE Labs
ISDN and VOIP development
SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)


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