Re: [PATCH v2 2/2] iio: dac: adi-axi-dac: use unique bus free check

From: Andy Shevchenko
Date: Wed Apr 09 2025 - 12:52:50 EST


On Wed, Apr 09, 2025 at 11:16:55AM +0200, Angelo Dureghello wrote:
> From: Angelo Dureghello <adureghello@xxxxxxxxxxxx>
>
> Use a unique function for the bus free check by polling, to reduce
> duplicated code. An error is always thrown in case of timeout.

...

> +static int axi_dac_wait_bus_free(struct axi_dac_state *st)
> +{
> + u32 val;
> + int ret;
> +
> + ret = regmap_read_poll_timeout(st->regmap, AXI_DAC_UI_STATUS_REG, val,
> + FIELD_GET(AXI_DAC_UI_STATUS_IF_BUSY, val) == -1, 10,
> + 100 * KILO);

Same comment as in the previous patch. Okay, it seems more than in the single
case. Perhaps to change that as well here?

> + if (ret == -ETIMEDOUT)
> + dev_err(st->dev, "AXI bus timeout\n");

Why do you need this? The error code will go to the user space at the end? If
yes, it will be enough to have it printed there, no?

> + return ret;
> +}


--
With Best Regards,
Andy Shevchenko