spi: iotbus: fix mismatched prototype declarations
authorHeesub Shin <heesub.shin@samsung.com>
Tue, 4 Apr 2017 04:29:37 +0000 (13:29 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Tue, 18 Apr 2017 03:02:07 +0000 (12:02 +0900)
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 <heesub.shin@samsung.com>
framework/src/iotbus/iotbus_spi.c
os/include/tinyara/spi/spi.h

index 304f73e..3a31134 100644 (file)
@@ -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);
index b9e4a42..2d9e2bc 100644 (file)
@@ -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);