提交 ea23ec26 编写于 作者: A Akinobu Mita 提交者: David S. Miller

isdn: use simple_read_from_buffer()

Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
Acked-by: NKarsten Keil <kkeil@suse.de>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 495b36b1
...@@ -207,30 +207,17 @@ hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t ...@@ -207,30 +207,17 @@ hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t
/* read conf file -> output card info data */ /* read conf file -> output card info data */
/*******************************************/ /*******************************************/
static ssize_t 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; char *cp;
int i;
if (file->f_mode & FMODE_READ) { if (!(file->f_mode & FMODE_READ))
return -EPERM; /* no permission to read */
if (!(cp = file->private_data)) if (!(cp = file->private_data))
return (-EFAULT); /* should never happen */ 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 */
return (i); return simple_read_from_buffer(buf, count, off, cp, strlen(cp));
} /* hysdn_conf_read */ } /* hysdn_conf_read */
/******************/ /******************/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册