]> err.no Git - linux-2.6/commitdiff
[PATCH] tpm: fix timer initialization
authorKylene Hall <kjhall@us.ibm.com>
Fri, 24 Jun 2005 05:01:56 +0000 (22:01 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Fri, 24 Jun 2005 07:05:25 +0000 (00:05 -0700)
Fix the timer to be inited and modified properly.  This work depends on the
fixing of the msleep stuff which in patch 1 of this set.

Signed-of-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/tpm/tpm.c
drivers/char/tpm/tpm.h

index 2035c15ffcce70bfc038c8a5925257a1cb353f9c..f7fa3c3a51bd63a448dee8e4b29de80e1116f650 100644 (file)
@@ -434,16 +434,7 @@ int tpm_release(struct inode *inode, struct file *file)
 
        spin_lock(&driver_lock);
        chip->num_opens--;
-       spin_unlock(&driver_lock);
-
-       down(&chip->timer_manipulation_mutex);
-       if (timer_pending(&chip->user_read_timer))
-               del_singleshot_timer_sync(&chip->user_read_timer);
-       else if (timer_pending(&chip->device_timer))
-               del_singleshot_timer_sync(&chip->device_timer);
-       up(&chip->timer_manipulation_mutex);
-
-       kfree(chip->data_buffer);
+       del_singleshot_timer_sync(&chip->user_read_timer);
        atomic_set(&chip->data_pending, 0);
 
        pci_dev_put(chip->pci_dev);
@@ -481,13 +472,7 @@ ssize_t tpm_write(struct file * file, const char __user * buf,
        up(&chip->buffer_mutex);
 
        /* Set a timeout by which the reader must come claim the result */
-       down(&chip->timer_manipulation_mutex);
-       init_timer(&chip->user_read_timer);
-       chip->user_read_timer.function = user_reader_timeout;
-       chip->user_read_timer.data = (unsigned long) chip;
-       chip->user_read_timer.expires = jiffies + (60 * HZ);
-       add_timer(&chip->user_read_timer);
-       up(&chip->timer_manipulation_mutex);
+       mod_timer(&chip->user_read_timer, jiffies + (60 * HZ));
 
        return in_size;
 }
@@ -617,9 +602,12 @@ int tpm_register_hardware(struct pci_dev *pci_dev,
 
        init_MUTEX(&chip->buffer_mutex);
        init_MUTEX(&chip->tpm_mutex);
-       init_MUTEX(&chip->timer_manipulation_mutex);
        INIT_LIST_HEAD(&chip->list);
 
+       init_timer(&chip->user_read_timer);
+       chip->user_read_timer.function = user_reader_timeout;
+       chip->user_read_timer.data = (unsigned long) chip;
+
        chip->vendor = entry;
 
        chip->dev_num = -1;
index 1a94a8c345e0f4deb66291c6d7e031e854ff5415..3a5af7e06624f18ba4fd1616f5dc55a24e3303f9 100644 (file)
@@ -63,8 +63,6 @@ struct tpm_chip {
 
        struct timer_list user_read_timer;      /* user needs to claim result */
        struct semaphore tpm_mutex;     /* tpm is processing */
-       struct timer_list device_timer; /* tpm is processing */
-       struct semaphore timer_manipulation_mutex;
 
        struct tpm_vendor_specific *vendor;