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; > } >