summaryrefslogtreecommitdiff
path: root/src/soc/mediatek/mt8173/spi.c
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2016-11-30 04:34:22 -0800
committerFurquan Shaikh <furquan@google.com>2016-12-05 03:24:38 +0100
commit0dba0254ea31eca41fdef88783f1dd192ac6fa56 (patch)
tree3c43a2ca9ff4706beb0c0df82cfd96aca75a3927 /src/soc/mediatek/mt8173/spi.c
parent52896c6c33250036928406d9dc38aa2ce1906b05 (diff)
downloadcoreboot-0dba0254ea31eca41fdef88783f1dd192ac6fa56.tar.xz
spi: Fix parameter types for spi functions
1. Use size_t instead of unsigned int for bytes_out and bytes_in. 2. Use const attribute for spi_slave structure passed into xfer, claim bus and release bus functions. BUG=chrome-os-partner:59832 BRANCH=None TEST=Compiles successfully Change-Id: Ie70b3520b51c42d750f907892545510c6058f85a Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/17682 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/soc/mediatek/mt8173/spi.c')
-rw-r--r--src/soc/mediatek/mt8173/spi.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/soc/mediatek/mt8173/spi.c b/src/soc/mediatek/mt8173/spi.c
index 9d56b63027..f60de6c32b 100644
--- a/src/soc/mediatek/mt8173/spi.c
+++ b/src/soc/mediatek/mt8173/spi.c
@@ -55,7 +55,7 @@ static struct mtk_spi_bus spi_bus[1] = {
}
};
-static inline struct mtk_spi_bus *to_mtk_spi(struct spi_slave *slave)
+static inline struct mtk_spi_bus *to_mtk_spi(const struct spi_slave *slave)
{
return container_of(slave, struct mtk_spi_bus, slave);
}
@@ -182,7 +182,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs)
};
}
-int spi_claim_bus(struct spi_slave *slave)
+int spi_claim_bus(const struct spi_slave *slave)
{
struct mtk_spi_bus *mtk_slave = to_mtk_spi(slave);
struct mtk_spi_regs *regs = mtk_slave->regs;
@@ -193,8 +193,8 @@ int spi_claim_bus(struct spi_slave *slave)
return 0;
}
-static int mtk_spi_fifo_transfer(struct spi_slave *slave, void *in,
- const void *out, u32 size)
+static int mtk_spi_fifo_transfer(const struct spi_slave *slave, void *in,
+ const void *out, size_t size)
{
struct mtk_spi_bus *mtk_slave = to_mtk_spi(slave);
struct mtk_spi_regs *regs = mtk_slave->regs;
@@ -269,10 +269,10 @@ error:
return -1;
}
-int spi_xfer(struct spi_slave *slave, const void *dout, unsigned int bytes_out,
- void *din, unsigned int bytes_in)
+int spi_xfer(const struct spi_slave *slave, const void *dout, size_t bytes_out,
+ void *din, size_t bytes_in)
{
- uint32_t min_size = 0;
+ size_t min_size = 0;
int ret;
while (bytes_out || bytes_in) {
@@ -301,7 +301,7 @@ int spi_xfer(struct spi_slave *slave, const void *dout, unsigned int bytes_out,
return 0;
}
-void spi_release_bus(struct spi_slave *slave)
+void spi_release_bus(const struct spi_slave *slave)
{
struct mtk_spi_bus *mtk_slave = to_mtk_spi(slave);
struct mtk_spi_regs *regs = mtk_slave->regs;