lkml.org 
[lkml]   [2019]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 10/25] drm: kirin: Move workqueue to ade_hw_ctx structure
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 <z.liuxinliang@hisilicon.com>
> Cc: Rongrong Zou <zourongrong@gmail.com>
> Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
> Cc: Chen Feng <puck.chen@hisilicon.com>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: dri-devel <dri-devel@lists.freedesktop.org>
> Signed-off-by: John Stultz <john.stultz@linaro.org>
> ---
> 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

\
 
 \ /
  Last update: 2019-04-24 18:47    [W:0.326 / U:0.712 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site