diff mbox series

drm/rockchip: vop: call vop_cfg_done() under reg_lock

Message ID 20200505151613.2932456-1-emil.l.velikov@gmail.com (mailing list archive)
State New, archived
Headers show
Series drm/rockchip: vop: call vop_cfg_done() under reg_lock | expand

Commit Message

Emil Velikov May 5, 2020, 3:16 p.m. UTC
From: Emil Velikov <emil.velikov@collabora.com>

The function vop_cfg_done() is a simple VOP_REG_SET(). As such it should
be done under a reg_lock. A quick look through the driver shows that all
other instances (apart from driver init) have the lock. Do the same here

Cc: Sandy Huang <hjc@rock-chips.com>
Cc: Heiko Stübner <heiko@sntech.de>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
---
Noticed while skimming through the code and thus untested.
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

黄家钗 May 6, 2020, 1:32 a.m. UTC | #1
Hi Emil Velikov,

在 2020/5/5 下午11:16, Emil Velikov 写道:
> From: Emil Velikov <emil.velikov@collabora.com>
>
> The function vop_cfg_done() is a simple VOP_REG_SET(). As such it should
> be done under a reg_lock. A quick look through the driver shows that all
> other instances (apart from driver init) have the lock. Do the same here
>
> Cc: Sandy Huang <hjc@rock-chips.com>
> Cc: Heiko Stübner <heiko@sntech.de>
> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> ---
> Noticed while skimming through the code and thus untested.
> ---
>   drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 33463b79a37b..1d76455ca933 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -645,10 +645,10 @@ static int vop_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
>   		s->enable_afbc = false;
>   	}
>   
> -	spin_unlock(&vop->reg_lock);
> -
>   	vop_cfg_done(vop);
>   
> +	spin_unlock(&vop->reg_lock);
> +
>   	/*
>   	 * At here, vop clock & iommu is enable, R/W vop regs would be safe.
>   	 */

thanks for your patch
Reviewed-by: Sandy Huang <hjc@rock-chips.com>
Emil Velikov May 17, 2020, 8:46 p.m. UTC | #2
On Wed, 6 May 2020 at 02:32, Sandy Huang <hjc@rock-chips.com> wrote:
>
> Hi Emil Velikov,
>
> 在 2020/5/5 下午11:16, Emil Velikov 写道:
> > From: Emil Velikov <emil.velikov@collabora.com>
> >
> > The function vop_cfg_done() is a simple VOP_REG_SET(). As such it should
> > be done under a reg_lock. A quick look through the driver shows that all
> > other instances (apart from driver init) have the lock. Do the same here
> >
> > Cc: Sandy Huang <hjc@rock-chips.com>
> > Cc: Heiko Stübner <heiko@sntech.de>
> > Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> > ---
> > Noticed while skimming through the code and thus untested.
> > ---
> >   drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> > index 33463b79a37b..1d76455ca933 100644
> > --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> > @@ -645,10 +645,10 @@ static int vop_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
> >               s->enable_afbc = false;
> >       }
> >
> > -     spin_unlock(&vop->reg_lock);
> > -
> >       vop_cfg_done(vop);
> >
> > +     spin_unlock(&vop->reg_lock);
> > +
> >       /*
> >        * At here, vop clock & iommu is enable, R/W vop regs would be safe.
> >        */
>
> thanks for your patch
> Reviewed-by: Sandy Huang <hjc@rock-chips.com>
>
Thanks. Doesn't seems like this was merged, so I pushed it to drm-misc-next.

-Emil
diff mbox series

Patch

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 33463b79a37b..1d76455ca933 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -645,10 +645,10 @@  static int vop_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state)
 		s->enable_afbc = false;
 	}
 
-	spin_unlock(&vop->reg_lock);
-
 	vop_cfg_done(vop);
 
+	spin_unlock(&vop->reg_lock);
+
 	/*
 	 * At here, vop clock & iommu is enable, R/W vop regs would be safe.
 	 */