From 7a016781dd7b1e0754378bde3f0fbb05ddb65d28 Mon Sep 17 00:00:00 2001
From: Anders Roxell <anders.roxell@linaro.org>
Date: Fri, 8 Feb 2019 12:01:13 +0100
Subject: [PATCH] tpm: fix warning TPM_BUFSIZE redifined

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

../drivers/char/tpm/tpm_i2c_infineon.c:30: warning: "TPM_BUFSIZE" redefined
 #define TPM_BUFSIZE 1260

In file included from ../drivers/char/tpm/tpm_i2c_infineon.c:27:
../drivers/char/tpm/tpm.h:41: note: this is the location of the previous definition
 #define TPM_BUFSIZE  4096

Rework so TPM_BUFSIZE are defined in each driver, so that the
TPM_BUFSIZE 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 -
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm-dev.h b/drivers/char/tpm/tpm-dev.h
index 1089fc0bb290..c5c21d7e3f76 100644
--- a/drivers/char/tpm/tpm-dev.h
+++ b/drivers/char/tpm/tpm-dev.h
@@ -5,6 +5,8 @@
 #include <linux/poll.h>
 #include "tpm.h"
 
+#define TPM_BUFSIZE		4096
+
 struct file_priv {
 	struct tpm_chip *chip;
 	struct tpm_space *space;
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 02e8cffd1163..746f44452d51 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -33,6 +33,8 @@
 
 #include "tpm.h"
 
+#define TPM_BUFSIZE		4096
+
 /*
  * Bug workaround - some TPM's don't flush the most
  * recently changed pcr on suspend, so force the flush
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 2cce072f25b5..1fd9b3fb465a 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -38,7 +38,6 @@
 #endif
 
 #define TPM_MINOR		224	/* officially assigned */
-#define TPM_BUFSIZE		4096
 #define TPM_NUM_DEVICES		65536
 #define TPM_RETRY		50
 
-- 
2.20.1

