Skip to content

Commit

Permalink
[PATCH] tpm: use flush_scheduled_work()
Browse files Browse the repository at this point in the history
Add the necessary flush_schedule_work calls when canceling the timer.

Signed-off-by: Kylene Hall <kjhall@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Kylene Jo Hall authored and Linus Torvalds committed Nov 18, 2005
1 parent 966cc04 commit ba39611
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/char/tpm/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ int tpm_release(struct inode *inode, struct file *file)
file->private_data = NULL;
chip->num_opens--;
del_singleshot_timer_sync(&chip->user_read_timer);
flush_scheduled_work();
atomic_set(&chip->data_pending, 0);
put_device(chip->dev);
kfree(chip->data_buffer);
Expand Down Expand Up @@ -428,6 +429,7 @@ ssize_t tpm_read(struct file * file, char __user *buf,
int ret_size;

del_singleshot_timer_sync(&chip->user_read_timer);
flush_scheduled_work();
ret_size = atomic_read(&chip->data_pending);
atomic_set(&chip->data_pending, 0);
if (ret_size > 0) { /* relay data */
Expand Down

0 comments on commit ba39611

Please sign in to comment.