[PATCH 02/12] drm/panthor: Further delay reset work enablement

From: Boris Brezillon

Date: Tue Aug 04 2026 - 06:25:21 EST


There's no point re-enabling the reset work before the DRM device
registration succeeds, so move the enable_work() after the point where
nothing can fail anymore, and in the unlikely event where a reset was
pending, reschedule it.

Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
---
drivers/gpu/drm/panthor/panthor_device.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/panthor/panthor_device.c b/drivers/gpu/drm/panthor/panthor_device.c
index e7f5744bc1e3..1aa86d00646f 100644
--- a/drivers/gpu/drm/panthor/panthor_device.c
+++ b/drivers/gpu/drm/panthor/panthor_device.c
@@ -289,9 +289,6 @@ int panthor_device_init(struct panthor_device *ptdev)

panthor_gem_init(ptdev);

- /* Now that everything is initialized, we can enable the reset work. */
- enable_work(&ptdev->reset.work);
-
/* ~3 frames */
pm_runtime_set_autosuspend_delay(ptdev->base.dev, 50);
pm_runtime_use_autosuspend(ptdev->base.dev);
@@ -300,6 +297,14 @@ int panthor_device_init(struct panthor_device *ptdev)
if (ret)
goto err_disable_autosuspend;

+ /* Now that everything is initialized, we can enable the reset work.
+ * If there was a reset pending, clear and reschedule, otherwise the
+ * reset.pending bit is stuck.
+ */
+ enable_work(&ptdev->reset.work);
+ if (atomic_cmpxchg(&ptdev->reset.pending, 1, 0))
+ panthor_device_schedule_reset(ptdev);
+
pm_runtime_put_autosuspend(ptdev->base.dev);
return 0;


--
2.55.0