Skip to content

Commit

Permalink
tpm-tpm: BKL pushdown
Browse files Browse the repository at this point in the history
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Arnd Bergmann authored and Jonathan Corbet committed Jul 2, 2008
1 parent 09de361 commit 25368ca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/char/tpm/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/poll.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/smp_lock.h>

#include "tpm.h"

Expand Down Expand Up @@ -897,6 +898,7 @@ int tpm_open(struct inode *inode, struct file *file)
int rc = 0, minor = iminor(inode);
struct tpm_chip *chip = NULL, *pos;

lock_kernel();
spin_lock(&driver_lock);

list_for_each_entry(pos, &tpm_chip_list, list) {
Expand Down Expand Up @@ -926,16 +928,19 @@ int tpm_open(struct inode *inode, struct file *file)
if (chip->data_buffer == NULL) {
chip->num_opens--;
put_device(chip->dev);
unlock_kernel();
return -ENOMEM;
}

atomic_set(&chip->data_pending, 0);

file->private_data = chip;
unlock_kernel();
return 0;

err_out:
spin_unlock(&driver_lock);
unlock_kernel();
return rc;
}
EXPORT_SYMBOL_GPL(tpm_open);
Expand Down

0 comments on commit 25368ca

Please sign in to comment.