Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 353926
b: refs/heads/master
c: 4da5fa9
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jan 7, 2013
1 parent 01c373b commit 223f193
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 44 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: 85104e9b409013c78624b367dec02e6ccc996635
refs/heads/master: 4da5fa9a439fda3019585aecab44462fd641b6f8
32 changes: 8 additions & 24 deletions trunk/drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1608,14 +1608,11 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
const unsigned minor = iminor(file->f_dentry->d_inode);
struct comedi_device_file_info *dev_file_info =
comedi_get_device_file_info(minor);
struct comedi_device *dev;
struct comedi_device *dev = comedi_dev_from_minor(minor);
int rc;

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

mutex_lock(&dev->mutex);

Expand Down Expand Up @@ -2088,12 +2085,9 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
static int comedi_open(struct inode *inode, struct file *file)
{
const unsigned minor = iminor(inode);
struct comedi_device_file_info *dev_file_info =
comedi_get_device_file_info(minor);
struct comedi_device *dev =
dev_file_info ? dev_file_info->device : NULL;
struct comedi_device *dev = comedi_dev_from_minor(minor);

if (dev == NULL) {
if (!dev) {
DPRINTK("invalid minor number\n");
return -ENODEV;
}
Expand Down Expand Up @@ -2168,14 +2162,9 @@ static int comedi_open(struct inode *inode, struct file *file)
static int comedi_fasync(int fd, struct file *file, int on)
{
const unsigned minor = iminor(file->f_dentry->d_inode);
struct comedi_device_file_info *dev_file_info;
struct comedi_device *dev;
dev_file_info = comedi_get_device_file_info(minor);
struct comedi_device *dev = comedi_dev_from_minor(minor);

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

return fasync_helper(fd, file, on, &dev->async_queue);
Expand All @@ -2184,16 +2173,11 @@ static int comedi_fasync(int fd, struct file *file, int on)
static int comedi_close(struct inode *inode, struct file *file)
{
const unsigned minor = iminor(inode);
struct comedi_device *dev = comedi_dev_from_minor(minor);
struct comedi_subdevice *s = NULL;
int i;
struct comedi_device_file_info *dev_file_info;
struct comedi_device *dev;
dev_file_info = comedi_get_device_file_info(minor);

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

mutex_lock(&dev->mutex);
Expand Down
11 changes: 3 additions & 8 deletions trunk/drivers/staging/comedi/drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,13 +213,10 @@ int comedi_driver_unregister(struct comedi_driver *driver)

/* check for devices using this driver */
for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
struct comedi_device_file_info *dev_file_info =
comedi_get_device_file_info(i);
struct comedi_device *dev;
struct comedi_device *dev = comedi_dev_from_minor(i);

if (dev_file_info == NULL)
if (!dev)
continue;
dev = dev_file_info->device;

mutex_lock(&dev->mutex);
if (dev->attached && dev->driver == driver) {
Expand Down Expand Up @@ -834,7 +831,6 @@ int comedi_auto_config(struct device *hardware_device,
struct comedi_driver *driver, unsigned long context)
{
int minor;
struct comedi_device_file_info *dev_file_info;
struct comedi_device *comedi_dev;
int ret;

Expand All @@ -852,8 +848,7 @@ int comedi_auto_config(struct device *hardware_device,
if (minor < 0)
return minor;

dev_file_info = comedi_get_device_file_info(minor);
comedi_dev = dev_file_info->device;
comedi_dev = comedi_dev_from_minor(minor);

mutex_lock(&comedi_dev->mutex);
if (comedi_dev->attached)
Expand Down
8 changes: 2 additions & 6 deletions trunk/drivers/staging/comedi/kcomedilib/kcomedilib_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ MODULE_LICENSE("GPL");

struct comedi_device *comedi_open(const char *filename)
{
struct comedi_device_file_info *dev_file_info;
struct comedi_device *dev;
unsigned int minor;

Expand All @@ -54,12 +53,9 @@ struct comedi_device *comedi_open(const char *filename)
if (minor >= COMEDI_NUM_BOARD_MINORS)
return NULL;

dev_file_info = comedi_get_device_file_info(minor);
if (dev_file_info == NULL)
return NULL;
dev = dev_file_info->device;
dev = comedi_dev_from_minor(minor);

if (dev == NULL || !dev->attached)
if (!dev || !dev->attached)
return NULL;

if (!try_module_get(dev->driver->module))
Expand Down
7 changes: 2 additions & 5 deletions trunk/drivers/staging/comedi/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,10 @@ static int comedi_read(char *buf, char **start, off_t offset, int len,
"driver_name, board_name, n_subdevices");

for (i = 0; i < COMEDI_NUM_BOARD_MINORS; i++) {
struct comedi_device_file_info *dev_file_info =
comedi_get_device_file_info(i);
struct comedi_device *dev;
struct comedi_device *dev = comedi_dev_from_minor(i);

if (dev_file_info == NULL)
if (!dev)
continue;
dev = dev_file_info->device;

if (dev->attached) {
devices_q = 1;
Expand Down

0 comments on commit 223f193

Please sign in to comment.