[v2,4/4] iio: imu: adis: convert cs_change_delay to spi_delay struct
diff mbox series

Message ID 20190913115549.3823-5-alexandru.ardelean@analog.com
State Superseded
Headers show
Series
  • spi: introduce `struct spi_delay` data-type
Related show

Commit Message

Alexandru Ardelean Sept. 13, 2019, 11:55 a.m. UTC
The ADIS library is one of the few users of the new `cs_change_delay`
parameter for an spi_transfer.

The introduction of the `spi_delay` struct, requires that the users of of
`cs_change_delay` get an update. This change updates the ADIS library.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/iio/imu/adis.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

Comments

Jonathan Cameron Sept. 15, 2019, 10:14 a.m. UTC | #1
On Fri, 13 Sep 2019 14:55:49 +0300
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> The ADIS library is one of the few users of the new `cs_change_delay`
> parameter for an spi_transfer.
> 
> The introduction of the `spi_delay` struct, requires that the users of of
> `cs_change_delay` get an update. This change updates the ADIS library.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

Looks to me like the build is broken between patches 3 and 4.
Don't do that as it breaks bisectability.

If you are changing an interface like this it has to occur in one patch,
of you have to have intermediate code that deals with the smooth transition.

Otherwise, looks like a sensible bit of rework to me.

Jonathan

