diff mbox series

[3/4] iio: xilinx-xadc-core: Use local variable in xadc_read_raw

Message ID 20211101071822.522178-4-gwendal@chromium.org (mailing list archive)
State Superseded
Headers show
Series iio: Use scan_type shift and realbits when processing raw data | expand

Commit Message

Gwendal Grignou Nov. 1, 2021, 7:18 a.m. UTC
Minor cleanup: bit is already defined as chan->scan_type.realbits,
use bit when needed.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
 drivers/iio/adc/xilinx-xadc-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron Nov. 3, 2021, 6:55 p.m. UTC | #1
On Mon,  1 Nov 2021 00:18:21 -0700
Gwendal Grignou <gwendal@chromium.org> wrote:

> Minor cleanup: bit is already defined as chan->scan_type.realbits,
> use bit when needed.
> 
bits

> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Otherwise looks good to me.

> ---
>  drivers/iio/adc/xilinx-xadc-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
> index 83bea5ef765da..05050709e4f8a 100644
> --- a/drivers/iio/adc/xilinx-xadc-core.c
> +++ b/drivers/iio/adc/xilinx-xadc-core.c
> @@ -943,7 +943,7 @@ static int xadc_read_raw(struct iio_dev *indio_dev,
>  				*val = 1000;
>  				break;
>  			}
> -			*val2 = chan->scan_type.realbits;
> +			*val2 = bits;
>  			return IIO_VAL_FRACTIONAL_LOG2;
>  		case IIO_TEMP:
>  			/* Temp in C = (val * 503.975) / 2**bits - 273.15 */
diff mbox series

Patch

diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index 83bea5ef765da..05050709e4f8a 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -943,7 +943,7 @@  static int xadc_read_raw(struct iio_dev *indio_dev,
 				*val = 1000;
 				break;
 			}
-			*val2 = chan->scan_type.realbits;
+			*val2 = bits;
 			return IIO_VAL_FRACTIONAL_LOG2;
 		case IIO_TEMP:
 			/* Temp in C = (val * 503.975) / 2**bits - 273.15 */