blob: ba3b6f9dacf7c6a0f55bca4de024ea736f3304b9 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
James Bottomleyecb38e22017-01-10 19:08:53 -08002#ifndef _TPM_DEV_H
3#define _TPM_DEV_H
4
5#include "tpm.h"
6
7struct file_priv {
8 struct tpm_chip *chip;
9
10 /* Data passed to and from the tpm via the read/write calls */
11 atomic_t data_pending;
12 struct mutex buffer_mutex;
13
14 struct timer_list user_read_timer; /* user needs to claim result */
15 struct work_struct work;
16
17 u8 data_buffer[TPM_BUFSIZE];
18};
19
20void tpm_common_open(struct file *file, struct tpm_chip *chip,
21 struct file_priv *priv);
22ssize_t tpm_common_read(struct file *file, char __user *buf,
23 size_t size, loff_t *off);
24ssize_t tpm_common_write(struct file *file, const char __user *buf,
25 size_t size, loff_t *off, struct tpm_space *space);
26void tpm_common_release(struct file *file, struct file_priv *priv);
27
28#endif