From 01ad1fa75dd243909d62dba25a93254b20d5fe81 Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Tue, 26 Nov 2013 13:30:43 -0700 Subject: tpm: Create a tpm_class_ops structure and use it in the drivers This replaces the static initialization of a tpm_vendor_specific structure in the drivers with the standard Linux idiom of providing a const structure of function pointers. Signed-off-by: Jason Gunthorpe Reviewed-by: Joel Schopp Reviewed-by: Ashley Lai [phuewe: did apply manually due to commit 191ffc6bde3 tpm/tpm_i2c_atmel: fix coccinelle warnings] Signed-off-by: Peter Huewe --- include/linux/tpm.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/linux/tpm.h') diff --git a/include/linux/tpm.h b/include/linux/tpm.h index 9a9051bb1a0..fff1d0976f8 100644 --- a/include/linux/tpm.h +++ b/include/linux/tpm.h @@ -29,6 +29,18 @@ */ #define TPM_ANY_NUM 0xFFFF +struct tpm_chip; + +struct tpm_class_ops { + const u8 req_complete_mask; + const u8 req_complete_val; + bool (*req_canceled)(struct tpm_chip *chip, u8 status); + int (*recv) (struct tpm_chip *chip, u8 *buf, size_t len); + int (*send) (struct tpm_chip *chip, u8 *buf, size_t len); + void (*cancel) (struct tpm_chip *chip); + u8 (*status) (struct tpm_chip *chip); +}; + #if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf); -- cgit v1.2.3-70-g09d2