Message ID | 20240828101511.3269822-1-fshao@chromium.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | drm/mediatek: Use spin_lock_irqsave() for CRTC event lock | expand |
Hi, Fei: Fei Shao <fshao@chromium.org> 於 2024年8月28日 週三 下午6:16寫道: > > Use the state-aware spin_lock_irqsave() and spin_unlock_irqrestore() > to avoid unconditionally re-enabling the local interrupts. Applied to mediatek-drm-next [1], thanks. [1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next Regards, Chun-Kuang. > > Fixes: 411f5c1eacfe ("drm/mediatek: handle events when enabling/disabling crtc") > Signed-off-by: Fei Shao <fshao@chromium.org> > --- > > drivers/gpu/drm/mediatek/mtk_crtc.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c > index 6f34f573e127..42f47086f414 100644 > --- a/drivers/gpu/drm/mediatek/mtk_crtc.c > +++ b/drivers/gpu/drm/mediatek/mtk_crtc.c > @@ -449,6 +449,7 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_crtc *mtk_crtc) > { > struct drm_device *drm = mtk_crtc->base.dev; > struct drm_crtc *crtc = &mtk_crtc->base; > + unsigned long flags; > int i; > > for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) { > @@ -480,10 +481,10 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_crtc *mtk_crtc) > pm_runtime_put(drm->dev); > > if (crtc->state->event && !crtc->state->active) { > - spin_lock_irq(&crtc->dev->event_lock); > + spin_lock_irqsave(&crtc->dev->event_lock, flags); > drm_crtc_send_vblank_event(crtc, crtc->state->event); > crtc->state->event = NULL; > - spin_unlock_irq(&crtc->dev->event_lock); > + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); > } > } > > -- > 2.46.0.295.g3b9ea8a38a-goog >
diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c index 6f34f573e127..42f47086f414 100644 --- a/drivers/gpu/drm/mediatek/mtk_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_crtc.c @@ -449,6 +449,7 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_crtc *mtk_crtc) { struct drm_device *drm = mtk_crtc->base.dev; struct drm_crtc *crtc = &mtk_crtc->base; + unsigned long flags; int i; for (i = 0; i < mtk_crtc->ddp_comp_nr; i++) { @@ -480,10 +481,10 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_crtc *mtk_crtc) pm_runtime_put(drm->dev); if (crtc->state->event && !crtc->state->active) { - spin_lock_irq(&crtc->dev->event_lock); + spin_lock_irqsave(&crtc->dev->event_lock, flags); drm_crtc_send_vblank_event(crtc, crtc->state->event); crtc->state->event = NULL; - spin_unlock_irq(&crtc->dev->event_lock); + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); } }
Use the state-aware spin_lock_irqsave() and spin_unlock_irqrestore() to avoid unconditionally re-enabling the local interrupts. Fixes: 411f5c1eacfe ("drm/mediatek: handle events when enabling/disabling crtc") Signed-off-by: Fei Shao <fshao@chromium.org> --- drivers/gpu/drm/mediatek/mtk_crtc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)