Commit 7785857a authored by Akinobu Mita's avatar Akinobu Mita Committed by Heiko Carstens
Browse files

[S390] s390/vmcp: use simple_read_from_buffer()

Signed-off-by: default avatarAkinobu Mita <>
Cc: Christian Borntraeger <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarHeiko Carstens <>
Signed-off-by: default avatarMartin Schwidefsky <>
parent 3ca1c990
......@@ -61,30 +61,24 @@ static int vmcp_release(struct inode *inode, struct file *file)
static ssize_t
vmcp_read(struct file *file, char __user *buff, size_t count, loff_t *ppos)
size_t tocopy;
ssize_t ret;
size_t size;
struct vmcp_session *session;
session = (struct vmcp_session *)file->private_data;
session = file->private_data;
if (mutex_lock_interruptible(&session->mutex))
if (!session->response) {
return 0;
if (*ppos > session->resp_size) {
return 0;
tocopy = min(session->resp_size - (size_t) (*ppos), count);
tocopy = min(tocopy, session->bufsize - (size_t) (*ppos));
size = min_t(size_t, session->resp_size, session->bufsize);
ret = simple_read_from_buffer(buff, count, ppos,
session->response, size);
if (copy_to_user(buff, session->response + (*ppos), tocopy)) {
return -EFAULT;
*ppos += tocopy;
return tocopy;
return ret;
static ssize_t
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment