Re: [PATCH v6 6/8] gpiolib: cdev: don't report a failed line read as an edge
From: Kent Gibson
Date: Wed Nov 18 2026 - 10:43:43 EST
On Mon, Nov 16, 2026 at 03:47:09PM +0200, Adrian Ambrozewicz wrote:
> With both edges requested, the IRQ threads read the line to tell a
> rising edge from a falling one, and treat an error as a high level.
>
> The read fails when the chip is gone. A driver's ->get() returns an
> error once its device stops answering: pcf857x when the I2C transfer
> fails, dln2 when the USB adapter is unplugged. Since gdev->chip became
> SRCU-protected, the read also returns -ENODEV between gpiochip_remove()
> and the IRQ being freed.
>
> Drop the event when the read fails, as debounce_work_func() does.
>
> Tested with gpio-sim removal (test delay in the IRQ threads) and a
> test chip whose ->get() returns -EIO: both reported a rising edge, none
> with this change. The HTE path was compile-tested.
>
Reviewed-by: Kent Gibson <warthog618@xxxxxxxxx>
Cheers,
Kent.