18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _TPM_DEV_H 38c2ecf20Sopenharmony_ci#define _TPM_DEV_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include <linux/poll.h> 68c2ecf20Sopenharmony_ci#include "tpm.h" 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_cistruct file_priv { 98c2ecf20Sopenharmony_ci struct tpm_chip *chip; 108c2ecf20Sopenharmony_ci struct tpm_space *space; 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci struct mutex buffer_mutex; 138c2ecf20Sopenharmony_ci struct timer_list user_read_timer; /* user needs to claim result */ 148c2ecf20Sopenharmony_ci struct work_struct timeout_work; 158c2ecf20Sopenharmony_ci struct work_struct async_work; 168c2ecf20Sopenharmony_ci wait_queue_head_t async_wait; 178c2ecf20Sopenharmony_ci ssize_t response_length; 188c2ecf20Sopenharmony_ci bool response_read; 198c2ecf20Sopenharmony_ci bool command_enqueued; 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci u8 data_buffer[TPM_BUFSIZE]; 228c2ecf20Sopenharmony_ci}; 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_civoid tpm_common_open(struct file *file, struct tpm_chip *chip, 258c2ecf20Sopenharmony_ci struct file_priv *priv, struct tpm_space *space); 268c2ecf20Sopenharmony_cissize_t tpm_common_read(struct file *file, char __user *buf, 278c2ecf20Sopenharmony_ci size_t size, loff_t *off); 288c2ecf20Sopenharmony_cissize_t tpm_common_write(struct file *file, const char __user *buf, 298c2ecf20Sopenharmony_ci size_t size, loff_t *off); 308c2ecf20Sopenharmony_ci__poll_t tpm_common_poll(struct file *file, poll_table *wait); 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_civoid tpm_common_release(struct file *file, struct file_priv *priv); 338c2ecf20Sopenharmony_ci#endif 34