Re: [PATCH v3 17/23] drm: rockchip: remove struct rockchip_crtc_funcs
On Tue, Feb 07, 2017 at 05:16:29PM +0800, Shawn Guo wrote: > From: Shawn Guo> > With the vblank hooks in struct drm_crtc_funcs, we do not need to > maintain struct rockchip_crtc_funcs and the related registration > functions. Remove them. > Reviewed-by: Sean Paul > Signed-off-by: Shawn Guo > Cc: Mark Yao > --- > drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 51 > - > drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 14 > drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 9 ++--- > 3 files changed, 2 insertions(+), 72 deletions(-) > > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c > b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c > index 39243480c834..7719b9cd5b74 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c > @@ -74,55 +74,6 @@ void rockchip_drm_dma_detach_device(struct drm_device > *drm_dev, > arm_iommu_detach_device(dev); > } > > -int rockchip_register_crtc_funcs(struct drm_crtc *crtc, > - const struct rockchip_crtc_funcs *crtc_funcs) > -{ > - int pipe = drm_crtc_index(crtc); > - struct rockchip_drm_private *priv = crtc->dev->dev_private; > - > - if (pipe >= ROCKCHIP_MAX_CRTC) > - return -EINVAL; > - > - priv->crtc_funcs[pipe] = crtc_funcs; > - > - return 0; > -} > - > -void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc) > -{ > - int pipe = drm_crtc_index(crtc); > - struct rockchip_drm_private *priv = crtc->dev->dev_private; > - > - if (pipe >= ROCKCHIP_MAX_CRTC) > - return; > - > - priv->crtc_funcs[pipe] = NULL; > -} > - > -static int rockchip_drm_crtc_enable_vblank(struct drm_device *dev, > -unsigned int pipe) > -{ > - struct rockchip_drm_private *priv = dev->dev_private; > - struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); > - > - if (crtc && priv->crtc_funcs[pipe] && > - priv->crtc_funcs[pipe]->enable_vblank) > - return priv->crtc_funcs[pipe]->enable_vblank(crtc); > - > - return 0; > -} > - > -static void rockchip_drm_crtc_disable_vblank(struct drm_device *dev, > - unsigned int pipe) > -{ > - struct rockchip_drm_private *priv = dev->dev_private; > - struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); > - > - if (crtc && priv->crtc_funcs[pipe] && > - priv->crtc_funcs[pipe]->enable_vblank) > - priv->crtc_funcs[pipe]->disable_vblank(crtc); > -} > - > static int rockchip_drm_bind(struct device *dev) > { > struct drm_device *drm_dev; > @@ -270,8 +221,6 @@ static void rockchip_drm_lastclose(struct drm_device *dev) > .driver_features= DRIVER_MODESET | DRIVER_GEM | > DRIVER_PRIME | DRIVER_ATOMIC, > .lastclose = rockchip_drm_lastclose, > - .enable_vblank = rockchip_drm_crtc_enable_vblank, > - .disable_vblank = rockchip_drm_crtc_disable_vblank, > .gem_vm_ops = _gem_cma_vm_ops, > .gem_free_object_unlocked = rockchip_gem_free_object, > .dumb_create= rockchip_gem_dumb_create, > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h > b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h > index fb6226cf84b7..9f9bc959b108 100644 > --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h > @@ -31,16 +31,6 @@ > struct drm_device; > struct drm_connector; > > -/* > - * Rockchip drm private crtc funcs. > - * @enable_vblank: enable crtc vblank irq. > - * @disable_vblank: disable crtc vblank irq. > - */ > -struct rockchip_crtc_funcs { > - int (*enable_vblank)(struct drm_crtc *crtc); > - void (*disable_vblank)(struct drm_crtc *crtc); > -}; > - > struct rockchip_crtc_state { > struct drm_crtc_state base; > int output_type; > @@ -58,16 +48,12 @@ struct rockchip_crtc_state { > struct rockchip_drm_private { > struct drm_fb_helper fbdev_helper; > struct drm_gem_object *fbdev_bo; > - const struct rockchip_crtc_funcs *crtc_funcs[ROCKCHIP_MAX_CRTC]; > struct drm_atomic_state *state; > > struct list_head psr_list; > spinlock_t psr_list_lock; > }; > > -int rockchip_register_crtc_funcs(struct drm_crtc *crtc, > - const struct rockchip_crtc_funcs *crtc_funcs); > -void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc); > int rockchip_drm_dma_attach_device(struct drm_device *drm_dev, > struct device *dev); > void rockchip_drm_dma_detach_device(struct drm_device *drm_dev, > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c > index fb5f001f51c3..ffee8d8c3794 100644 > ---
[PATCH v3 17/23] drm: rockchip: remove struct rockchip_crtc_funcs
From: Shawn GuoWith the vblank hooks in struct drm_crtc_funcs, we do not need to maintain struct rockchip_crtc_funcs and the related registration functions. Remove them. Signed-off-by: Shawn Guo Cc: Mark Yao --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 51 - drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 14 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 9 ++--- 3 files changed, 2 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 39243480c834..7719b9cd5b74 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -74,55 +74,6 @@ void rockchip_drm_dma_detach_device(struct drm_device *drm_dev, arm_iommu_detach_device(dev); } -int rockchip_register_crtc_funcs(struct drm_crtc *crtc, -const struct rockchip_crtc_funcs *crtc_funcs) -{ - int pipe = drm_crtc_index(crtc); - struct rockchip_drm_private *priv = crtc->dev->dev_private; - - if (pipe >= ROCKCHIP_MAX_CRTC) - return -EINVAL; - - priv->crtc_funcs[pipe] = crtc_funcs; - - return 0; -} - -void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc) -{ - int pipe = drm_crtc_index(crtc); - struct rockchip_drm_private *priv = crtc->dev->dev_private; - - if (pipe >= ROCKCHIP_MAX_CRTC) - return; - - priv->crtc_funcs[pipe] = NULL; -} - -static int rockchip_drm_crtc_enable_vblank(struct drm_device *dev, - unsigned int pipe) -{ - struct rockchip_drm_private *priv = dev->dev_private; - struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); - - if (crtc && priv->crtc_funcs[pipe] && - priv->crtc_funcs[pipe]->enable_vblank) - return priv->crtc_funcs[pipe]->enable_vblank(crtc); - - return 0; -} - -static void rockchip_drm_crtc_disable_vblank(struct drm_device *dev, -unsigned int pipe) -{ - struct rockchip_drm_private *priv = dev->dev_private; - struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); - - if (crtc && priv->crtc_funcs[pipe] && - priv->crtc_funcs[pipe]->enable_vblank) - priv->crtc_funcs[pipe]->disable_vblank(crtc); -} - static int rockchip_drm_bind(struct device *dev) { struct drm_device *drm_dev; @@ -270,8 +221,6 @@ static void rockchip_drm_lastclose(struct drm_device *dev) .driver_features= DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | DRIVER_ATOMIC, .lastclose = rockchip_drm_lastclose, - .enable_vblank = rockchip_drm_crtc_enable_vblank, - .disable_vblank = rockchip_drm_crtc_disable_vblank, .gem_vm_ops = _gem_cma_vm_ops, .gem_free_object_unlocked = rockchip_gem_free_object, .dumb_create= rockchip_gem_dumb_create, diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index fb6226cf84b7..9f9bc959b108 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h @@ -31,16 +31,6 @@ struct drm_device; struct drm_connector; -/* - * Rockchip drm private crtc funcs. - * @enable_vblank: enable crtc vblank irq. - * @disable_vblank: disable crtc vblank irq. - */ -struct rockchip_crtc_funcs { - int (*enable_vblank)(struct drm_crtc *crtc); - void (*disable_vblank)(struct drm_crtc *crtc); -}; - struct rockchip_crtc_state { struct drm_crtc_state base; int output_type; @@ -58,16 +48,12 @@ struct rockchip_crtc_state { struct rockchip_drm_private { struct drm_fb_helper fbdev_helper; struct drm_gem_object *fbdev_bo; - const struct rockchip_crtc_funcs *crtc_funcs[ROCKCHIP_MAX_CRTC]; struct drm_atomic_state *state; struct list_head psr_list; spinlock_t psr_list_lock; }; -int rockchip_register_crtc_funcs(struct drm_crtc *crtc, -const struct rockchip_crtc_funcs *crtc_funcs); -void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc); int rockchip_drm_dma_attach_device(struct drm_device *drm_dev, struct device *dev); void rockchip_drm_dma_detach_device(struct drm_device *drm_dev, diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index fb5f001f51c3..ffee8d8c3794 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -853,11 +853,6 @@ static void vop_crtc_disable_vblank(struct drm_crtc *crtc) spin_unlock_irqrestore(>irq_lock, flags); } -static const struct rockchip_crtc_funcs private_crtc_funcs = { -