diff mbox series

[1/6] drm/i915: Use local variable for SSEU info in GETPARAM ioctl

Message ID 20190501153450.30494-2-stuart.summers@intel.com (mailing list archive)
State New, archived
Headers show
Series Refactor to expand subslice mask | expand

Commit Message

Summers, Stuart May 1, 2019, 3:34 p.m. UTC
In the GETPARAM ioctl handler, use a local variable to consolidate
usage of SSEU runtime info.

v2: add const to sseu_dev_info variable

Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Daniele Ceraolo Spurio May 1, 2019, 5:54 p.m. UTC | #1
On 5/1/19 8:34 AM, Stuart Summers wrote:
> In the GETPARAM ioctl handler, use a local variable to consolidate
> usage of SSEU runtime info.
> 
> v2: add const to sseu_dev_info variable
> 
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Signed-off-by: Stuart Summers <stuart.summers@intel.com>

Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

> ---
>   drivers/gpu/drm/i915/i915_drv.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 21dac5a09fbe..c376244c19c4 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -324,6 +324,7 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data,
>   {
>   	struct drm_i915_private *dev_priv = to_i915(dev);
>   	struct pci_dev *pdev = dev_priv->drm.pdev;
> +	const struct sseu_dev_info *sseu = &RUNTIME_INFO(dev_priv)->sseu;
>   	drm_i915_getparam_t *param = data;
>   	int value;
>   
> @@ -377,12 +378,12 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data,
>   		value = i915_cmd_parser_get_version(dev_priv);
>   		break;
>   	case I915_PARAM_SUBSLICE_TOTAL:
> -		value = sseu_subslice_total(&RUNTIME_INFO(dev_priv)->sseu);
> +		value = sseu_subslice_total(sseu);
>   		if (!value)
>   			return -ENODEV;
>   		break;
>   	case I915_PARAM_EU_TOTAL:
> -		value = RUNTIME_INFO(dev_priv)->sseu.eu_total;
> +		value = sseu->eu_total;
>   		if (!value)
>   			return -ENODEV;
>   		break;
> @@ -399,7 +400,7 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data,
>   		value = HAS_POOLED_EU(dev_priv);
>   		break;
>   	case I915_PARAM_MIN_EU_IN_POOL:
> -		value = RUNTIME_INFO(dev_priv)->sseu.min_eu_in_pool;
> +		value = sseu->min_eu_in_pool;
>   		break;
>   	case I915_PARAM_HUC_STATUS:
>   		value = intel_huc_check_status(&dev_priv->huc);
> @@ -449,12 +450,12 @@ static int i915_getparam_ioctl(struct drm_device *dev, void *data,
>   		value = intel_engines_has_context_isolation(dev_priv);
>   		break;
>   	case I915_PARAM_SLICE_MASK:
> -		value = RUNTIME_INFO(dev_priv)->sseu.slice_mask;
> +		value = sseu->slice_mask;
>   		if (!value)
>   			return -ENODEV;
>   		break;
>   	case I915_PARAM_SUBSLICE_MASK:
> -		value = RUNTIME_INFO(dev_priv)->sseu.subslice_mask[0];
> +		value = sseu->subslice_mask[0];
>   		if (!value)
>   			return -ENODEV;
>   		break;
>
Summers, Stuart May 1, 2019, 7:38 p.m. UTC | #2
On Wed, 2019-05-01 at 10:54 -0700, Daniele Ceraolo Spurio wrote:
> 
> On 5/1/19 8:34 AM, Stuart Summers wrote:
> > In the GETPARAM ioctl handler, use a local variable to consolidate
> > usage of SSEU runtime info.
> > 
> > v2: add const to sseu_dev_info variable
> > 
> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> > Signed-off-by: Stuart Summers <stuart.summers@intel.com>
> 

Thanks for the review!

-Stuart

> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> 
> > ---
> >   drivers/gpu/drm/i915/i915_drv.c | 11 ++++++-----
> >   1 file changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c
> > b/drivers/gpu/drm/i915/i915_drv.c
> > index 21dac5a09fbe..c376244c19c4 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -324,6 +324,7 @@ static int i915_getparam_ioctl(struct
> > drm_device *dev, void *data,
> >   {
> >   	struct drm_i915_private *dev_priv = to_i915(dev);
> >   	struct pci_dev *pdev = dev_priv->drm.pdev;
> > +	const struct sseu_dev_info *sseu = &RUNTIME_INFO(dev_priv)-
> > >sseu;
> >   	drm_i915_getparam_t *param = data;
> >   	int value;
> >   
> > @@ -377,12 +378,12 @@ static int i915_getparam_ioctl(struct
> > drm_device *dev, void *data,
> >   		value = i915_cmd_parser_get_version(dev_priv);
> >   		break;
> >   	case I915_PARAM_SUBSLICE_TOTAL:
> > -		value = sseu_subslice_total(&RUNTIME_INFO(dev_priv)-
> > >sseu);
> > +		value = sseu_subslice_total(sseu);
> >   		if (!value)
> >   			return -ENODEV;
> >   		break;
> >   	case I915_PARAM_EU_TOTAL:
> > -		value = RUNTIME_INFO(dev_priv)->sseu.eu_total;
> > +		value = sseu->eu_total;
> >   		if (!value)
> >   			return -ENODEV;
> >   		break;
> > @@ -399,7 +400,7 @@ static int i915_getparam_ioctl(struct
> > drm_device *dev, void *data,
> >   		value = HAS_POOLED_EU(dev_priv);
> >   		break;
> >   	case I915_PARAM_MIN_EU_IN_POOL:
> > -		value = RUNTIME_INFO(dev_priv)->sseu.min_eu_in_pool;
> > +		value = sseu->min_eu_in_pool;
> >   		break;
> >   	case I915_PARAM_HUC_STATUS:
> >   		value = intel_huc_check_status(&dev_priv->huc);
> > @@ -449,12 +450,12 @@ static int i915_getparam_ioctl(struct
> > drm_device *dev, void *data,
> >   		value = intel_engines_has_context_isolation(dev_priv);
> >   		break;
> >   	case I915_PARAM_SLICE_MASK:
> > -		value = RUNTIME_INFO(dev_priv)->sseu.slice_mask;
> > +		value = sseu->slice_mask;
> >   		if (!value)
> >   			return -ENODEV;
> >   		break;
> >   	case I915_PARAM_SUBSLICE_MASK:
> > -		value = RUNTIME_INFO(dev_priv)->sseu.subslice_mask[0];
> > +		value = sseu->subslice_mask[0];
> >   		if (!value)
> >   			return -ENODEV;
> >   		break;
> >
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 21dac5a09fbe..c376244c19c4 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -324,6 +324,7 @@  static int i915_getparam_ioctl(struct drm_device *dev, void *data,
 {
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct pci_dev *pdev = dev_priv->drm.pdev;
+	const struct sseu_dev_info *sseu = &RUNTIME_INFO(dev_priv)->sseu;
 	drm_i915_getparam_t *param = data;
 	int value;
 
@@ -377,12 +378,12 @@  static int i915_getparam_ioctl(struct drm_device *dev, void *data,
 		value = i915_cmd_parser_get_version(dev_priv);
 		break;
 	case I915_PARAM_SUBSLICE_TOTAL:
-		value = sseu_subslice_total(&RUNTIME_INFO(dev_priv)->sseu);
+		value = sseu_subslice_total(sseu);
 		if (!value)
 			return -ENODEV;
 		break;
 	case I915_PARAM_EU_TOTAL:
-		value = RUNTIME_INFO(dev_priv)->sseu.eu_total;
+		value = sseu->eu_total;
 		if (!value)
 			return -ENODEV;
 		break;
@@ -399,7 +400,7 @@  static int i915_getparam_ioctl(struct drm_device *dev, void *data,
 		value = HAS_POOLED_EU(dev_priv);
 		break;
 	case I915_PARAM_MIN_EU_IN_POOL:
-		value = RUNTIME_INFO(dev_priv)->sseu.min_eu_in_pool;
+		value = sseu->min_eu_in_pool;
 		break;
 	case I915_PARAM_HUC_STATUS:
 		value = intel_huc_check_status(&dev_priv->huc);
@@ -449,12 +450,12 @@  static int i915_getparam_ioctl(struct drm_device *dev, void *data,
 		value = intel_engines_has_context_isolation(dev_priv);
 		break;
 	case I915_PARAM_SLICE_MASK:
-		value = RUNTIME_INFO(dev_priv)->sseu.slice_mask;
+		value = sseu->slice_mask;
 		if (!value)
 			return -ENODEV;
 		break;
 	case I915_PARAM_SUBSLICE_MASK:
-		value = RUNTIME_INFO(dev_priv)->sseu.subslice_mask[0];
+		value = sseu->subslice_mask[0];
 		if (!value)
 			return -ENODEV;
 		break;