Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100305
b: refs/heads/master
c: b8c71d7
h: refs/heads/master
i:
  100303: 86a848d
v: v3
  • Loading branch information
Jonathan Corbet committed Jun 20, 2008
1 parent 7cb5f3d commit f24dfbc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 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: f4943db14f5071ecbf7ca76722e59a2fd22bda4d
refs/heads/master: b8c71d7ae2a7f723d171d9175212b6d0a727655d
19 changes: 12 additions & 7 deletions trunk/drivers/char/tlclk.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/smp_lock.h>
#include <linux/timer.h>
#include <linux/sysfs.h>
#include <linux/device.h>
Expand Down Expand Up @@ -204,11 +205,14 @@ static int tlclk_open(struct inode *inode, struct file *filp)
{
int result;

if (test_and_set_bit(0, &useflags))
return -EBUSY;
lock_kernel();
if (test_and_set_bit(0, &useflags)) {
result = -EBUSY;
/* this legacy device is always one per system and it doesn't
* know how to handle multiple concurrent clients.
*/
goto out;
}

/* Make sure there is no interrupt pending while
* initialising interrupt handler */
Expand All @@ -218,13 +222,14 @@ static int tlclk_open(struct inode *inode, struct file *filp)
* we can't share this IRQ */
result = request_irq(telclk_interrupt, &tlclk_interrupt,
IRQF_DISABLED, "telco_clock", tlclk_interrupt);
if (result == -EBUSY) {
if (result == -EBUSY)
printk(KERN_ERR "tlclk: Interrupt can't be reserved.\n");
return -EBUSY;
}
inb(TLCLK_REG6); /* Clear interrupt events */
else
inb(TLCLK_REG6); /* Clear interrupt events */

return 0;
out:
unlock_kernel();
return result;
}

static int tlclk_release(struct inode *inode, struct file *filp)
Expand Down

0 comments on commit f24dfbc

Please sign in to comment.