Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 208149
b: refs/heads/master
c: 82ce67b
h: refs/heads/master
i:
  208147: 94729fc
v: v3
  • Loading branch information
Jarod Wilson authored and Mauro Carvalho Chehab committed Aug 9, 2010
1 parent f3425ed commit 6e44022
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 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: efce8ca3c5d8a35018f801d687396e1911cfc868
refs/heads/master: 82ce67bf262b3f47ecb5a0ca31cace8ac72b7c98
9 changes: 6 additions & 3 deletions trunk/drivers/staging/lirc/lirc_it87.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ static DECLARE_WAIT_QUEUE_HEAD(lirc_read_queue);

static DEFINE_SPINLOCK(hardware_lock);
static DEFINE_SPINLOCK(dev_lock);
static bool device_open;

static int rx_buf[RBUF_LEN];
unsigned int rx_tail, rx_head;
Expand Down Expand Up @@ -147,17 +148,21 @@ static void drop_port(void);
static int lirc_open(struct inode *inode, struct file *file)
{
spin_lock(&dev_lock);
if (module_refcount(THIS_MODULE)) {
if (device_open) {
spin_unlock(&dev_lock);
return -EBUSY;
}
device_open = true;
spin_unlock(&dev_lock);
return 0;
}


static int lirc_close(struct inode *inode, struct file *file)
{
spin_lock(&dev_lock);
device_open = false;
spin_unlock(&dev_lock);
return 0;
}

Expand Down Expand Up @@ -363,7 +368,6 @@ static struct lirc_driver driver = {
};


#ifdef MODULE
static int init_chrdev(void)
{
driver.minor = lirc_register_driver(&driver);
Expand All @@ -380,7 +384,6 @@ static void drop_chrdev(void)
{
lirc_unregister_driver(driver.minor);
}
#endif


/* SECTION: Hardware */
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/staging/lirc/lirc_parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ static void irq_handler(void *blah)
unsigned int level, newlevel;
unsigned int timeout;

if (!module_refcount(THIS_MODULE))
if (!is_open)
return;

if (!is_claimed)
Expand Down Expand Up @@ -515,7 +515,7 @@ static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)

static int lirc_open(struct inode *node, struct file *filep)
{
if (module_refcount(THIS_MODULE) || !lirc_claim())
if (is_open || !lirc_claim())
return -EBUSY;

parport_enable_irq(pport);
Expand Down

0 comments on commit 6e44022

Please sign in to comment.