tpm: remove tpm_register_model()

Query object classes that implements TPMIf 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>
This commit is contained in:
Marc-André Lureau 2017-11-06 19:39:25 +01:00 committed by Stefan Berger
parent c03785440d
commit d3fd953f06
3 changed files with 6 additions and 17 deletions

View File

@ -1119,7 +1119,6 @@ static const TypeInfo tpm_tis_info = {
static void tpm_tis_register(void)
{
type_register_static(&tpm_tis_info);
tpm_register_model(TPM_MODEL_TPM_TIS);
}
type_init(tpm_tis_register)

View File

@ -194,6 +194,4 @@ TPMInfo *tpm_backend_query_tpm(TPMBackend *s);
TPMBackend *qemu_find_tpm_be(const char *id);
void tpm_register_model(enum TpmModel model);
#endif

20
tpm.c
View File

@ -23,13 +23,6 @@
static QLIST_HEAD(, TPMBackend) tpm_backends =
QLIST_HEAD_INITIALIZER(tpm_backends);
static bool tpm_models[TPM_MODEL__MAX];
void tpm_register_model(enum TpmModel model)
{
tpm_models[model] = true;
}
static const TPMBackendClass *
tpm_be_find_by_type(enum TpmType type)
{
@ -236,18 +229,16 @@ TpmTypeList *qmp_query_tpm_types(Error **errp)
return head;
}
TpmModelList *qmp_query_tpm_models(Error **errp)
{
unsigned int i = 0;
TpmModelList *head = NULL, *prev = NULL, *cur_item;
GSList *e, *l = object_class_get_list(TYPE_TPM_IF, false);
for (e = l; e; e = e->next) {
TPMIfClass *c = TPM_IF_CLASS(e->data);
for (i = 0; i < TPM_MODEL__MAX; i++) {
if (!tpm_models[i]) {
continue;
}
cur_item = g_new0(TpmModelList, 1);
cur_item->value = i;
cur_item->value = c->model;
if (prev) {
prev->next = cur_item;
@ -257,6 +248,7 @@ TpmModelList *qmp_query_tpm_models(Error **errp)
}
prev = cur_item;
}
g_slist_free(l);
return head;
}