Re: [PATCH v1 6/8] iio: dac: ds4424: clear outputs on probe
From: Andy Shevchenko
Date: Mon Jan 19 2026 - 14:12:20 EST
On Mon, Jan 19, 2026 at 07:24:22PM +0100, Oleksij Rempel wrote:
> The DS44xx devices have no reset pin or reset bit, so output registers
> may retain preconfigured values across reboot or warm reset.
>
> Also, the driver suspend/resume path restores from data->raw. When the
> device is first probed, data->raw is zero-initialized and may not match
> the actual hardware state. A later suspend/resume can therefore change an
> output from a preconfigured non-zero value to 0 mA.
>
> Initialize all channels to 0 output current during probe to ensure a
> deterministic baseline and consistent suspend/resume behavior.
...
> +static int ds4424_init(struct iio_dev *indio_dev)
> +{
> + int i, ret;
Why is 'i' signed?
> +
> + /* Set all channels to 0 current. */
> + for (i = 0; i < indio_dev->num_channels; i++) {
for (unsigned int i = ...) {
> + ret = ds4424_set_value(indio_dev, 0, &indio_dev->channels[i]);
> + if (ret < 0)
> + return ret;
> + }
> +
> + return 0;
> +}
--
With Best Regards,
Andy Shevchenko