iio: imu: adis: use new `delay` structure for SPI transfer delays
authorAlexandru Ardelean <alexandru.ardelean@analog.com>
Tue, 10 Dec 2019 14:07:55 +0000 (16:07 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 13 Jan 2020 22:03:36 +0000 (22:03 +0000)
In a recent change to the SPI subsystem [1], a new `delay` struct was added
to replace the `delay_usecs`. This change replaces the current `delay_usecs`
with `delay` for this driver.

The `spi_transfer_delay_exec()` function [in the SPI framework] makes sure
that both `delay_usecs` & `delay` are used (in this order to preserve
backwards compatibility).

[1] commit bebcfd272df6485 ("spi: introduce `delay` field for
`spi_transfer` + spi_transfer_delay_exec()")

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/adis.c

index 8f0867495ef5d7f0d6d8826ab2f592bc31e2e2f6..022bb54fb748af01ef5169c85d14ea1b5ce27f7c 100644 (file)
@@ -45,7 +45,8 @@ int __adis_write_reg(struct adis *adis, unsigned int reg,
                        .bits_per_word = 8,
                        .len = 2,
                        .cs_change = 1,
-                       .delay_usecs = adis->data->write_delay,
+                       .delay.value = adis->data->write_delay,
+                       .delay.unit = SPI_DELAY_UNIT_USECS,
                        .cs_change_delay.value = adis->data->cs_change_delay,
                        .cs_change_delay.unit = SPI_DELAY_UNIT_USECS,
                }, {
@@ -53,7 +54,8 @@ int __adis_write_reg(struct adis *adis, unsigned int reg,
                        .bits_per_word = 8,
                        .len = 2,
                        .cs_change = 1,
-                       .delay_usecs = adis->data->write_delay,
+                       .delay.value = adis->data->write_delay,
+                       .delay.unit = SPI_DELAY_UNIT_USECS,
                        .cs_change_delay.value = adis->data->cs_change_delay,
                        .cs_change_delay.unit = SPI_DELAY_UNIT_USECS,
                }, {
@@ -61,19 +63,22 @@ int __adis_write_reg(struct adis *adis, unsigned int reg,
                        .bits_per_word = 8,
                        .len = 2,
                        .cs_change = 1,
-                       .delay_usecs = adis->data->write_delay,
+                       .delay.value = adis->data->write_delay,
+                       .delay.unit = SPI_DELAY_UNIT_USECS,
                        .cs_change_delay.value = adis->data->cs_change_delay,
                        .cs_change_delay.unit = SPI_DELAY_UNIT_USECS,
                }, {
                        .tx_buf = adis->tx + 6,
                        .bits_per_word = 8,
                        .len = 2,
-                       .delay_usecs = adis->data->write_delay,
+                       .delay.value = adis->data->write_delay,
+                       .delay.unit = SPI_DELAY_UNIT_USECS,
                }, {
                        .tx_buf = adis->tx + 8,
                        .bits_per_word = 8,
                        .len = 2,
-                       .delay_usecs = adis->data->write_delay,
+                       .delay.value = adis->data->write_delay,
+                       .delay.unit = SPI_DELAY_UNIT_USECS,
                },
        };
 
@@ -140,7 +145,8 @@ int __adis_read_reg(struct adis *adis, unsigned int reg,
                        .bits_per_word = 8,
                        .len = 2,
                        .cs_change = 1,
-                       .delay_usecs = adis->data->write_delay,
+                       .delay.value = adis->data->write_delay,
+                       .delay.unit = SPI_DELAY_UNIT_USECS,
                        .cs_change_delay.value = adis->data->cs_change_delay,
                        .cs_change_delay.unit = SPI_DELAY_UNIT_USECS,
                }, {
@@ -148,7 +154,8 @@ int __adis_read_reg(struct adis *adis, unsigned int reg,
                        .bits_per_word = 8,
                        .len = 2,
                        .cs_change = 1,
-                       .delay_usecs = adis->data->read_delay,
+                       .delay.value = adis->data->read_delay,
+                       .delay.unit = SPI_DELAY_UNIT_USECS,
                        .cs_change_delay.value = adis->data->cs_change_delay,
                        .cs_change_delay.unit = SPI_DELAY_UNIT_USECS,
                }, {
@@ -157,14 +164,16 @@ int __adis_read_reg(struct adis *adis, unsigned int reg,
                        .bits_per_word = 8,
                        .len = 2,
                        .cs_change = 1,
-                       .delay_usecs = adis->data->read_delay,
+                       .delay.value = adis->data->read_delay,
+                       .delay.unit = SPI_DELAY_UNIT_USECS,
                        .cs_change_delay.value = adis->data->cs_change_delay,
                        .cs_change_delay.unit = SPI_DELAY_UNIT_USECS,
                }, {
                        .rx_buf = adis->rx + 2,
                        .bits_per_word = 8,
                        .len = 2,
-                       .delay_usecs = adis->data->read_delay,
+                       .delay.value = adis->data->read_delay,
+                       .delay.unit = SPI_DELAY_UNIT_USECS,
                },
        };