1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2ecb38e2fSJames Bottomley #ifndef _TPM_DEV_H 3ecb38e2fSJames Bottomley #define _TPM_DEV_H 4ecb38e2fSJames Bottomley 59e1b74a6STadeusz Struk #include <linux/poll.h> 6ecb38e2fSJames Bottomley #include "tpm.h" 7ecb38e2fSJames Bottomley 8ecb38e2fSJames Bottomley struct file_priv { 9ecb38e2fSJames Bottomley struct tpm_chip *chip; 10c3d477a7STadeusz Struk struct tpm_space *space; 11ecb38e2fSJames Bottomley 12ecb38e2fSJames Bottomley struct mutex buffer_mutex; 13ecb38e2fSJames Bottomley struct timer_list user_read_timer; /* user needs to claim result */ 149e1b74a6STadeusz Struk struct work_struct timeout_work; 159e1b74a6STadeusz Struk struct work_struct async_work; 169e1b74a6STadeusz Struk wait_queue_head_t async_wait; 17*a430e67dSTadeusz Struk ssize_t response_length; 189488585bSTadeusz Struk bool response_read; 199e1b74a6STadeusz Struk bool command_enqueued; 20ecb38e2fSJames Bottomley 21ecb38e2fSJames Bottomley u8 data_buffer[TPM_BUFSIZE]; 22ecb38e2fSJames Bottomley }; 23ecb38e2fSJames Bottomley 24ecb38e2fSJames Bottomley void tpm_common_open(struct file *file, struct tpm_chip *chip, 25c3d477a7STadeusz Struk struct file_priv *priv, struct tpm_space *space); 26ecb38e2fSJames Bottomley ssize_t tpm_common_read(struct file *file, char __user *buf, 27ecb38e2fSJames Bottomley size_t size, loff_t *off); 28ecb38e2fSJames Bottomley ssize_t tpm_common_write(struct file *file, const char __user *buf, 29c3d477a7STadeusz Struk size_t size, loff_t *off); 309e1b74a6STadeusz Struk __poll_t tpm_common_poll(struct file *file, poll_table *wait); 31ecb38e2fSJames Bottomley 329e1b74a6STadeusz Struk void tpm_common_release(struct file *file, struct file_priv *priv); 33ecb38e2fSJames Bottomley #endif 34