Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100309
b: refs/heads/master
c: 4541b5e
h: refs/heads/master
i:
  100307: c815a4a
v: v3
  • Loading branch information
Jonathan Corbet committed Jun 20, 2008
1 parent 958b37b commit 7495f69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 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: 057e7c7ff9f91a36a761588c53826bd6a710aeba
refs/heads/master: 4541b5ec9f631a143cdea862d07ddfc3cdac36f2
9 changes: 7 additions & 2 deletions trunk/drivers/misc/phantom.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/interrupt.h>
#include <linux/cdev.h>
#include <linux/phantom.h>
#include <linux/smp_lock.h>

#include <asm/atomic.h>
#include <asm/io.h>
Expand Down Expand Up @@ -212,13 +213,17 @@ static int phantom_open(struct inode *inode, struct file *file)
struct phantom_device *dev = container_of(inode->i_cdev,
struct phantom_device, cdev);

lock_kernel();
nonseekable_open(inode, file);

if (mutex_lock_interruptible(&dev->open_lock))
if (mutex_lock_interruptible(&dev->open_lock)) {
unlock_kernel();
return -ERESTARTSYS;
}

if (dev->opened) {
mutex_unlock(&dev->open_lock);
unlock_kernel();
return -EINVAL;
}

Expand All @@ -229,7 +234,7 @@ static int phantom_open(struct inode *inode, struct file *file)
atomic_set(&dev->counter, 0);
dev->opened++;
mutex_unlock(&dev->open_lock);

unlock_kernel();
return 0;
}

Expand Down

0 comments on commit 7495f69

Please sign in to comment.