[PATCH 4/5] tpm: tpm_tis: make functions available for external linkage
From: Lino Sanfilippo
Date: Thu Apr 07 2022 - 07:20:07 EST
The tpm_tis_phy_ops functions tpm_tis_spi_read16, tpm_tis_spi_read32 and
tpm_tis_spi_write32 are already declared extern to be used outside of
tpm_tim_spi_main.c.
Do the same with tpm_tis_spi_read_bytes and tpm_tis_spi_write_bytes to
allow the external access to the complete set of tpm_tis_phy_ops.
This is in preparation of the assignment of SLB9670 specific phy ops in a
separate file.
Furthermore declare tpm_tis_spi_flow_control extern, so that we can use it
in a SLB9670 specific probe function in the same file.
Signed-off-by: Lino Sanfilippo <LinoSanfilippo@xxxxxx>
---
drivers/char/tpm/tpm_tis_spi.h | 7 +++++++
drivers/char/tpm/tpm_tis_spi_main.c | 12 ++++++------
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/char/tpm/tpm_tis_spi.h b/drivers/char/tpm/tpm_tis_spi.h
index bba73979c368..8f4331d8a4dd 100644
--- a/drivers/char/tpm/tpm_tis_spi.h
+++ b/drivers/char/tpm/tpm_tis_spi.h
@@ -25,6 +25,9 @@ static inline struct tpm_tis_spi_phy *to_tpm_tis_spi_phy(struct tpm_tis_data *da
return container_of(data, struct tpm_tis_spi_phy, priv);
}
+extern int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy,
+ struct spi_transfer *spi_xfer);
+
extern int tpm_tis_spi_init(struct spi_device *spi, struct tpm_tis_spi_phy *phy,
int irq, const struct tpm_tis_phy_ops *phy_ops);
@@ -34,6 +37,10 @@ extern int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
extern int tpm_tis_spi_read16(struct tpm_tis_data *data, u32 addr, u16 *result);
extern int tpm_tis_spi_read32(struct tpm_tis_data *data, u32 addr, u32 *result);
extern int tpm_tis_spi_write32(struct tpm_tis_data *data, u32 addr, u32 value);
+extern int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
+ u8 *result);
+extern int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
+ const u8 *value);
#ifdef CONFIG_TCG_TIS_SPI_CR50
extern int cr50_spi_probe(struct spi_device *spi);
diff --git a/drivers/char/tpm/tpm_tis_spi_main.c b/drivers/char/tpm/tpm_tis_spi_main.c
index 184396b3af50..b2d13b844659 100644
--- a/drivers/char/tpm/tpm_tis_spi_main.c
+++ b/drivers/char/tpm/tpm_tis_spi_main.c
@@ -45,8 +45,8 @@
*
* [1] https://trustedcomputinggroup.org/resource/pc-client-platform-tpm-profile-ptp-specification/
*/
-static int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy,
- struct spi_transfer *spi_xfer)
+int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy,
+ struct spi_transfer *spi_xfer)
{
struct spi_message m;
int ret, i;
@@ -140,14 +140,14 @@ int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
return ret;
}
-static int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr,
- u16 len, u8 *result)
+int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
+ u8 *result)
{
return tpm_tis_spi_transfer(data, addr, len, result, NULL);
}
-static int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr,
- u16 len, const u8 *value)
+int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
+ const u8 *value)
{
return tpm_tis_spi_transfer(data, addr, len, NULL, value);
}
--
2.35.1