Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 205544
b: refs/heads/master
c: 3c17ba0
h: refs/heads/master
v: v3
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Jun 17, 2010
1 parent d0bd45c commit 2cd615a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 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: 3d34023a99d35440d6a22fb0b4547fc9817b7b40
refs/heads/master: 3c17ba0743d75f9888d905ddf9f8551c7dd36493
11 changes: 9 additions & 2 deletions trunk/drivers/staging/comedi/comedi_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1845,8 +1845,15 @@ static int comedi_open(struct inode *inode, struct file *file)
}
}

if (dev->attached && dev->use_count == 0 && dev->open)
dev->open(dev);
if (dev->attached && dev->use_count == 0 && dev->open) {
int rc = dev->open(dev);
if (rc < 0) {
module_put(dev->driver->module);
module_put(THIS_MODULE);
mutex_unlock(&dev->mutex);
return rc;
}
}

dev->use_count++;

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/staging/comedi/comedidev.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ struct comedi_device {

struct fasync_struct *async_queue;

void (*open) (struct comedi_device *dev);
int (*open) (struct comedi_device *dev);
void (*close) (struct comedi_device *dev);
};

Expand Down
6 changes: 5 additions & 1 deletion trunk/drivers/staging/comedi/drivers/dt9812.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,10 @@ static struct usb_driver dt9812_usb_driver = {
* Comedi functions
*/

static void dt9812_comedi_open(struct comedi_device *dev)
static int dt9812_comedi_open(struct comedi_device *dev)
{
int result = -ENODEV;

down(&devpriv->slot->mutex);
if (devpriv->slot->usb) {
/* We have an attached device, fill in current range info */
Expand Down Expand Up @@ -934,8 +936,10 @@ static void dt9812_comedi_open(struct comedi_device *dev)
}
break;
}
result = 0;
}
up(&devpriv->slot->mutex);
return result;
}

static int dt9812_di_rinsn(struct comedi_device *dev,
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/staging/comedi/drivers/jr3_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ static int jr3_pci_ai_insn_read(struct comedi_device *dev,
return result;
}

static void jr3_pci_open(struct comedi_device *dev)
static int jr3_pci_open(struct comedi_device *dev)
{
int i;
struct jr3_pci_dev_private *devpriv = dev->private;
Expand All @@ -388,6 +388,7 @@ static void jr3_pci_open(struct comedi_device *dev)
p->channel_no);
}
}
return 0;
}

int read_idm_word(const u8 * data, size_t size, int *pos, unsigned int *val)
Expand Down
9 changes: 6 additions & 3 deletions trunk/drivers/staging/comedi/drivers/serial2002.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,16 @@ static void serial_write(struct file *f, struct serial_data data)
}
}

static void serial_2002_open(struct comedi_device *dev)
static int serial_2002_open(struct comedi_device *dev)
{
int result;
char port[20];

sprintf(port, "/dev/ttyS%d", devpriv->port);
devpriv->tty = filp_open(port, O_RDWR, 0);
if (IS_ERR(devpriv->tty)) {
printk("serial_2002: file open error = %ld\n",
PTR_ERR(devpriv->tty));
result = (int)PTR_ERR(devpriv->tty);
printk("serial_2002: file open error = %d\n", result);
} else {
struct config_t {

Expand Down Expand Up @@ -673,7 +674,9 @@ static void serial_2002_open(struct comedi_device *dev)
}
}
}
result = 0;
}
return result;
}

static void serial_2002_close(struct comedi_device *dev)
Expand Down

0 comments on commit 2cd615a

Please sign in to comment.