> ---
>  drivers/iio/imu/adis.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> index 1631c255deab..2cd2cc2316c6 100644
> --- a/drivers/iio/imu/adis.c
> +++ b/drivers/iio/imu/adis.c
> @@ -39,24 +39,24 @@ int adis_write_reg(struct adis *adis, unsigned int reg,
>  			.len = 2,
>  			.cs_change = 1,
>  			.delay_usecs = adis->data->write_delay,
> -			.cs_change_delay = adis->data->cs_change_delay,
> -			.cs_change_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 + 2,
>  			.bits_per_word = 8,
>  			.len = 2,
>  			.cs_change = 1,
>  			.delay_usecs = adis->data->write_delay,
> -			.cs_change_delay = adis->data->cs_change_delay,
> -			.cs_change_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 + 4,
>  			.bits_per_word = 8,
>  			.len = 2,
>  			.cs_change = 1,
>  			.delay_usecs = adis->data->write_delay,
> -			.cs_change_delay = adis->data->cs_change_delay,
> -			.cs_change_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,
> @@ -139,16 +139,16 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
>  			.len = 2,
>  			.cs_change = 1,
>  			.delay_usecs = adis->data->write_delay,
> -			.cs_change_delay = adis->data->cs_change_delay,
> -			.cs_change_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 + 2,
>  			.bits_per_word = 8,
>  			.len = 2,
>  			.cs_change = 1,
>  			.delay_usecs = adis->data->read_delay,
> -			.cs_change_delay = adis->data->cs_change_delay,
> -			.cs_change_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 + 4,
>  			.rx_buf = adis->rx,
> @@ -156,8 +156,8 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
>  			.len = 2,
>  			.cs_change = 1,
>  			.delay_usecs = adis->data->read_delay,
> -			.cs_change_delay = adis->data->cs_change_delay,
> -			.cs_change_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,
Alexandru Ardelean Sept. 16, 2019, 6:58 a.m. UTC | #2
On Sun, 2019-09-15 at 11:14 +0100, Jonathan Cameron wrote:
> [External]
> 
> On Fri, 13 Sep 2019 14:55:49 +0300
> Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:
> 
> > The ADIS library is one of the few users of the new `cs_change_delay`
> > parameter for an spi_transfer.
> > 
> > The introduction of the `spi_delay` struct, requires that the users of of
> > `cs_change_delay` get an update. This change updates the ADIS library.
> > 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> 
> Looks to me like the build is broken between patches 3 and 4.
> Don't do that as it breaks bisectability.
> 
> If you are changing an interface like this it has to occur in one patch,
> of you have to have intermediate code that deals with the smooth transition.
> 
> Otherwise, looks like a sensible bit of rework to me.

I thought about it, but wasn't sure.
Will create a v3 with patches 3 & 4 squashed.

Thanks
Alex

> 
> Jonathan
> 
> > ---
> >  drivers/iio/imu/adis.c | 24 ++++++++++++------------
> >  1 file changed, 12 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
> > index 1631c255deab..2cd2cc2316c6 100644
> > --- a/drivers/iio/imu/adis.c
> > +++ b/drivers/iio/imu/adis.c
> > @@ -39,24 +39,24 @@ int adis_write_reg(struct adis *adis, unsigned int reg,
> >  			.len = 2,
> >  			.cs_change = 1,
> >  			.delay_usecs = adis->data->write_delay,
> > -			.cs_change_delay = adis->data->cs_change_delay,
> > -			.cs_change_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 + 2,
> >  			.bits_per_word = 8,
> >  			.len = 2,
> >  			.cs_change = 1,
> >  			.delay_usecs = adis->data->write_delay,
> > -			.cs_change_delay = adis->data->cs_change_delay,
> > -			.cs_change_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 + 4,
> >  			.bits_per_word = 8,
> >  			.len = 2,
> >  			.cs_change = 1,
> >  			.delay_usecs = adis->data->write_delay,
> > -			.cs_change_delay = adis->data->cs_change_delay,
> > -			.cs_change_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,
> > @@ -139,16 +139,16 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
> >  			.len = 2,
> >  			.cs_change = 1,
> >  			.delay_usecs = adis->data->write_delay,
> > -			.cs_change_delay = adis->data->cs_change_delay,
> > -			.cs_change_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 + 2,
> >  			.bits_per_word = 8,
> >  			.len = 2,
> >  			.cs_change = 1,
> >  			.delay_usecs = adis->data->read_delay,
> > -			.cs_change_delay = adis->data->cs_change_delay,
> > -			.cs_change_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 + 4,
> >  			.rx_buf = adis->rx,
> > @@ -156,8 +156,8 @@ int adis_read_reg(struct adis *adis, unsigned int reg,
> >  			.len = 2,
> >  			.cs_change = 1,
> >  			.delay_usecs = adis->data->read_delay,
> > -			.cs_change_delay = adis->data->cs_change_delay,
> > -			.cs_change_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,

Patch
diff mbox series

diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c
index 1631c255deab..2cd2cc2316c6 100644
--- a/drivers/iio/imu/adis.c
+++ b/drivers/iio/imu/adis.c
@@ -39,24 +39,24 @@  int adis_write_reg(struct adis *adis, unsigned int reg,
 			.len = 2,
 			.cs_change = 1,
 			.delay_usecs = adis->data->write_delay,
-			.cs_change_delay = adis->data->cs_change_delay,
-			.cs_change_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 + 2,
 			.bits_per_word = 8,
 			.len = 2,
 			.cs_change = 1,
 			.delay_usecs = adis->data->write_delay,
-			.cs_change_delay = adis->data->cs_change_delay,
-			.cs_change_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 + 4,
 			.bits_per_word = 8,
 			.len = 2,
 			.cs_change = 1,
 			.delay_usecs = adis->data->write_delay,
-			.cs_change_delay = adis->data->cs_change_delay,
-			.cs_change_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,
@@ -139,16 +139,16 @@  int adis_read_reg(struct adis *adis, unsigned int reg,
 			.len = 2,
 			.cs_change = 1,
 			.delay_usecs = adis->data->write_delay,
-			.cs_change_delay = adis->data->cs_change_delay,
-			.cs_change_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 + 2,
 			.bits_per_word = 8,
 			.len = 2,
 			.cs_change = 1,
 			.delay_usecs = adis->data->read_delay,
-			.cs_change_delay = adis->data->cs_change_delay,
-			.cs_change_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 + 4,
 			.rx_buf = adis->rx,
@@ -156,8 +156,8 @@  int adis_read_reg(struct adis *adis, unsigned int reg,
 			.len = 2,
 			.cs_change = 1,
 			.delay_usecs = adis->data->read_delay,
-			.cs_change_delay = adis->data->cs_change_delay,
-			.cs_change_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,