Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 353934
b: refs/heads/master
c: 5c87fef
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jan 7, 2013
1 parent 6db9d69 commit f990e98
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ca081b1d7e2f355b54a6fa1e63f84b8ceb9597de
refs/heads/master: 5c87fef53cb338a919a18349facaf172c1f0cf75
34 changes: 10 additions & 24 deletions trunk/drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1980,38 +1980,25 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
DECLARE_WAITQUEUE(wait, current);
const unsigned minor = iminor(file->f_dentry->d_inode);
struct comedi_file_info *info = comedi_file_info_from_minor(minor);
struct comedi_device *dev;
struct comedi_device *dev = comedi_dev_from_minor(minor);

if (info == NULL)
return -ENODEV;
dev = info->device;
if (dev == NULL)
if (!dev)
return -ENODEV;

if (!dev->attached) {
DPRINTK("no driver configured on comedi%i\n", dev->minor);
retval = -ENODEV;
goto done;
return -ENODEV;
}

s = comedi_read_subdevice(info);
if (s == NULL) {
retval = -EIO;
goto done;
}
if (!s)
return -EIO;

async = s->async;
if (!nbytes) {
retval = 0;
goto done;
}
if (!s->busy) {
retval = 0;
goto done;
}
if (s->busy != file) {
retval = -EACCES;
goto done;
}
if (!s->busy || !nbytes)
return 0;
if (s->busy != file)
return -EACCES;

add_wait_queue(&async->wait_head, &wait);
while (nbytes > 0 && !retval) {
Expand Down Expand Up @@ -2080,7 +2067,6 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
set_current_state(TASK_RUNNING);
remove_wait_queue(&async->wait_head, &wait);

done:
return count ? count : retval;
}

Expand Down

0 comments on commit f990e98

Please sign in to comment.