From f5dd07d5a9229d2cf42dff8ca9abda7d6c3ab3c1 Mon Sep 17 00:00:00 2001 From: Heesub Shin Date: Tue, 4 Apr 2017 13:29:37 +0900 Subject: [PATCH] spi: iotbus: fix mismatched prototype declarations SPI operations .setmode and .setbits return void. Every callsites that expect those will return an integer should be fixed also. Change-Id: I1ee20d89f2777b193e5eac3831f9e3c004868209 Signed-off-by: Heesub Shin --- framework/src/iotbus/iotbus_spi.c | 18 +++--------------- os/include/tinyara/spi/spi.h | 4 ++-- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/framework/src/iotbus/iotbus_spi.c b/framework/src/iotbus/iotbus_spi.c index 304f73e..3a31134 100644 --- a/framework/src/iotbus/iotbus_spi.c +++ b/framework/src/iotbus/iotbus_spi.c @@ -79,7 +79,6 @@ iotbus_spi_context_h iotbus_spi_open(unsigned int bus, const struct iotbus_spi_c if (!dev) return NULL; - int ret; struct _iotbus_spi_s *handle = (struct _iotbus_spi_s *)malloc(sizeof(struct _iotbus_spi_s)); handle->bpw = config->bits_per_word; handle->lsb = config->lsb; @@ -90,24 +89,13 @@ iotbus_spi_context_h iotbus_spi_open(unsigned int bus, const struct iotbus_spi_c handle->sdev = dev; SPI_LOCK(dev, true); - ret = SPI_SETMODE(dev, handle->mode); - if (ret < 0) { - SPI_LOCK(dev, false); - free(handle); - return NULL; - } + SPI_SETMODE(dev, handle->mode); if (handle->lsb == 0) // MSB - ret = SPI_SETBITS(dev, handle->bpw); + SPI_SETBITS(dev, handle->bpw); else // LSB - ret = SPI_SETBITS(dev, -handle->bpw); - - if (ret < 0) { - SPI_LOCK(dev, false); - free(handle); - return NULL; - } + SPI_SETBITS(dev, -handle->bpw); SPI_SETFREQUENCY(dev, handle->freq); SPI_LOCK(dev, false); diff --git a/os/include/tinyara/spi/spi.h b/os/include/tinyara/spi/spi.h index b9e4a42..2d9e2bc 100644 --- a/os/include/tinyara/spi/spi.h +++ b/os/include/tinyara/spi/spi.h @@ -398,8 +398,8 @@ struct spi_ops_s { #endif void (*select)(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); uint32_t (*setfrequency)(FAR struct spi_dev_s *dev, uint32_t frequency); - int (*setmode)(FAR struct spi_dev_s *dev, enum spi_mode_e mode); - int (*setbits)(FAR struct spi_dev_s *dev, int nbits); + void (*setmode)(FAR struct spi_dev_s *dev, enum spi_mode_e mode); + void (*setbits)(FAR struct spi_dev_s *dev, int nbits); uint8_t (*status)(FAR struct spi_dev_s *dev, enum spi_dev_e devid); #ifdef CONFIG_SPI_CMDDATA int (*cmddata)(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); -- 2.7.4