]> www.infradead.org Git - qemu-nvme.git/commitdiff
sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined
authorStefan Berger <stefanb@linux.ibm.com>
Tue, 15 Jun 2021 14:21:20 +0000 (16:21 +0200)
committerStefan Berger <stefanb@linux.ibm.com>
Tue, 15 Jun 2021 14:55:12 +0000 (10:55 -0400)
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210614191335.1968807-5-stefanb@linux.ibm.com>
[PMD: Remove tpm_init() / tpm_cleanup() stubs]
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
include/sysemu/tpm.h
include/sysemu/tpm_backend.h
stubs/tpm.c

index 1a85564e479deda8af0996c06a4175f57b2162c3..68b2206463c5054a6aac8ff30b876c2ef09dd594 100644 (file)
@@ -15,6 +15,8 @@
 #include "qapi/qapi-types-tpm.h"
 #include "qom/object.h"
 
+#ifdef CONFIG_TPM
+
 int tpm_config_parse(QemuOptsList *opts_list, const char *optarg);
 int tpm_init(void);
 void tpm_cleanup(void);
@@ -73,4 +75,11 @@ static inline TPMVersion tpm_get_version(TPMIf *ti)
     return TPM_IF_GET_CLASS(ti)->get_version(ti);
 }
 
+#else /* CONFIG_TPM */
+
+#define tpm_init()  (0)
+#define tpm_cleanup()
+
+#endif /* CONFIG_TPM */
+
 #endif /* QEMU_TPM_H */
index 6f078f5f4829ff55af09b87aa48ddbe38a1ce2f1..8fd3269c1178ae0ad255b4b73b8c43226bd51fad 100644 (file)
@@ -18,6 +18,8 @@
 #include "sysemu/tpm.h"
 #include "qapi/error.h"
 
+#ifdef CONFIG_TPM
+
 #define TYPE_TPM_BACKEND "tpm-backend"
 OBJECT_DECLARE_TYPE(TPMBackend, TPMBackendClass,
                     TPM_BACKEND)
@@ -209,4 +211,6 @@ TPMInfo *tpm_backend_query_tpm(TPMBackend *s);
 
 TPMBackend *qemu_find_tpm_be(const char *id);
 
-#endif
+#endif /* CONFIG_TPM */
+
+#endif /* TPM_BACKEND_H */
index 22014595a06ef63b85dc85251b0e67428cf76583..e79bd2a6c2dd86ef1d56cc54c36ceec3c95b9852 100644 (file)
@@ -7,18 +7,8 @@
 
 #include "qemu/osdep.h"
 #include "qapi/qapi-commands-tpm.h"
-#include "sysemu/tpm.h"
 #include "hw/acpi/tpm.h"
 
-int tpm_init(void)
-{
-    return 0;
-}
-
-void tpm_cleanup(void)
-{
-}
-
 TPMInfoList *qmp_query_tpm(Error **errp)
 {
     return NULL;