summaryrefslogtreecommitdiff
path: root/cmd/tpm-common.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-11-18 14:22:27 -0700
committerSimon Glass <sjg@chromium.org>2018-11-29 09:30:06 -0700
commitabdc7b8a2d7f2b8527ce4f9133b777942af99126 (patch)
treee45abe92dc40db0d684f7ed82453504469b99cc3 /cmd/tpm-common.c
parent51f00c1704e505f51a02a3687e4384231ce8ae20 (diff)
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 'cmd/tpm-common.c')
-rw-r--r--cmd/tpm-common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd/tpm-common.c b/cmd/tpm-common.c
index 56443862c2..89f2aa001b 100644
--- a/cmd/tpm-common.c
+++ b/cmd/tpm-common.c
@@ -264,10 +264,16 @@ int do_tpm_info(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
int do_tpm_init(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
+ struct udevice *dev;
+ int rc;
+
if (argc != 1)
return CMD_RET_USAGE;
+ rc = get_tpm(&dev);
+ if (rc)
+ return rc;
- return report_return_code(tpm_init());
+ return report_return_code(tpm_init(dev));
}
int do_tpm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])