From 00afec5af0149caee0592dfd75aa42a7cfa87104 Mon Sep 17 00:00:00 2001
From: Anders Roxell <anders.roxell@linaro.org>
Date: Fri, 8 Feb 2019 08:41:46 +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'.

Rework so TPM_BUFSIZE are defined in drivers/char/tpm/tpm.h.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 drivers/char/tpm/tpm.h              | 7 ++++++-
 drivers/char/tpm/tpm_i2c_infineon.c | 3 ---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 2cce072f25b5..0d165d91b2c2 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -38,7 +38,12 @@
 #endif
 
 #define TPM_MINOR		224	/* officially assigned */
-#define TPM_BUFSIZE		4096
+#ifdef CONFIG_TCG_TIS_I2C_INFINEON
+/* max. buffer size supported by our TPM */
+# define TPM_BUFSIZE		1260
+#else
+# define TPM_BUFSIZE		4096
+#endif
 #define TPM_NUM_DEVICES		65536
 #define TPM_RETRY		50
 
diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c
index 9086edc9066b..804ca4e2cc9d 100644
--- a/drivers/char/tpm/tpm_i2c_infineon.c
+++ b/drivers/char/tpm/tpm_i2c_infineon.c
@@ -26,9 +26,6 @@
 #include <linux/wait.h>
 #include "tpm.h"
 
-/* max. buffer size supported by our TPM */
-#define TPM_BUFSIZE 1260
-
 /* max. number of iterations after I2C NAK */
 #define MAX_COUNT 3
 
-- 
2.20.1

