greybus: spi: move chipselect to one byte size
authorRui Miguel Silva <rui.silva@linaro.org>
Thu, 10 Dec 2015 14:24:58 +0000 (14:24 +0000)
committerGreg Kroah-Hartman <gregkh@google.com>
Thu, 10 Dec 2015 14:54:18 +0000 (09:54 -0500)
Fixed in the specification, some values for chipselect count and index
were different in size, just fix that for all reference to chipselect
and move all to one byte size and remove byte order operations.

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
drivers/staging/greybus/greybus_protocols.h
drivers/staging/greybus/spi.c

index e8c4bce..d3f957f 100644 (file)
@@ -662,11 +662,11 @@ struct gb_spi_master_config_response {
        __le32  max_speed_hz;
        __le16  mode;
        __le16  flags;
-       __le16  num_chipselect;
+       __u8    num_chipselect;
 } __packed;
 
 struct gb_spi_device_config_request {
-       __le16  chip_select;
+       __u8    chip_select;
 } __packed;
 
 struct gb_spi_device_config_response {
index 094d6d8..15886a2 100644 (file)
@@ -20,7 +20,7 @@ struct gb_spi {
        u16                     mode;
        u16                     flags;
        u32                     bits_per_word_mask;
-       u16                     num_chipselect;
+       u                     num_chipselect;
        u32                     min_speed_hz;
        u32                     max_speed_hz;
        struct spi_device       *spi_devices;
@@ -270,7 +270,7 @@ static int gb_spi_get_master_config(struct gb_spi *spi)
        spi->flags = gb_spi_flags_map(flags);
 
        spi->bits_per_word_mask = le32_to_cpu(response.bits_per_word_mask);
-       spi->num_chipselect = le16_to_cpu(response.num_chipselect);
+       spi->num_chipselect = response.num_chipselect;
 
        spi->min_speed_hz = le32_to_cpu(response.min_speed_hz);
        spi->max_speed_hz = le32_to_cpu(response.max_speed_hz);
@@ -278,7 +278,7 @@ static int gb_spi_get_master_config(struct gb_spi *spi)
        return 0;
 }
 
-static int gb_spi_setup_device(struct gb_spi *spi, uint16_t cs)
+static int gb_spi_setup_device(struct gb_spi *spi, u8 cs)
 {
        struct spi_master *master = get_master_from_spi(spi);
        struct gb_spi_device_config_request request;
@@ -287,7 +287,7 @@ static int gb_spi_setup_device(struct gb_spi *spi, uint16_t cs)
        struct spi_device *spidev = &spi->spi_devices[cs];
        int ret;
 
-       request.chip_select = cpu_to_le16(cs);
+       request.chip_select = cs;
 
        ret = gb_operation_sync(spi->connection, GB_SPI_TYPE_DEVICE_CONFIG,
                                &request, sizeof(request),
@@ -331,7 +331,7 @@ static int gb_spi_connection_init(struct gb_connection *connection)
        struct gb_spi *spi;
        struct spi_master *master;
        int ret;
-       int i;
+       u8 i;
 
        /* Allocate master with space for data */
        master = spi_alloc_master(&connection->bundle->dev, sizeof(*spi));