diff mbox series

[RFC,V1,3/3] sysemu: Make TPM structures inaccessible if CONFIG_TPM is not defined

Message ID 20210612012102.1820063-4-stefanb@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series tpm: Eliminate TPM related code if CONFIG_TPM is not set | expand

Commit Message

Stefan Berger June 12, 2021, 1:21 a.m. UTC
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
 include/sysemu/tpm.h         | 6 +++++-
 include/sysemu/tpm_backend.h | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé June 14, 2021, 9:46 a.m. UTC | #1
On 6/12/21 3:21 AM, Stefan Berger wrote:
> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
> ---
>  include/sysemu/tpm.h         | 6 +++++-
>  include/sysemu/tpm_backend.h | 6 +++++-
>  2 files changed, 10 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
diff mbox series

Patch

diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
index 1a85564e47..2ca3fa32ee 100644
--- a/include/sysemu/tpm.h
+++ b/include/sysemu/tpm.h
@@ -15,10 +15,12 @@ 
 #include "qapi/qapi-types-tpm.h"
 #include "qom/object.h"
 
-int tpm_config_parse(QemuOptsList *opts_list, const char *optarg);
 int tpm_init(void);
 void tpm_cleanup(void);
 
+#ifdef CONFIG_TPM
+int tpm_config_parse(QemuOptsList *opts_list, const char *optarg);
+
 typedef enum TPMVersion {
     TPM_VERSION_UNSPEC = 0,
     TPM_VERSION_1_2 = 1,
@@ -73,4 +75,6 @@  static inline TPMVersion tpm_get_version(TPMIf *ti)
     return TPM_IF_GET_CLASS(ti)->get_version(ti);
 }
 
+#endif /* CONFIG_TPM */
+
 #endif /* QEMU_TPM_H */
diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
index 6f078f5f48..8fd3269c11 100644
--- a/include/sysemu/tpm_backend.h
+++ b/include/sysemu/tpm_backend.h
@@ -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 */