aboutsummaryrefslogtreecommitdiff
path: root/hw/tpm/tpm_emulator.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-10-10 00:55:49 +0200
committerStefan Berger <stefanb@linux.vnet.ibm.com>2017-10-19 11:42:23 -0400
commitd31076ba75d4239928282143efd30d08730c8845 (patch)
treef92f2182a095cd749861b0858689346abacb26c9 /hw/tpm/tpm_emulator.c
parentcfab6da8a7d3e9d825ea284a0ebbf6579e204f74 (diff)
tpm: remove TPMDriverOps
Use TPMBackendClass to hold class methods/fields. 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>
Diffstat (limited to 'hw/tpm/tpm_emulator.c')
-rw-r--r--hw/tpm/tpm_emulator.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/hw/tpm/tpm_emulator.c b/hw/tpm/tpm_emulator.c
index 187a69e442..03ea5845db 100644
--- a/hw/tpm/tpm_emulator.c
+++ b/hw/tpm/tpm_emulator.c
@@ -60,8 +60,6 @@
#define TPM_EMULATOR_IMPLEMENTS_ALL_CAPS(S, cap) (((S)->caps & (cap)) == (cap))
-static const TPMDriverOps tpm_emulator_driver;
-
/* data structures */
typedef struct TPMEmulator {
TPMBackend parent;
@@ -504,20 +502,6 @@ static const QemuOptDesc tpm_emulator_cmdline_opts[] = {
{ /* end of list */ },
};
-static const TPMDriverOps tpm_emulator_driver = {
- .type = TPM_TYPE_EMULATOR,
- .opts = tpm_emulator_cmdline_opts,
- .desc = "TPM emulator backend driver",
-
- .create = tpm_emulator_create,
- .startup_tpm = tpm_emulator_startup_tpm,
- .cancel_cmd = tpm_emulator_cancel_cmd,
- .get_tpm_established_flag = tpm_emulator_get_tpm_established_flag,
- .reset_tpm_established_flag = tpm_emulator_reset_tpm_established_flag,
- .get_tpm_version = tpm_emulator_get_tpm_version,
- .get_tpm_options = tpm_emulator_get_tpm_options,
-};
-
static void tpm_emulator_inst_init(Object *obj)
{
TPMEmulator *tpm_emu = TPM_EMULATOR(obj);
@@ -565,7 +549,18 @@ static void tpm_emulator_inst_finalize(Object *obj)
static void tpm_emulator_class_init(ObjectClass *klass, void *data)
{
TPMBackendClass *tbc = TPM_BACKEND_CLASS(klass);
- tbc->ops = &tpm_emulator_driver;
+
+ tbc->type = TPM_TYPE_EMULATOR;
+ tbc->opts = tpm_emulator_cmdline_opts;
+ tbc->desc = "TPM emulator backend driver";
+ tbc->create = tpm_emulator_create;
+ tbc->startup_tpm = tpm_emulator_startup_tpm;
+ tbc->cancel_cmd = tpm_emulator_cancel_cmd;
+ tbc->get_tpm_established_flag = tpm_emulator_get_tpm_established_flag;
+ tbc->reset_tpm_established_flag = tpm_emulator_reset_tpm_established_flag;
+ tbc->get_tpm_version = tpm_emulator_get_tpm_version;
+ tbc->get_tpm_options = tpm_emulator_get_tpm_options;
+
tbc->handle_request = tpm_emulator_handle_request;
}