aboutsummaryrefslogtreecommitdiff
path: root/hw/tpm
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
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')
-rw-r--r--hw/tpm/tpm_emulator.c29
-rw-r--r--hw/tpm/tpm_passthrough.c25
2 files changed, 23 insertions, 31 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;
}
diff --git a/hw/tpm/tpm_passthrough.c b/hw/tpm/tpm_passthrough.c
index f04eab3e63..d9da99bc8e 100644
--- a/hw/tpm/tpm_passthrough.c
+++ b/hw/tpm/tpm_passthrough.c
@@ -365,19 +365,6 @@ static const QemuOptDesc tpm_passthrough_cmdline_opts[] = {
{ /* end of list */ },
};
-static const TPMDriverOps tpm_passthrough_driver = {
- .type = TPM_TYPE_PASSTHROUGH,
- .opts = tpm_passthrough_cmdline_opts,
- .desc = "Passthrough TPM backend driver",
- .create = tpm_passthrough_create,
- .reset = tpm_passthrough_reset,
- .cancel_cmd = tpm_passthrough_cancel_cmd,
- .get_tpm_established_flag = tpm_passthrough_get_tpm_established_flag,
- .reset_tpm_established_flag = tpm_passthrough_reset_tpm_established_flag,
- .get_tpm_version = tpm_passthrough_get_tpm_version,
- .get_tpm_options = tpm_passthrough_get_tpm_options,
-};
-
static void tpm_passthrough_inst_init(Object *obj)
{
TPMPassthruState *tpm_pt = TPM_PASSTHROUGH(obj);
@@ -402,7 +389,17 @@ static void tpm_passthrough_class_init(ObjectClass *klass, void *data)
{
TPMBackendClass *tbc = TPM_BACKEND_CLASS(klass);
- tbc->ops = &tpm_passthrough_driver;
+ tbc->type = TPM_TYPE_PASSTHROUGH;
+ tbc->opts = tpm_passthrough_cmdline_opts;
+ tbc->desc = "Passthrough TPM backend driver";
+ tbc->create = tpm_passthrough_create;
+ tbc->reset = tpm_passthrough_reset;
+ tbc->cancel_cmd = tpm_passthrough_cancel_cmd;
+ tbc->get_tpm_established_flag = tpm_passthrough_get_tpm_established_flag;
+ tbc->reset_tpm_established_flag =
+ tpm_passthrough_reset_tpm_established_flag;
+ tbc->get_tpm_version = tpm_passthrough_get_tpm_version;
+ tbc->get_tpm_options = tpm_passthrough_get_tpm_options;
tbc->handle_request = tpm_passthrough_handle_request;
}