diff mbox

drm/i915: Inline gen6_sanitize_rps_pm_mask()

Message ID 20170312135426.2216-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson March 12, 2017, 1:54 p.m. UTC
gen6_sanitize_rps_pm_mask() is small enough that inlining it shrinks the
object code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_irq.c  | 5 -----
 drivers/gpu/drm/i915/intel_drv.h | 8 +++++++-
 2 files changed, 7 insertions(+), 6 deletions(-)

Comments

Mika Kuoppala March 13, 2017, 1:15 p.m. UTC | #1
Chris Wilson <chris@chris-wilson.co.uk> writes:

> gen6_sanitize_rps_pm_mask() is small enough that inlining it shrinks the
> object code.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_irq.c  | 5 -----
>  drivers/gpu/drm/i915/intel_drv.h | 8 +++++++-
>  2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 89ccf3e1fda5..b8a0afdc26a2 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -389,11 +389,6 @@ void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv)
>  	spin_unlock_irq(&dev_priv->irq_lock);
>  }
>  
> -u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask)
> -{
> -	return (mask & ~dev_priv->rps.pm_intrmsk_mbz);
> -}
> -
>  void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv)
>  {
>  	if (!READ_ONCE(dev_priv->rps.interrupts_enabled))
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 578f7d20501f..4e38682d22b5 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1188,7 +1188,13 @@ void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
>  void gen6_reset_rps_interrupts(struct drm_i915_private *dev_priv);
>  void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv);
>  void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv);
> -u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask);
> +
> +static inline u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *i915,
> +					    u32 mask)

Some opportunity above for const lover. Not that it matters
much with such a short piece.

Sorry if I jumped the queue with this patch, stealing
it from Tvrtko's hands.

Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>

> +{
> +	return mask & ~i915->rps.pm_intrmsk_mbz;
> +}
> +
>  void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv);
>  void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv);
>  static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv)
> -- 
> 2.11.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris Wilson March 13, 2017, 1:24 p.m. UTC | #2
On Mon, Mar 13, 2017 at 03:15:32PM +0200, Mika Kuoppala wrote:
> Chris Wilson <chris@chris-wilson.co.uk> writes:
> 
> > gen6_sanitize_rps_pm_mask() is small enough that inlining it shrinks the
> > object code.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_irq.c  | 5 -----
> >  drivers/gpu/drm/i915/intel_drv.h | 8 +++++++-
> >  2 files changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> > index 89ccf3e1fda5..b8a0afdc26a2 100644
> > --- a/drivers/gpu/drm/i915/i915_irq.c
> > +++ b/drivers/gpu/drm/i915/i915_irq.c
> > @@ -389,11 +389,6 @@ void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv)
> >  	spin_unlock_irq(&dev_priv->irq_lock);
> >  }
> >  
> > -u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask)
> > -{
> > -	return (mask & ~dev_priv->rps.pm_intrmsk_mbz);
> > -}
> > -
> >  void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv)
> >  {
> >  	if (!READ_ONCE(dev_priv->rps.interrupts_enabled))
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index 578f7d20501f..4e38682d22b5 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -1188,7 +1188,13 @@ void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
> >  void gen6_reset_rps_interrupts(struct drm_i915_private *dev_priv);
> >  void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv);
> >  void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv);
> > -u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask);
> > +
> > +static inline u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *i915,
> > +					    u32 mask)
> 
> Some opportunity above for const lover. Not that it matters
> much with such a short piece.

Yeah, the compiler can see but let's add the const just in case we want
to use it from a restricted path.
-Chris
Chris Wilson March 13, 2017, 2:29 p.m. UTC | #3
On Mon, Mar 13, 2017 at 01:24:41PM +0000, Chris Wilson wrote:
> On Mon, Mar 13, 2017 at 03:15:32PM +0200, Mika Kuoppala wrote:
> > Chris Wilson <chris@chris-wilson.co.uk> writes:
> > 
> > > gen6_sanitize_rps_pm_mask() is small enough that inlining it shrinks the
> > > object code.
> > >
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/i915_irq.c  | 5 -----
> > >  drivers/gpu/drm/i915/intel_drv.h | 8 +++++++-
> > >  2 files changed, 7 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> > > index 89ccf3e1fda5..b8a0afdc26a2 100644
> > > --- a/drivers/gpu/drm/i915/i915_irq.c
> > > +++ b/drivers/gpu/drm/i915/i915_irq.c
> > > @@ -389,11 +389,6 @@ void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv)
> > >  	spin_unlock_irq(&dev_priv->irq_lock);
> > >  }
> > >  
> > > -u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask)
> > > -{
> > > -	return (mask & ~dev_priv->rps.pm_intrmsk_mbz);
> > > -}
> > > -
> > >  void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv)
> > >  {
> > >  	if (!READ_ONCE(dev_priv->rps.interrupts_enabled))
> > > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > > index 578f7d20501f..4e38682d22b5 100644
> > > --- a/drivers/gpu/drm/i915/intel_drv.h
> > > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > > @@ -1188,7 +1188,13 @@ void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
> > >  void gen6_reset_rps_interrupts(struct drm_i915_private *dev_priv);
> > >  void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv);
> > >  void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv);
> > > -u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask);
> > > +
> > > +static inline u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *i915,
> > > +					    u32 mask)
> > 
> > Some opportunity above for const lover. Not that it matters
> > much with such a short piece.
> 
> Yeah, the compiler can see but let's add the const just in case we want
> to use it from a restricted path.

Pushed, thanks
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 89ccf3e1fda5..b8a0afdc26a2 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -389,11 +389,6 @@  void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv)
 	spin_unlock_irq(&dev_priv->irq_lock);
 }
 
-u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask)
-{
-	return (mask & ~dev_priv->rps.pm_intrmsk_mbz);
-}
-
 void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv)
 {
 	if (!READ_ONCE(dev_priv->rps.interrupts_enabled))
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 578f7d20501f..4e38682d22b5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1188,7 +1188,13 @@  void gen6_disable_pm_irq(struct drm_i915_private *dev_priv, uint32_t mask);
 void gen6_reset_rps_interrupts(struct drm_i915_private *dev_priv);
 void gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv);
 void gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv);
-u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *dev_priv, u32 mask);
+
+static inline u32 gen6_sanitize_rps_pm_mask(struct drm_i915_private *i915,
+					    u32 mask)
+{
+	return mask & ~i915->rps.pm_intrmsk_mbz;
+}
+
 void intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv);
 void intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv);
 static inline bool intel_irqs_enabled(struct drm_i915_private *dev_priv)