Skip to content

Commit

Permalink
tpm: replace tpm_get_backend_driver() to drop be_drivers
Browse files Browse the repository at this point in the history
Use tpm_driver_find_by_type() instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
  • Loading branch information
elmarco authored and stefanberger committed Oct 19, 2017
1 parent f3faa1d commit d91a7a5
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tpm.c
Expand Up @@ -31,13 +31,6 @@ void tpm_register_model(enum TpmModel model)
tpm_models[model] = true;
}

static const TPMDriverOps *tpm_get_backend_driver(const char *type)
{
int i = qapi_enum_parse(&TpmType_lookup, type, -1, NULL);

return i >= 0 ? be_drivers[i] : NULL;
}

#ifdef CONFIG_TPM

void tpm_register_driver(const TPMDriverOps *tdo)
Expand Down Expand Up @@ -110,6 +103,7 @@ static int configure_tpm(QemuOpts *opts)
const TPMDriverOps *be;
TPMBackend *drv;
Error *local_err = NULL;
int i;

if (!QLIST_EMPTY(&tpm_backends)) {
error_report("Only one TPM is allowed.");
Expand All @@ -129,7 +123,8 @@ static int configure_tpm(QemuOpts *opts)
return 1;
}

be = tpm_get_backend_driver(value);
i = qapi_enum_parse(&TpmType_lookup, value, -1, NULL);
be = i >= 0 ? tpm_driver_find_by_type(i) : NULL;
if (be == NULL) {
error_report(QERR_INVALID_PARAMETER_VALUE,
"type", "a TPM backend type");
Expand Down

0 comments on commit d91a7a5

Please sign in to comment.