From ac2c17ff7989380e1f0bc3a8333469804712a464 Mon Sep 17 00:00:00 2001
From: Anders Roxell <anders.roxell@linaro.org>
Date: Fri, 8 Feb 2019 12:23:09 +0100
Subject: [PATCH 2/2] tpm: fix warning TPM_RETRY redefined

Commit 569c1057f9ac ("tpm: move tpm_chip definition to
include/linux/tpm.h") introduced a 'warning: "TPM_RETRY" redefined'.

../drivers/char/tpm/tpm_i2c_nuvoton.c:45: warning: "TPM_RETRY" redefined
 #define TPM_RETRY      5

In file included from ../drivers/char/tpm/tpm_i2c_nuvoton.c:35:
../drivers/char/tpm/tpm.h:42: note: this is the location of the previous definition
 #define TPM_RETRY  50

Rework so TPM_RETRY are defined in each driver, so that the
TPM_RETRY still can be different in different drivers.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 drivers/char/tpm/tpm-dev.h        | 2 +-
 drivers/char/tpm/tpm-interface.c  | 2 +-
 drivers/char/tpm/tpm.h            | 1 -
 drivers/char/tpm/tpm1-cmd.c       | 1 +
 drivers/char/tpm/tpm_vtpm_proxy.c | 1 +
 drivers/char/tpm/tpmrm-dev.c      | 2 ++
 6 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/char/tpm/tpm-dev.h b/drivers/char/tpm/tpm-dev.h
index c5c21d7e3f76..b7e85d648c18 100644
--- a/drivers/char/tpm/tpm-dev.h
+++ b/drivers/char/tpm/tpm-dev.h
@@ -5,7 +5,7 @@
 #include <linux/poll.h>
 #include "tpm.h"
 
-#define TPM_BUFSIZE		4096
+#define TPM_BUFSIZE	4096
 
 struct file_priv {
 	struct tpm_chip *chip;
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 746f44452d51..53b9afdde7cf 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -33,7 +33,7 @@
 
 #include "tpm.h"
 
-#define TPM_BUFSIZE		4096
+#define TPM_BUFSIZE	4096
 
 /*
  * Bug workaround - some TPM's don't flush the most
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 1fd9b3fb465a..6f9105f175d4 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -39,7 +39,6 @@
 
 #define TPM_MINOR		224	/* officially assigned */
 #define TPM_NUM_DEVICES		65536
-#define TPM_RETRY		50
 
 enum tpm_timeout {
 	TPM_TIMEOUT = 5,	/* msecs */
diff --git a/drivers/char/tpm/tpm1-cmd.c b/drivers/char/tpm/tpm1-cmd.c
index 85dcf2654d11..fdaeb9d35ab3 100644
--- a/drivers/char/tpm/tpm1-cmd.c
+++ b/drivers/char/tpm/tpm1-cmd.c
@@ -22,6 +22,7 @@
 
 #include "tpm.h"
 
+#define TPM_RETRY	50
 #define TPM_MAX_ORDINAL 243
 
 /*
diff --git a/drivers/char/tpm/tpm_vtpm_proxy.c b/drivers/char/tpm/tpm_vtpm_proxy.c
index 26a2be555288..4bbda610a082 100644
--- a/drivers/char/tpm/tpm_vtpm_proxy.c
+++ b/drivers/char/tpm/tpm_vtpm_proxy.c
@@ -28,6 +28,7 @@
 
 #include "tpm.h"
 
+#define TPM_BUFSIZE	4096
 #define VTPM_PROXY_REQ_COMPLETE_FLAG  BIT(0)
 
 struct proxy_dev {
diff --git a/drivers/char/tpm/tpmrm-dev.c b/drivers/char/tpm/tpmrm-dev.c
index 0c751a79bbed..4603aba39d12 100644
--- a/drivers/char/tpm/tpmrm-dev.c
+++ b/drivers/char/tpm/tpmrm-dev.c
@@ -6,6 +6,8 @@
 #include <linux/slab.h>
 #include "tpm-dev.h"
 
+#define TPM_RETRY	50
+
 struct tpmrm_priv {
 	struct file_priv priv;
 	struct tpm_space space;
-- 
2.20.1

