aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/tpm.c9
-rw-r--r--drivers/char/tpm/tpm.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 1a53da99b58..0b283d24673 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -43,6 +43,13 @@ static void user_reader_timeout(unsigned long ptr)
43{ 43{
44 struct tpm_chip *chip = (struct tpm_chip *) ptr; 44 struct tpm_chip *chip = (struct tpm_chip *) ptr;
45 45
46 schedule_work(&chip->work);
47}
48
49static void timeout_work(void * ptr)
50{
51 struct tpm_chip *chip = ptr;
52
46 down(&chip->buffer_mutex); 53 down(&chip->buffer_mutex);
47 atomic_set(&chip->data_pending, 0); 54 atomic_set(&chip->data_pending, 0);
48 memset(chip->data_buffer, 0, TPM_BUFSIZE); 55 memset(chip->data_buffer, 0, TPM_BUFSIZE);
@@ -527,6 +534,8 @@ int tpm_register_hardware(struct device *dev, struct tpm_vendor_specific *entry)
527 init_MUTEX(&chip->tpm_mutex); 534 init_MUTEX(&chip->tpm_mutex);
528 INIT_LIST_HEAD(&chip->list); 535 INIT_LIST_HEAD(&chip->list);
529 536
537 INIT_WORK(&chip->work, timeout_work, chip);
538
530 init_timer(&chip->user_read_timer); 539 init_timer(&chip->user_read_timer);
531 chip->user_read_timer.function = user_reader_timeout; 540 chip->user_read_timer.function = user_reader_timeout;
532 chip->user_read_timer.data = (unsigned long) chip; 541 chip->user_read_timer.data = (unsigned long) chip;
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index ad51c653803..159882ca69d 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -77,6 +77,7 @@ struct tpm_chip {
77 struct semaphore buffer_mutex; 77 struct semaphore buffer_mutex;
78 78
79 struct timer_list user_read_timer; /* user needs to claim result */ 79 struct timer_list user_read_timer; /* user needs to claim result */
80 struct work_struct work;
80 struct semaphore tpm_mutex; /* tpm is processing */ 81 struct semaphore tpm_mutex; /* tpm is processing */
81 82
82 struct tpm_vendor_specific *vendor; 83 struct tpm_vendor_specific *vendor;