From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sam Ravnborg Subject: Re: [PATCH 10/25] drm: kirin: Move workqueue to ade_hw_ctx structure Date: Wed, 24 Apr 2019 18:46:45 +0200 Message-ID: <20190424164645.GC20110@ravnborg.org> References: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> <1556061656-1733-11-git-send-email-john.stultz@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1556061656-1733-11-git-send-email-john.stultz@linaro.org> Sender: linux-kernel-owner@vger.kernel.org To: John Stultz Cc: lkml , David Airlie , Chen Feng , dri-devel , Xinliang Liu , Xinwei Kong , Rongrong Zou List-Id: dri-devel@lists.freedesktop.org Hi John. On Tue, Apr 23, 2019 at 04:20:41PM -0700, John Stultz wrote: > The workqueue used to reset the display when we hit an LDI > underflow error is ADE specific, so since this patch series > works to make the kirin_crtc structure more generic, move the > workqueue to the ade_hw_ctx structure instead. > > Cc: Xinliang Liu > Cc: Rongrong Zou > Cc: Xinwei Kong > Cc: Chen Feng > Cc: David Airlie > Cc: Daniel Vetter > Cc: dri-devel > Signed-off-by: John Stultz > --- > drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c > index 94dcad0..f54cf99 100644 > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c > @@ -52,6 +52,7 @@ struct ade_hw_ctx { > struct clk *media_noc_clk; > struct clk *ade_pix_clk; > struct reset_control *reset; > + struct work_struct drm_device_wq; The comment probarly belongs to 01/25... The name drm_device_wq is not at all descriptive. Consider something like: display_reset_wq Then when the workqueue is started it is much more obvious what it does. > bool power_on; > int irq; > > @@ -61,7 +62,6 @@ struct ade_hw_ctx { > struct kirin_crtc { > struct drm_crtc base; > void *hw_ctx; > - struct work_struct drm_device_wq; > bool enable; > }; > > @@ -349,9 +349,9 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc) > > static void drm_underflow_wq(struct work_struct *work) > { > - struct kirin_crtc *acrtc = container_of(work, struct kirin_crtc, > + struct ade_hw_ctx *ctx = container_of(work, struct ade_hw_ctx, > drm_device_wq); > - struct drm_device *drm_dev = (&acrtc->base)->dev; > + struct drm_device *drm_dev = ctx->crtc->dev; > struct drm_atomic_state *state; > > state = drm_atomic_helper_suspend(drm_dev); > @@ -362,7 +362,6 @@ static irqreturn_t ade_irq_handler(int irq, void *data) > { > struct ade_hw_ctx *ctx = data; > struct drm_crtc *crtc = ctx->crtc; > - struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); > void __iomem *base = ctx->base; > u32 status; > > @@ -379,7 +378,7 @@ static irqreturn_t ade_irq_handler(int irq, void *data) > ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST, > MASK(1), 1); > DRM_ERROR("LDI underflow!"); > - schedule_work(&kcrtc->drm_device_wq); Compare: > + schedule_work(&ctx->drm_device_wq); With > + schedule_work(&ctx->display_reset_wq); The latter wins in readability. Sam