Re: [PATCH v2] HID: mcp2221: Keep IIO initialization retries per device

From: Jiri Kosina

Date: Tue Dec 01 2026 - 07:22:37 EST


On Fri, 13 Nov 2026, Haowen Tu wrote:

> mcp_init_work() uses a static retry counter, so all MCP2221 devices share
> the same retry budget. Initializing one device can exhaust the retries
> available to another device, including a new instance after unplugging
> and reconnecting the bridge.
>
> When the counter reaches zero, the post-decrement also changes it to -1.
> A subsequent instance that receives -EAGAIN will then keep rescheduling
> its initialization work instead of stopping at the intended limit.
> Different devices can also update the shared counter concurrently.
>
> Store the retry budget in struct mcp2221 and initialize it before queuing
> the IIO initialization work. Check for exhaustion before decrementing so
> the counter stays at zero once the retry limit is reached.
>
> Fixes: 960f9df7c620 ("HID: mcp2221: add ADC/DAC support via iio subsystem")
> Signed-off-by: Haowen Tu <tuhaowen@xxxxxxxxxxxxx>

Applied, thanks.

--
Jiri Kosina
SUSE Labs