Re: [PATCH v1 06/15] iio: adc: ad7768-1: Update reg_read function

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

 



On 01/07, Jonathan Santos wrote:
> From: Sergiu Cuciurean <sergiu.cuciurean@xxxxxxxxxx>
> 
> This patch adds an additional parameter to the register read function.
> By passing the data pointer to the function, the returned value will used
> only for status check.
> With this change, the status check won't be confused with a register value
> check:
> 
> ret = ad7768_spi_reg_read()
> if (ret){}
> 
> Also this change removes the probability to interpret a negative value as
> a return code (the ADC is a differential one)."
> 
> Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@xxxxxxxxxx>
> ---
...
> @@ -190,7 +190,9 @@ static int ad7768_spi_reg_read(struct ad7768_state *st, unsigned int addr,
>  	if (ret < 0)
>  		return ret;
>  
> -	return (be32_to_cpu(st->data.d32) >> shift);
> +	*data = (be32_to_cpu(st->data.d32) >> shift);
Are the outer parenthesis needed?
*data = be32_to_cpu(st->data.d32) >> shift;
?

> +
> +	return ret;
>  }
>  




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux