diff options
author | Simon Glass <sjg@chromium.org> | 2018-11-18 14:22:27 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-11-29 09:30:06 -0700 |
commit | abdc7b8a2d7f2b8527ce4f9133b777942af99126 (patch) | |
tree | e45abe92dc40db0d684f7ed82453504469b99cc3 /lib/tpm-common.c | |
parent | 51f00c1704e505f51a02a3687e4384231ce8ae20 (diff) | |
download | u-boot-abdc7b8a2d7f2b8527ce4f9133b777942af99126.tar.gz |
tpm: Convert to use a device parameter
At present many TPM calls assume there is only one TPM in the system and
look up this TPM themselves. This is inconsistent with driver model, which
expects all driver methods to have a device parameter. Update the code to
correct this.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/tpm-common.c')
-rw-r--r-- | lib/tpm-common.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/tpm-common.c b/lib/tpm-common.c index a440639cec..6afe59b1fe 100644 --- a/lib/tpm-common.c +++ b/lib/tpm-common.c @@ -151,9 +151,9 @@ u32 tpm_return_code(const void *response) return get_unaligned_be32(response + return_code_offset); } -u32 tpm_sendrecv_command(const void *command, void *response, size_t *size_ptr) +u32 tpm_sendrecv_command(struct udevice *dev, const void *command, + void *response, size_t *size_ptr) { - struct udevice *dev; int err, ret; u8 response_buffer[COMMAND_BUFFER_SIZE]; size_t response_length; @@ -166,9 +166,6 @@ u32 tpm_sendrecv_command(const void *command, void *response, size_t *size_ptr) response_length = sizeof(response_buffer); } - ret = uclass_first_device_err(UCLASS_TPM, &dev); - if (ret) - return ret; err = tpm_xfer(dev, command, tpm_command_size(command), response, &response_length); @@ -188,14 +185,7 @@ u32 tpm_sendrecv_command(const void *command, void *response, size_t *size_ptr) return ret; } -int tpm_init(void) +int tpm_init(struct udevice *dev) { - struct udevice *dev; - int err; - - err = uclass_first_device_err(UCLASS_TPM, &dev); - if (err) - return err; - return tpm_open(dev); } |