mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-07 15:18:15 +00:00
airo: use simple_read_from_buffer()
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Dan Williams <dcbw@redhat.com> Cc: Michal Schmidt <mschmidt@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
a9f853ddd3
commit
cc0d9ff2c9
1 changed files with 3 additions and 12 deletions
|
@ -4561,22 +4561,13 @@ static ssize_t proc_read( struct file *file,
|
||||||
size_t len,
|
size_t len,
|
||||||
loff_t *offset )
|
loff_t *offset )
|
||||||
{
|
{
|
||||||
loff_t pos = *offset;
|
struct proc_data *priv = file->private_data;
|
||||||
struct proc_data *priv = (struct proc_data*)file->private_data;
|
|
||||||
|
|
||||||
if (!priv->rbuffer)
|
if (!priv->rbuffer)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (pos < 0)
|
return simple_read_from_buffer(buffer, len, offset, priv->rbuffer,
|
||||||
return -EINVAL;
|
priv->readlen);
|
||||||
if (pos >= priv->readlen)
|
|
||||||
return 0;
|
|
||||||
if (len > priv->readlen - pos)
|
|
||||||
len = priv->readlen - pos;
|
|
||||||
if (copy_to_user(buffer, priv->rbuffer + pos, len))
|
|
||||||
return -EFAULT;
|
|
||||||
*offset = pos + len;
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue