From 0dba0254ea31eca41fdef88783f1dd192ac6fa56 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Wed, 30 Nov 2016 04:34:22 -0800 Subject: 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 Reviewed-on: https://review.coreboot.org/17682 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/soc/intel/apollolake/spi.c | 8 ++++---- src/soc/intel/baytrail/spi.c | 8 ++++---- src/soc/intel/braswell/spi.c | 8 ++++---- src/soc/intel/broadwell/spi.c | 8 ++++---- src/soc/intel/fsp_baytrail/spi.c | 8 ++++---- src/soc/intel/fsp_broadwell_de/spi.c | 8 ++++---- src/soc/intel/skylake/flash_controller.c | 8 ++++---- 7 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src/soc/intel') diff --git a/src/soc/intel/apollolake/spi.c b/src/soc/intel/apollolake/spi.c index eab3a12eac..6e873f45c8 100644 --- a/src/soc/intel/apollolake/spi.c +++ b/src/soc/intel/apollolake/spi.c @@ -184,8 +184,8 @@ unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len) return MIN(buf_len, SPIBAR_FDATA_FIFO_SIZE); } -int spi_xfer(struct spi_slave *slave, const void *dout, - unsigned int bytesout, void *din, unsigned int bytesin) +int spi_xfer(const struct spi_slave *slave, const void *dout, + size_t bytesout, void *din, size_t bytesin) { printk(BIOS_DEBUG, "NOT IMPLEMENTED: %s() !!!\n", __func__); return E_NOT_IMPLEMENTED; @@ -215,13 +215,13 @@ void spi_init(void) pci_write_config32(ctx->pci_dev, SPIBAR_BIOS_CONTROL, bios_ctl); } -int spi_claim_bus(struct spi_slave *slave) +int spi_claim_bus(const struct spi_slave *slave) { /* There's nothing we need to to here. */ return 0; } -void spi_release_bus(struct spi_slave *slave) +void spi_release_bus(const struct spi_slave *slave) { /* No magic needed here. */ } diff --git a/src/soc/intel/baytrail/spi.c b/src/soc/intel/baytrail/spi.c index 1f2b285b93..13f88067eb 100644 --- a/src/soc/intel/baytrail/spi.c +++ b/src/soc/intel/baytrail/spi.c @@ -317,13 +317,13 @@ static void spi_init_cb(void *unused) BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_ENTRY, spi_init_cb, NULL); -int spi_claim_bus(struct spi_slave *slave) +int spi_claim_bus(const struct spi_slave *slave) { /* Handled by ICH automatically. */ return 0; } -void spi_release_bus(struct spi_slave *slave) +void spi_release_bus(const struct spi_slave *slave) { /* Handled by ICH automatically. */ } @@ -489,8 +489,8 @@ unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len) return min(cntlr.databytes, buf_len); } -int spi_xfer(struct spi_slave *slave, const void *dout, - unsigned int bytesout, void *din, unsigned int bytesin) +int spi_xfer(const struct spi_slave *slave, const void *dout, + size_t bytesout, void *din, size_t bytesin) { uint16_t control; int16_t opcode_index; diff --git a/src/soc/intel/braswell/spi.c b/src/soc/intel/braswell/spi.c index 01f215008d..34e031b1cd 100644 --- a/src/soc/intel/braswell/spi.c +++ b/src/soc/intel/braswell/spi.c @@ -296,13 +296,13 @@ static void spi_init_cb(void *unused) BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_ENTRY, spi_init_cb, NULL); -int spi_claim_bus(struct spi_slave *slave) +int spi_claim_bus(const struct spi_slave *slave) { /* Handled by ICH automatically. */ return 0; } -void spi_release_bus(struct spi_slave *slave) +void spi_release_bus(const struct spi_slave *slave) { /* Handled by ICH automatically. */ } @@ -470,8 +470,8 @@ unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len) return min(cntlr.databytes, buf_len); } -int spi_xfer(struct spi_slave *slave, const void *dout, - unsigned int bytesout, void *din, unsigned int bytesin) +int spi_xfer(const struct spi_slave *slave, const void *dout, + size_t bytesout, void *din, size_t bytesin) { uint16_t control; int16_t opcode_index; diff --git a/src/soc/intel/broadwell/spi.c b/src/soc/intel/broadwell/spi.c index c7ac09c7de..6aa7dd33a8 100644 --- a/src/soc/intel/broadwell/spi.c +++ b/src/soc/intel/broadwell/spi.c @@ -313,13 +313,13 @@ static void spi_init_cb(void *unused) BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_ENTRY, spi_init_cb, NULL); -int spi_claim_bus(struct spi_slave *slave) +int spi_claim_bus(const struct spi_slave *slave) { /* Handled by ICH automatically. */ return 0; } -void spi_release_bus(struct spi_slave *slave) +void spi_release_bus(const struct spi_slave *slave) { /* Handled by ICH automatically. */ } @@ -485,8 +485,8 @@ unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len) return min(cntlr.databytes, buf_len); } -int spi_xfer(struct spi_slave *slave, const void *dout, - unsigned int bytesout, void *din, unsigned int bytesin) +int spi_xfer(const struct spi_slave *slave, const void *dout, + size_t bytesout, void *din, size_t bytesin) { uint16_t control; int16_t opcode_index; diff --git a/src/soc/intel/fsp_baytrail/spi.c b/src/soc/intel/fsp_baytrail/spi.c index 1ab73f3ae3..232366c63b 100644 --- a/src/soc/intel/fsp_baytrail/spi.c +++ b/src/soc/intel/fsp_baytrail/spi.c @@ -297,13 +297,13 @@ void spi_init(void) cntlr.preop = &ich9_spi->preop; } -int spi_claim_bus(struct spi_slave *slave) +int spi_claim_bus(const struct spi_slave *slave) { /* Handled by ICH automatically. */ return 0; } -void spi_release_bus(struct spi_slave *slave) +void spi_release_bus(const struct spi_slave *slave) { /* Handled by ICH automatically. */ } @@ -469,8 +469,8 @@ unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len) return min(cntlr.databytes, buf_len); } -int spi_xfer(struct spi_slave *slave, const void *dout, - unsigned int bytesout, void *din, unsigned int bytesin) +int spi_xfer(const struct spi_slave *slave, const void *dout, + size_t bytesout, void *din, size_t bytesin) { uint16_t control; int16_t opcode_index; diff --git a/src/soc/intel/fsp_broadwell_de/spi.c b/src/soc/intel/fsp_broadwell_de/spi.c index 116001f010..c38fbce7b7 100644 --- a/src/soc/intel/fsp_broadwell_de/spi.c +++ b/src/soc/intel/fsp_broadwell_de/spi.c @@ -312,13 +312,13 @@ void spi_init(void) pci_write_config_byte(dev, 0xdc, bios_cntl | 0x1); } -int spi_claim_bus(struct spi_slave *slave) +int spi_claim_bus(const struct spi_slave *slave) { /* Handled by ICH automatically. */ return 0; } -void spi_release_bus(struct spi_slave *slave) +void spi_release_bus(const struct spi_slave *slave) { /* Handled by ICH automatically. */ } @@ -484,8 +484,8 @@ unsigned int spi_crop_chunk(unsigned int cmd_len, unsigned int buf_len) return min(cntlr.databytes, buf_len); } -int spi_xfer(struct spi_slave *slave, const void *dout, - unsigned int bytesout, void *din, unsigned int bytesin) +int spi_xfer(const struct spi_slave *slave, const void *dout, + size_t bytesout, void *din, size_t bytesin) { uint16_t control; int16_t opcode_index; diff --git a/src/soc/intel/skylake/flash_controller.c b/src/soc/intel/skylake/flash_controller.c index cc6c20a4be..8aee796218 100644 --- a/src/soc/intel/skylake/flash_controller.c +++ b/src/soc/intel/skylake/flash_controller.c @@ -151,8 +151,8 @@ static size_t spi_get_flash_size(pch_spi_regs *spi_bar) return size; } -int spi_xfer(struct spi_slave *slave, const void *dout, - unsigned int bytesout, void *din, unsigned int bytesin) +int spi_xfer(const struct spi_slave *slave, const void *dout, + size_t bytesout, void *din, size_t bytesin) { /* TODO: Define xfer for hardware sequencing. */ return -1; @@ -170,13 +170,13 @@ void spi_init(void) pci_write_config_byte(dev, SPIBAR_BIOS_CNTL, bios_cntl); } -int spi_claim_bus(struct spi_slave *slave) +int spi_claim_bus(const struct spi_slave *slave) { /* Handled by PCH automatically. */ return 0; } -void spi_release_bus(struct spi_slave *slave) +void spi_release_bus(const struct spi_slave *slave) { /* Handled by PCH automatically. */ } -- cgit v1.2.3