diff options
author | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> | 2013-11-27 00:30:43 +0400 |
---|---|---|
committer | Peter Huewe <peterhuewe@gmx.de> | 2014-01-06 17:37:25 +0400 |
commit | 01ad1fa75dd243909d62dba25a93254b20d5fe81 (patch) | |
tree | f7a09e61ead8f9e0a1002dde7e53d0376b8b3c19 /drivers/char/tpm/tpm-interface.c | |
parent | 1e3b73a95793555860512008035f6822406a2a79 (diff) | |
download | linux-01ad1fa75dd243909d62dba25a93254b20d5fe81.tar.xz |
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 <jgunthorpe@obsidianresearch.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Reviewed-by: Ashley Lai <adlai@linux.vnet.ibm.com>
[phuewe: did apply manually due to commit
191ffc6bde3 tpm/tpm_i2c_atmel: fix coccinelle warnings]
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Diffstat (limited to 'drivers/char/tpm/tpm-interface.c')
-rw-r--r-- | drivers/char/tpm/tpm-interface.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index 389d483a887c..1b012463da7c 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c @@ -1060,7 +1060,7 @@ static void tpm_dev_release(struct device *dev) * pci_disable_device */ struct tpm_chip *tpm_register_hardware(struct device *dev, - const struct tpm_vendor_specific *entry) + const struct tpm_class_ops *ops) { struct tpm_chip *chip; @@ -1073,7 +1073,13 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, mutex_init(&chip->tpm_mutex); INIT_LIST_HEAD(&chip->list); - memcpy(&chip->vendor, entry, sizeof(struct tpm_vendor_specific)); + chip->vendor.req_complete_mask = ops->req_complete_mask; + chip->vendor.req_complete_val = ops->req_complete_val; + chip->vendor.req_canceled = ops->req_canceled; + chip->vendor.recv = ops->recv; + chip->vendor.send = ops->send; + chip->vendor.cancel = ops->cancel; + chip->vendor.status = ops->status; chip->dev_num = find_first_zero_bit(dev_mask, TPM_NUM_DEVICES); |