[PATCH v5 12/16] iio: adc: xilinx-xadc: Refine Zynq read/write error handling on timeout/interrupt
Nagavarapu, Dileep Kumar
dnagavar at amd.com
Tue Nov 24 08:54:59 PST 2026
On 11/10/2026 9:51 PM, Andy Shevchenko wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Tue, Nov 10, 2026 at 10:31:57AM +0530, Dileep Kumar Nagavarapu wrote:
>> Refine the error codes returned from the wait, the same way in both
>> xadc_zynq_write_adc_reg() and xadc_zynq_read_adc_reg(): a timeout
>> (ret == 0) now returns -ETIMEDOUT instead of the previous -EIO,
>> giving a more precise errno for this condition. An interrupted wait
>> (ret < 0) now propagates that error to the caller instead of being
>> silently treated as success.
>>
>> xadc_zynq_write_adc_reg() waits on xadc->completion after issuing the
>> Zynq DRP write command, then drains the response word from
>> XADC_ZYNQ_REG_DFIFO. The DFIFO read already ran unconditionally after
>> the wait, regardless of outcome.
>
> ...
>
>> ret = wait_for_completion_interruptible_timeout(&xadc->completion, HZ);
>> - if (ret == 0)
>> - ret = -EIO;
>> - else
>> - ret = 0;
>>
>> xadc_read_reg(xadc, XADC_ZYNQ_REG_DFIFO, &tmp);
>>
>> - return ret;
>> + if (ret == 0)
>> + return -ETIMEDOUT;
>> +
>> + if (ret < 0)
>> + return ret;
>
> First check for generic errors, then for exclusive conditions ( == 0).
>
>> + return 0;
>
> ...
>
>> ret = wait_for_completion_interruptible_timeout(&xadc->completion, HZ);
>> if (ret == 0)
>> - ret = -EIO;
>> + return -ETIMEDOUT;
>> +
>> if (ret < 0)
>> return ret;
>
> Ditto.
>
This patch does not fix any behavioural issue; it only changes the
error codes. Sashiko suggested adding a Fixes tag. Is it OK to ignore
this comment, or do you have any other suggestions?
> --
> With Best Regards,
> Andy Shevchenko
More information about the linux-arm-kernel
mailing list