1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2ecb38e2fSJames Bottomley #ifndef _TPM_DEV_H 3ecb38e2fSJames Bottomley #define _TPM_DEV_H 4ecb38e2fSJames Bottomley 5ecb38e2fSJames Bottomley #include "tpm.h" 6ecb38e2fSJames Bottomley 7ecb38e2fSJames Bottomley struct file_priv { 8ecb38e2fSJames Bottomley struct tpm_chip *chip; 9*c3d477a7STadeusz Struk struct tpm_space *space; 10ecb38e2fSJames Bottomley 11ecb38e2fSJames Bottomley /* Data passed to and from the tpm via the read/write calls */ 123ab2011eSTadeusz Struk size_t data_pending; 13ecb38e2fSJames Bottomley struct mutex buffer_mutex; 14ecb38e2fSJames Bottomley 15ecb38e2fSJames Bottomley struct timer_list user_read_timer; /* user needs to claim result */ 16ecb38e2fSJames Bottomley struct work_struct work; 17ecb38e2fSJames Bottomley 18ecb38e2fSJames Bottomley u8 data_buffer[TPM_BUFSIZE]; 19ecb38e2fSJames Bottomley }; 20ecb38e2fSJames Bottomley 21ecb38e2fSJames Bottomley void tpm_common_open(struct file *file, struct tpm_chip *chip, 22*c3d477a7STadeusz Struk struct file_priv *priv, struct tpm_space *space); 23ecb38e2fSJames Bottomley ssize_t tpm_common_read(struct file *file, char __user *buf, 24ecb38e2fSJames Bottomley size_t size, loff_t *off); 25ecb38e2fSJames Bottomley ssize_t tpm_common_write(struct file *file, const char __user *buf, 26*c3d477a7STadeusz Struk size_t size, loff_t *off); 27ecb38e2fSJames Bottomley void tpm_common_release(struct file *file, struct file_priv *priv); 28ecb38e2fSJames Bottomley 29ecb38e2fSJames Bottomley #endif 30