Re: [PATCH v6 08/11] iio: adc: hx711: split variable assignments in hx711_read and hx711_reset
From: Jonathan Cameron
Date: Mon May 04 2026 - 12:07:00 EST
On Sun, 3 May 2026 17:39:37 +0530
Piyush Patle <piyushpatle228@xxxxxxxxx> wrote:
> Separate the initial value assignments from the declarations in
> hx711_read() and hx711_reset().
>
> This is a small preparatory cleanup before the later loop-iterator and
> variant-specific changes adjust the local variable layout in these
> functions.
>
> No functional change.
>
> Signed-off-by: Piyush Patle <piyushpatle228@xxxxxxxxx>
> ---
> drivers/iio/adc/hx711.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
> index 637114635867..b2de8db285b2 100644
> --- a/drivers/iio/adc/hx711.c
> +++ b/drivers/iio/adc/hx711.c
> @@ -159,7 +159,9 @@ static int hx711_read(struct hx711_data *hx711_data, int trailing_pulses)
> {
> int i, ret;
> int value = 0;
> - int val = gpiod_get_value(hx711_data->gpiod_dout);
> + int val;
> +
> + val = gpiod_get_value(hx711_data->gpiod_dout);
Not sure. Maybe Andy's feedback crossed with new version as I'm fairly sure
he commented on this in v5. Anyhow...
Remove this blank line.
>
> /* we double check if it's really down */
> if (val)
> @@ -204,7 +206,9 @@ static int hx711_wait_for_ready(struct hx711_data *hx711_data)
>
> static int hx711_reset(struct hx711_data *hx711_data)
> {
> - int val = hx711_wait_for_ready(hx711_data);
> + int val;
> +
> + val = hx711_wait_for_ready(hx711_data);
And this blank line.
>
> if (val) {
> /*