tpm: Fix some name collisions with drivers/char/tpm.h
Subsystems (4)
PATCH v3 1/1 tpm: Fix some name collisions with drivers/char/tpm.h
* Rename TPM_BUFSIZE defined in drivers/char/tpm/st33zp24/st33zp24.h to ST33ZP24_BUFSIZE.
* Rename TPM_BUFSIZE defined in drivers/char/tpm/tpm_i2c_infineon.c to TPM_I2C_INFINEON_BUFSIZE.
* Rename TPM_RETRY in tpm_i2c_nuvoton to TPM_I2C_RETRIES.
* Remove TPM_HEADER_SIZE from tpm_i2c_nuvoton.
---
v3:
* Fix two name collisions in tpm_i2c_nuvoton.
* Fix short summary.
* Fix compilation error in tpm_i2c_infineon (forgot to stage one diff to v2).
v2:
* Fix also the name collision in tpm_ic2_infineon.
drivers/char/tpm/st33zp24/i2c.c | 2 +- drivers/char/tpm/st33zp24/spi.c | 2 +- drivers/char/tpm/st33zp24/st33zp24.h | 4 ++-- drivers/char/tpm/tpm_i2c_infineon.c | 15 ++++++++------- drivers/char/tpm/tpm_i2c_nuvoton.c | 16 +++++++--------- 5 files changed, 19 insertions(+), 20 deletions(-)
drivers/char/tpm/st33zp24/i2c.c +1 -1
@@ -33,7 +33,7 @@struct st33zp24_i2c_phy {struct i2c_client *client; -u8 buf[TPM_BUFSIZE +1 ]; +u8 buf[ST33ZP24_BUFSIZE +1 ];int io_lpcpd; };
drivers/char/tpm/st33zp24/spi.c +1 -1
@@ -63,7 +63,7 @@* some latency byte before the answer is available (max 15). * We have 2048 + 1024 + 15. */ -#define ST33ZP24_SPI_BUFFER_SIZE (TPM_BUFSIZE + (TPM_BUFSIZE / 2) +\ +#define ST33ZP24_SPI_BUFFER_SIZE (ST33ZP24_BUFSIZE + (ST33ZP24_BUFSIZE / 2) +\ MAX_SPI_LATENCY)
drivers/char/tpm/st33zp24/st33zp24.h +2 -2
@@ -18,8 +18,8 @@ #ifndef __LOCAL_ST33ZP24_H__ #define __LOCAL_ST33ZP24_H__ -#define TPM_WRITE_DIRECTION 0x80 -#define TPM_BUFSIZE 2048 +#define TPM_WRITE_DIRECTION 0x80 +#define ST33ZP24_BUFSIZE 2048 struct st33zp24_dev { struct tpm_chip *chip;
drivers/char/tpm/tpm_i2c_infineon.c +8 -7
@@ -26,8 +26,7 @@#include <linux/wait.h> #include "tpm.h" -/* max. buffer size supported by our TPM */ -#define TPM_BUFSIZE 1260 +#define TPM_I2C_INFINEON_BUFSIZE 1260/* max. number of iterations after I2C NAK */ #define MAX_COUNT 3
@@ -63,11 +62,13 @@ enum i2c_chip_type { UNKNOWN, }; -/* Structure to store I2C TPM specific stuff */ struct tpm_inf_dev {struct i2c_client *client;int locality; -u8 buf[TPM_BUFSIZE +sizeof (u8)];/* max. buffer size + addr */ +/* In addition to the data itself, the buffer must fit the 7-bit I2C +* address and the direction bit. +*/ +u8 buf[TPM_I2C_INFINEON_BUFSIZE +1 ];struct tpm_chip *chip;enum i2c_chip_type chip_type;unsigned int adapterlimit;
@@ -219,7 +220,7 @@ static int iic_tpm_write_generic(u8 addr, u8 *buffer, size_t len, .buf = tpm_dev.buf }; -if (len >TPM_BUFSIZE ) +if (len >TPM_I2C_INFINEON_BUFSIZE )return -EINVAL ;if (!tpm_dev.client->adapter->algo->master_xfer)
@@ -527,8 +528,8 @@ static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len)u8 retries =0 ;u8 sts =TPM_STS_GO ; -if (len >TPM_BUFSIZE ) -return -E2BIG ;/* command is too long for our tpm, sorry */ +if (len >TPM_I2C_INFINEON_BUFSIZE ) +return -E2BIG ;if (request_locality (chip,0 ) <0 )return -EBUSY ;
drivers/char/tpm/tpm_i2c_nuvoton.c +7 -9
@@ -35,14 +35,12 @@#include "tpm.h" /* I2C interface offsets */ -#define TPM_STS 0x00 -#define TPM_BURST_COUNT 0x01 -#define TPM_DATA_FIFO_W 0x20 -#define TPM_DATA_FIFO_R 0x40 -#define TPM_VID_DID_RID 0x60 -/* TPM command header size */ -#define TPM_HEADER_SIZE 10 -#define TPM_RETRY 5 +#define TPM_STS 0x00 +#define TPM_BURST_COUNT 0x01 +#define TPM_DATA_FIFO_W 0x20 +#define TPM_DATA_FIFO_R 0x40 +#define TPM_VID_DID_RID 0x60 +#define TPM_I2C_RETRIES 5/* * I2C bus device maximum buffer size w/o counting I2C address or command * i.e. max size required for I2C write is 34 = addr, command, 32 bytes data
@@ -292,7 +290,7 @@ static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count)dev_err (dev,"%s() count < header size\n" , __func__);return -EIO ; } -for (retries =0 ; retries <TPM_RETRY ; retries++) { +for (retries =0 ; retries <TPM_I2C_RETRIES ; retries++) {if (retries >0 ) {/* if this is not the first trial, set responseRetry */ i2c_nuvoton_write_status(client,
Signature · 1 line
2.19.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 31 lines · Sasha Levin
Hi,
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag,
fixing commit:bf38b8710892tpm/tpm_i2c_stm_st33: Splittpm_i2c_tpm_st33in 2 layers (core + phy).The bot has tested the following trees: v4.20.6, v4.19.19, v4.14.97, v4.9.154, v4.4.172.
v4.20.6: Build OK!
v4.19.19: Build OK!
v4.14.97: Build OK!
v4.9.154: Build OK!
v4.4.172: Failed to apply! Possible dependencies:
036bb38ffb3e("tpm_tis: Ensure interrupts are disabled when the driver starts")23d06ff700f5("tpm: droptpm_atmelspecific fields fromtpm_vendor_specific")25112048cd59("tpm: reworktpm_get_timeouts()")
4d627e672bd0("tpm_tis: Do not fall back to a hardcoded address for TPM2")4eea703caaac("tpm: drop 'iobase' from structtpm_vendor_specific")51dd43dff74b("tpm_tis: Usedevm_ioremap_resource")
55a889c2cb13("tpm_crb: Use the common ACPI definition of structacpi_tpm2")56671c893e0e("tpm: drop 'locality' from structtpm_vendor_specific")570a36097f30("tpm: drop 'irq' from structtpm_vendor_specific")7ab4032fa579("tpm_tis: Get rid of the duplicate IRQ probing code")d30b8e4f68ef("tpm: cleanuptpm_tis_remove()")
d4956524f1b0("tpm: dropmanufacturer_idfrom structtpm_vendor_specific")e3837e74a06d("tpm_tis: Refactor the interrupt setup")ee1779840d09("tpm: drop 'base' from structtpm_vendor_specific")ef7b81dc7864("tpm_tis: Disable interrupt auto probing on a per-device basis")
Quoted 1 line
How should we proceed with this patch?
I'll look into this next week.
/Jarkko