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