Re: [PATCH v2] staging: iio: accel: adis16240: Improve readability on write_raw function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2019-08-13 at 16:31 -0300, Rodrigo Ribeiro wrote:
> [External]
> 
> Replace shift and minus operation by GENMASK macro and remove the local
> variables used to store intermediate data.
> 

Reviewed-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx>

> Signed-off-by: Rodrigo Ribeiro Carvalho <rodrigorsdc@xxxxxxxxx>
> ---
> v2:
>    - Leave switch statement instead of replace by if statement
>  drivers/staging/iio/accel/adis16240.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/iio/accel/adis16240.c b/drivers/staging/iio/accel/adis16240.c
> index 62f4b3b1b457..82099db4bf0c 100644
> --- a/drivers/staging/iio/accel/adis16240.c
> +++ b/drivers/staging/iio/accel/adis16240.c
> @@ -309,15 +309,12 @@ static int adis16240_write_raw(struct iio_dev *indio_dev,
>  			       long mask)
>  {
>  	struct adis *st = iio_priv(indio_dev);
> -	int bits = 10;
> -	s16 val16;
>  	u8 addr;
>  
>  	switch (mask) {
>  	case IIO_CHAN_INFO_CALIBBIAS:
> -		val16 = val & ((1 << bits) - 1);
>  		addr = adis16240_addresses[chan->scan_index][0];
> -		return adis_write_reg_16(st, addr, val16);
> +		return adis_write_reg_16(st, addr, val & GENMASK(9, 0));
>  	}
>  	return -EINVAL;
>  }
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux