Re: [PATCH 10/25] drm: kirin: Move workqueue to ade_hw_ctx structure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
> Cc: Rongrong Zou <zourongrong@xxxxxxxxx>
> Cc: Xinwei Kong <kong.kongxinwei@xxxxxxxxxxxxx>
> Cc: Chen Feng <puck.chen@xxxxxxxxxxxxx>
> Cc: David Airlie <airlied@xxxxxxxx>
> Cc: Daniel Vetter <daniel@xxxxxxxx>
> Cc: dri-devel <dri-devel@xxxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
> ---
>  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
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux