| .. | .. |
|---|
| 2 | 2 | #ifndef _TPM_DEV_H |
|---|
| 3 | 3 | #define _TPM_DEV_H |
|---|
| 4 | 4 | |
|---|
| 5 | +#include <linux/poll.h> |
|---|
| 5 | 6 | #include "tpm.h" |
|---|
| 6 | 7 | |
|---|
| 7 | 8 | struct file_priv { |
|---|
| 8 | 9 | struct tpm_chip *chip; |
|---|
| 10 | + struct tpm_space *space; |
|---|
| 9 | 11 | |
|---|
| 10 | | - /* Data passed to and from the tpm via the read/write calls */ |
|---|
| 11 | | - size_t data_pending; |
|---|
| 12 | 12 | struct mutex buffer_mutex; |
|---|
| 13 | | - |
|---|
| 14 | 13 | struct timer_list user_read_timer; /* user needs to claim result */ |
|---|
| 15 | | - struct work_struct work; |
|---|
| 14 | + struct work_struct timeout_work; |
|---|
| 15 | + struct work_struct async_work; |
|---|
| 16 | + wait_queue_head_t async_wait; |
|---|
| 17 | + ssize_t response_length; |
|---|
| 18 | + bool response_read; |
|---|
| 19 | + bool command_enqueued; |
|---|
| 16 | 20 | |
|---|
| 17 | 21 | u8 data_buffer[TPM_BUFSIZE]; |
|---|
| 18 | 22 | }; |
|---|
| 19 | 23 | |
|---|
| 20 | 24 | void tpm_common_open(struct file *file, struct tpm_chip *chip, |
|---|
| 21 | | - struct file_priv *priv); |
|---|
| 25 | + struct file_priv *priv, struct tpm_space *space); |
|---|
| 22 | 26 | ssize_t tpm_common_read(struct file *file, char __user *buf, |
|---|
| 23 | 27 | size_t size, loff_t *off); |
|---|
| 24 | 28 | ssize_t tpm_common_write(struct file *file, const char __user *buf, |
|---|
| 25 | | - size_t size, loff_t *off, struct tpm_space *space); |
|---|
| 26 | | -void tpm_common_release(struct file *file, struct file_priv *priv); |
|---|
| 29 | + size_t size, loff_t *off); |
|---|
| 30 | +__poll_t tpm_common_poll(struct file *file, poll_table *wait); |
|---|
| 27 | 31 | |
|---|
| 32 | +void tpm_common_release(struct file *file, struct file_priv *priv); |
|---|
| 28 | 33 | #endif |
|---|