mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Karsten Keil <kkeil@suse.de>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [patch 05/23] isdn: use simple_read_from_buffer
Date: Sun, 1 Jun 2008 18:15:43 +0200	[thread overview]
Message-ID: <20080601161543.GC6831@pingi.kke.suse.de> (raw)
In-Reply-To: <20080601150114.022504880@gmail.com>

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)

      parent reply	other threads:[~2008-06-01 16:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080601150017.176540188@gmail.com>
     [not found] ` <20080601150114.022504880@gmail.com>
2008-06-01 16:09   ` Karsten Keil
2008-06-01 16:15   ` Karsten Keil [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080601161543.GC6831@pingi.kke.suse.de \
    --to=kkeil@suse.de \
    --cc=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®