Re: [PATCH v4 1/3] drm/bridge: ti-sn65dsi83: Fix error handling in sn65dsi83_reset_work()
Esben Haabendal <[email protected]>
| Newsgroups | org.kernel.vger.stable,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
"Herve Codina" <[email protected]> writes: > Hi Esben, > > On Mon, 10 Aug 2026 09:19:40 +0200 > Esben Haabendal <[email protected]> wrote: > >> The error handling of sn65dsi83_reset_pipe() failure in >> sn65dsi83_reset_work() has been a bit strange all the time, missing both >> enable_irq() and drm_bridge_exit() in case of failure. But since >> sn65dsi83_reset_pipe() have never been failing (always returning 0), it has >> not caused any problems. >> >> As we are going to change sn65dsi83_reset_pipe() to return error values in >> case of failure, we need to fix this. >> >> Fixes: ad5c6ecef27e ("drm: bridge: ti-sn65dsi83: Add error recovery mechanism") >> Cc: [email protected] >> Signed-off-by: Esben Haabendal <[email protected]> >> --- >> drivers/gpu/drm/bridge/ti-sn65dsi83.c | 5 ++--- >> 1 file changed, 2 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c >> index 42b451432bbb..0ccfff401b2a 100644 >> --- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c >> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c >> @@ -417,10 +417,9 @@ static void sn65dsi83_reset_work(struct work_struct *ws) >> >> /* Reset the pipe */ >> ret = sn65dsi83_reset_pipe(ctx); >> - if (ret) { >> + if (ret) >> dev_err(ctx->dev, "reset pipe failed %pe\n", ERR_PTR(ret)); >> - return; >> - } >> + >> if (ctx->irq) >> enable_irq(ctx->irq); >> >> > > In this v4, enable_irq() is called even if we cannot reset the pipe. I know that > sn65dsi83_reset_pipe() always returns 0 (and this will be change) but we have to > take care here. > > If the pipe cannot be reset, the sn65dsi83 component could be in a state where > it can force the interrupt line. This was the reason the irq is disabled > https://elixir.bootlin.com/linux/v7.2/source/drivers/gpu/drm/bridge/ti-sn65dsi83.c#L455 Ok. But maybe take it in two steps. The change here, together with the change that makes sn65dsi83_reset_pipe() return non-zero on error, should ensure that behavior is unchanged. As long as sn65dsi83_reset_pipe() was always returning 0, we have been calling enable_irq() even if the pipe cannot be reset. If that is a problem, I think it is fair to do that as a separate change. As you say, we have to take care here. If we leave the irq disabled when sn65dsi83_reset_pipe() fails, do we simply want to leave the device with irq permanently disabled, or should we add some additional logic to sn65dsi83_handle_errors() so that we will try to recover periodically via sn65dsi83_monitor_work()? I think this is tricky enough to warrant a new patch series. /Esben