Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea23ec26 authored by Akinobu Mita's avatar Akinobu Mita Committed by David S. Miller
Browse files

isdn: use simple_read_from_buffer()

parent 495b36b1
Loading
Loading
Loading
Loading
+8 −21
Original line number Diff line number Diff line
@@ -210,27 +210,14 @@ static ssize_t
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 (!(file->f_mode & FMODE_READ))
		return -EPERM;	/* no permission to 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 */
		return -EFAULT;	/* should never happen */

	return (i);
	return simple_read_from_buffer(buf, count, off, cp, strlen(cp));
}				/* hysdn_conf_read */

/******************/