Commit 06bda66b authored by Eli Billauer's avatar Eli Billauer Committed by Greg Kroah-Hartman

staging: xillybus: EAGAIN status handling improvement

The -EAGAIN status is passed through an "rc" variable instead of a less
common flow.
Suggested-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarEli Billauer <eli.billauer@gmail.com>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5b09fc96
...@@ -833,7 +833,7 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, ...@@ -833,7 +833,7 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf,
if (ready) if (ready)
goto desperate; goto desperate;
bytes_done = -EAGAIN; rc = -EAGAIN;
break; break;
} }
...@@ -995,6 +995,9 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf, ...@@ -995,6 +995,9 @@ static ssize_t xillybus_read(struct file *filp, char __user *userbuf,
if (channel->endpoint->fatal_error) if (channel->endpoint->fatal_error)
return -EIO; return -EIO;
if (rc)
return rc;
return bytes_done; return bytes_done;
} }
...@@ -1386,7 +1389,7 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, ...@@ -1386,7 +1389,7 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf,
*/ */
if (filp->f_flags & O_NONBLOCK) { if (filp->f_flags & O_NONBLOCK) {
bytes_done = -EAGAIN; rc = -EAGAIN;
break; break;
} }
...@@ -1412,6 +1415,12 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, ...@@ -1412,6 +1415,12 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf,
&channel->rd_workitem, &channel->rd_workitem,
XILLY_RX_TIMEOUT); XILLY_RX_TIMEOUT);
if (channel->endpoint->fatal_error)
return -EIO;
if (rc)
return rc;
if ((channel->rd_synchronous) && (bytes_done > 0)) { if ((channel->rd_synchronous) && (bytes_done > 0)) {
rc = xillybus_myflush(filp->private_data, 0); /* No timeout */ rc = xillybus_myflush(filp->private_data, 0); /* No timeout */
...@@ -1419,9 +1428,6 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf, ...@@ -1419,9 +1428,6 @@ static ssize_t xillybus_write(struct file *filp, const char __user *userbuf,
return rc; return rc;
} }
if (channel->endpoint->fatal_error)
return -EIO;
return bytes_done; return bytes_done;
} }
......
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