aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-14 17:48:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-14 17:48:31 -0400
commitd1794f2c5b5817eb79ccc5e00701ca748d1b073a (patch)
tree5a4c98e694e88a8c82f342d0cc9edb2a4cbbef36 /drivers/char/tpm/tpm.c
parenta41eebab7537890409ea9dfe0fcda9b5fbdb090d (diff)
parent2fceef397f9880b212a74c418290ce69e7ac00eb (diff)
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6: (146 commits) IB/umad: BKL is not needed for ib_umad_open() IB/uverbs: BKL is not needed for ib_uverbs_open() bf561-coreb: BKL unneeded for open() Call fasync() functions without the BKL snd/PCM: fasync BKL pushdown ipmi: fasync BKL pushdown ecryptfs: fasync BKL pushdown Bluetooth VHCI: fasync BKL pushdown tty_io: fasync BKL pushdown tun: fasync BKL pushdown i2o: fasync BKL pushdown mpt: fasync BKL pushdown Remove BKL from remote_llseek v2 Make FAT users happier by not deadlocking x86-mce: BKL pushdown vmwatchdog: BKL pushdown vmcp: BKL pushdown via-pmu: BKL pushdown uml-random: BKL pushdown uml-mmapper: BKL pushdown ...
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r--drivers/char/tpm/tpm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index a5d8bcb40000..e1fc193d9396 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -26,6 +26,7 @@
26#include <linux/poll.h> 26#include <linux/poll.h>
27#include <linux/mutex.h> 27#include <linux/mutex.h>
28#include <linux/spinlock.h> 28#include <linux/spinlock.h>
29#include <linux/smp_lock.h>
29 30
30#include "tpm.h" 31#include "tpm.h"
31 32
@@ -897,6 +898,7 @@ int tpm_open(struct inode *inode, struct file *file)
897 int rc = 0, minor = iminor(inode); 898 int rc = 0, minor = iminor(inode);
898 struct tpm_chip *chip = NULL, *pos; 899 struct tpm_chip *chip = NULL, *pos;
899 900
901 lock_kernel();
900 spin_lock(&driver_lock); 902 spin_lock(&driver_lock);
901 903
902 list_for_each_entry(pos, &tpm_chip_list, list) { 904 list_for_each_entry(pos, &tpm_chip_list, list) {
@@ -926,16 +928,19 @@ int tpm_open(struct inode *inode, struct file *file)
926 if (chip->data_buffer == NULL) { 928 if (chip->data_buffer == NULL) {
927 chip->num_opens--; 929 chip->num_opens--;
928 put_device(chip->dev); 930 put_device(chip->dev);
931 unlock_kernel();
929 return -ENOMEM; 932 return -ENOMEM;
930 } 933 }
931 934
932 atomic_set(&chip->data_pending, 0); 935 atomic_set(&chip->data_pending, 0);
933 936
934 file->private_data = chip; 937 file->private_data = chip;
938 unlock_kernel();
935 return 0; 939 return 0;
936 940
937err_out: 941err_out:
938 spin_unlock(&driver_lock); 942 spin_unlock(&driver_lock);
943 unlock_kernel();
939 return rc; 944 return rc;
940} 945}
941EXPORT_SYMBOL_GPL(tpm_open); 946EXPORT_SYMBOL_GPL(tpm_open);