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