diff mbox

[v3,18/20] drm: omapdrm: Make pipe2vbl function static

Message ID 1474288063-5315-19-git-send-email-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart Sept. 19, 2016, 12:27 p.m. UTC
The function is only used in omap_irq.c, move it there and make it
static.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/omap_crtc.c | 7 -------
 drivers/gpu/drm/omapdrm/omap_drv.h  | 1 -
 drivers/gpu/drm/omapdrm/omap_irq.c  | 7 ++++++-
 3 files changed, 6 insertions(+), 9 deletions(-)

Comments

Tomi Valkeinen Dec. 12, 2016, 10:41 a.m. UTC | #1
On 19/09/16 15:27, Laurent Pinchart wrote:
> The function is only used in omap_irq.c, move it there and make it
> static.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/gpu/drm/omapdrm/omap_crtc.c | 7 -------
>  drivers/gpu/drm/omapdrm/omap_drv.h  | 1 -
>  drivers/gpu/drm/omapdrm/omap_irq.c  | 7 ++++++-
>  3 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 6983a889d811..fb01357721fe 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -48,13 +48,6 @@ struct omap_crtc {
>   * Helper Functions
>   */
>  
> -uint32_t pipe2vbl(struct drm_crtc *crtc)
> -{
> -	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> -
> -	return dispc_mgr_get_vsync_irq(omap_crtc->channel);
> -}
> -
>  struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc)
>  {
>  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
> index 8aa8e45098a2..4fee7b94eefb 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.h
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.h
> @@ -234,7 +234,6 @@ struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
>  		struct dma_buf *buffer);
>  
>  /* map crtc to vblank mask */
> -uint32_t pipe2vbl(struct drm_crtc *crtc);
>  struct omap_dss_device *omap_encoder_get_dssdev(struct drm_encoder *encoder);
>  
>  #endif /* __OMAP_DRV_H__ */
> diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
> index 27225492c81b..28ff7b73a853 100644
> --- a/drivers/gpu/drm/omapdrm/omap_irq.c
> +++ b/drivers/gpu/drm/omapdrm/omap_irq.c
> @@ -108,6 +108,11 @@ int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
>  	return 0;
>  }
>  
> +static uint32_t pipe2vbl(struct drm_crtc *crtc)
> +{
> +	return dispc_mgr_get_vsync_irq(omap_crtc_channel(crtc));
> +}
> +
>  /**
>   * enable_vblank - enable vblank interrupt events
>   * @dev: DRM device
> @@ -228,7 +233,7 @@ static irqreturn_t omap_irq_handler(int irq, void *arg)
>  		struct drm_crtc *crtc = priv->crtcs[id];
>  		enum omap_channel channel = omap_crtc_channel(crtc);
>  
> -		if (irqstatus & pipe2vbl(crtc)) {
> +		if (irqstatus & dispc_mgr_get_vsync_irq(channel)) {
>  			drm_handle_vblank(dev, id);
>  			omap_crtc_vblank_irq(crtc);
>  		}
> 

Did you look at the code you have above =).

I think the bottom change is a good one. Just remove pipe2vbl().

 Tomi
Laurent Pinchart Dec. 12, 2016, 11:17 p.m. UTC | #2
Hi Tomi,

On Monday 12 Dec 2016 12:41:11 Tomi Valkeinen wrote:
> On 19/09/16 15:27, Laurent Pinchart wrote:
> > The function is only used in omap_irq.c, move it there and make it
> > static.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> > 
> >  drivers/gpu/drm/omapdrm/omap_crtc.c | 7 -------
> >  drivers/gpu/drm/omapdrm/omap_drv.h  | 1 -
> >  drivers/gpu/drm/omapdrm/omap_irq.c  | 7 ++++++-
> >  3 files changed, 6 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c
> > b/drivers/gpu/drm/omapdrm/omap_crtc.c index 6983a889d811..fb01357721fe
> > 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> > +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> > @@ -48,13 +48,6 @@ struct omap_crtc {
> >   * Helper Functions
> >   */
> > 
> > -uint32_t pipe2vbl(struct drm_crtc *crtc)
> > -{
> > -	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> > -
> > -	return dispc_mgr_get_vsync_irq(omap_crtc->channel);
> > -}
> > -
> >  struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc)
> >  {
> >  	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> > diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h
> > b/drivers/gpu/drm/omapdrm/omap_drv.h index 8aa8e45098a2..4fee7b94eefb
> > 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_drv.h
> > +++ b/drivers/gpu/drm/omapdrm/omap_drv.h
> > @@ -234,7 +234,6 @@ struct drm_gem_object *omap_gem_prime_import(struct
> > drm_device *dev,
> >  		struct dma_buf *buffer);
> >  
> >  /* map crtc to vblank mask */
> > -uint32_t pipe2vbl(struct drm_crtc *crtc);
> > 
> >  struct omap_dss_device *omap_encoder_get_dssdev(struct drm_encoder
> >  *encoder);
> >  
> >  #endif /* __OMAP_DRV_H__ */
> > diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c
> > b/drivers/gpu/drm/omapdrm/omap_irq.c index 27225492c81b..28ff7b73a853
> > 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_irq.c
> > +++ b/drivers/gpu/drm/omapdrm/omap_irq.c
> > @@ -108,6 +108,11 @@ int omap_irq_wait(struct drm_device *dev, struct
> > omap_irq_wait *wait,
> >  	return 0;
> >  }
> > 
> > +static uint32_t pipe2vbl(struct drm_crtc *crtc)
> > +{
> > +	return dispc_mgr_get_vsync_irq(omap_crtc_channel(crtc));
> > +}
> > +
> >  /**
> >   * enable_vblank - enable vblank interrupt events
> >   * @dev: DRM device
> > @@ -228,7 +233,7 @@ static irqreturn_t omap_irq_handler(int irq, void
> > *arg)
> >  		struct drm_crtc *crtc = priv->crtcs[id];
> >  		enum omap_channel channel = omap_crtc_channel(crtc);
> > 
> > -		if (irqstatus & pipe2vbl(crtc)) {
> > +		if (irqstatus & dispc_mgr_get_vsync_irq(channel)) {
> >  			drm_handle_vblank(dev, id);
> >  			omap_crtc_vblank_irq(crtc);
> >  		}
> 
> Did you look at the code you have above =).

I've added this change because the function already retrieved the channel 
number, so it's pointless to duplicate the operation.

> I think the bottom change is a good one. Just remove pipe2vbl().

The result fits in 80 columns, so I'm OK :-) I'll remove it.
diff mbox

Patch

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 6983a889d811..fb01357721fe 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -48,13 +48,6 @@  struct omap_crtc {
  * Helper Functions
  */
 
-uint32_t pipe2vbl(struct drm_crtc *crtc)
-{
-	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
-
-	return dispc_mgr_get_vsync_irq(omap_crtc->channel);
-}
-
 struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc)
 {
 	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 8aa8e45098a2..4fee7b94eefb 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -234,7 +234,6 @@  struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
 		struct dma_buf *buffer);
 
 /* map crtc to vblank mask */
-uint32_t pipe2vbl(struct drm_crtc *crtc);
 struct omap_dss_device *omap_encoder_get_dssdev(struct drm_encoder *encoder);
 
 #endif /* __OMAP_DRV_H__ */
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
index 27225492c81b..28ff7b73a853 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -108,6 +108,11 @@  int omap_irq_wait(struct drm_device *dev, struct omap_irq_wait *wait,
 	return 0;
 }
 
+static uint32_t pipe2vbl(struct drm_crtc *crtc)
+{
+	return dispc_mgr_get_vsync_irq(omap_crtc_channel(crtc));
+}
+
 /**
  * enable_vblank - enable vblank interrupt events
  * @dev: DRM device
@@ -228,7 +233,7 @@  static irqreturn_t omap_irq_handler(int irq, void *arg)
 		struct drm_crtc *crtc = priv->crtcs[id];
 		enum omap_channel channel = omap_crtc_channel(crtc);
 
-		if (irqstatus & pipe2vbl(crtc)) {
+		if (irqstatus & dispc_mgr_get_vsync_irq(channel)) {
 			drm_handle_vblank(dev, id);
 			omap_crtc_vblank_irq(crtc);
 		}