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:
parent
c03785440d
commit
d3fd953f06
@ -1119,7 +1119,6 @@ static const TypeInfo tpm_tis_info = {
|
|||||||
static void tpm_tis_register(void)
|
static void tpm_tis_register(void)
|
||||||
{
|
{
|
||||||
type_register_static(&tpm_tis_info);
|
type_register_static(&tpm_tis_info);
|
||||||
tpm_register_model(TPM_MODEL_TPM_TIS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type_init(tpm_tis_register)
|
type_init(tpm_tis_register)
|
||||||
|
@ -194,6 +194,4 @@ TPMInfo *tpm_backend_query_tpm(TPMBackend *s);
|
|||||||
|
|
||||||
TPMBackend *qemu_find_tpm_be(const char *id);
|
TPMBackend *qemu_find_tpm_be(const char *id);
|
||||||
|
|
||||||
void tpm_register_model(enum TpmModel model);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
20
tpm.c
20
tpm.c
@ -23,13 +23,6 @@
|
|||||||
static QLIST_HEAD(, TPMBackend) tpm_backends =
|
static QLIST_HEAD(, TPMBackend) tpm_backends =
|
||||||
QLIST_HEAD_INITIALIZER(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 *
|
static const TPMBackendClass *
|
||||||
tpm_be_find_by_type(enum TpmType type)
|
tpm_be_find_by_type(enum TpmType type)
|
||||||
{
|
{
|
||||||
@ -236,18 +229,16 @@ TpmTypeList *qmp_query_tpm_types(Error **errp)
|
|||||||
|
|
||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
TpmModelList *qmp_query_tpm_models(Error **errp)
|
TpmModelList *qmp_query_tpm_models(Error **errp)
|
||||||
{
|
{
|
||||||
unsigned int i = 0;
|
|
||||||
TpmModelList *head = NULL, *prev = NULL, *cur_item;
|
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 = g_new0(TpmModelList, 1);
|
||||||
cur_item->value = i;
|
cur_item->value = c->model;
|
||||||
|
|
||||||
if (prev) {
|
if (prev) {
|
||||||
prev->next = cur_item;
|
prev->next = cur_item;
|
||||||
@ -257,6 +248,7 @@ TpmModelList *qmp_query_tpm_models(Error **errp)
|
|||||||
}
|
}
|
||||||
prev = cur_item;
|
prev = cur_item;
|
||||||
}
|
}
|
||||||
|
g_slist_free(l);
|
||||||
|
|
||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user