diff mbox

[1/2] tpm: remove code duplication

Message ID 1406720068-16482-2-git-send-email-mst@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin July 30, 2014, 11:34 a.m. UTC
Move TYPE_TPM_TIS to tpm.h so it can be used
by an inline function there.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/tpm/tpm_tis.h     | 3 ---
 include/sysemu/tpm.h | 4 +++-
 2 files changed, 3 insertions(+), 4 deletions(-)

Comments

Stefan Berger July 30, 2014, 1:37 p.m. UTC | #1
On 07/30/2014 07:34 AM, Michael S. Tsirkin wrote:
> Move TYPE_TPM_TIS to tpm.h so it can be used
> by an inline function there.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>   hw/tpm/tpm_tis.h     | 3 ---
>   include/sysemu/tpm.h | 4 +++-
>   2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h
> index 6cdac24..1a0db23 100644
> --- a/hw/tpm/tpm_tis.h
> +++ b/hw/tpm/tpm_tis.h
> @@ -29,9 +29,6 @@
>
>   #define TPM_TIS_BUFFER_MAX          4096
>
> -#define TYPE_TPM_TIS                "tpm-tis"
> -
> -
>   typedef enum {
>       TPM_TIS_STATE_IDLE = 0,
>       TPM_TIS_STATE_READY,
> diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
> index 7030109..9b81ce9 100644
> --- a/include/sysemu/tpm.h
> +++ b/include/sysemu/tpm.h
> @@ -20,9 +20,11 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg);
>   int tpm_init(void);
>   void tpm_cleanup(void);
>
> +#define TYPE_TPM_TIS                "tpm-tis"
> +
>   static inline bool tpm_find(void)
>   {
> -    return object_resolve_path_type("", "tpm-tis", NULL) != NULL;
> +    return object_resolve_path_type("", TYPE_TPM_TIS, NULL);
>   }
>
>   #endif /* QEMU_TPM_H */

ACK
diff mbox

Patch

diff --git a/hw/tpm/tpm_tis.h b/hw/tpm/tpm_tis.h
index 6cdac24..1a0db23 100644
--- a/hw/tpm/tpm_tis.h
+++ b/hw/tpm/tpm_tis.h
@@ -29,9 +29,6 @@ 
 
 #define TPM_TIS_BUFFER_MAX          4096
 
-#define TYPE_TPM_TIS                "tpm-tis"
-
-
 typedef enum {
     TPM_TIS_STATE_IDLE = 0,
     TPM_TIS_STATE_READY,
diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
index 7030109..9b81ce9 100644
--- a/include/sysemu/tpm.h
+++ b/include/sysemu/tpm.h
@@ -20,9 +20,11 @@  int tpm_config_parse(QemuOptsList *opts_list, const char *optarg);
 int tpm_init(void);
 void tpm_cleanup(void);
 
+#define TYPE_TPM_TIS                "tpm-tis"
+
 static inline bool tpm_find(void)
 {
-    return object_resolve_path_type("", "tpm-tis", NULL) != NULL;
+    return object_resolve_path_type("", TYPE_TPM_TIS, NULL);
 }
 
 #endif /* QEMU_TPM_H */