diff mbox

[6/7] drm/i915: Rename 'reg' to 'clk_reg' to unconfuse it from the other 'reg'

Message ID 1421668253-18641-7-git-send-email-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjala Jan. 19, 2015, 11:50 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

On VLV/CHV the rc6 residency calculations read a second register to
determine the actual units used for the residency value. The variable
name 'reg' where that register value is stored shadows the function
argument 'reg'. That can easily leave the readed utterly confused, so
rename the internal variable to 'clk_reg'.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_sysfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Chris Wilson Jan. 19, 2015, 12:17 p.m. UTC | #1
On Mon, Jan 19, 2015 at 01:50:52PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> On VLV/CHV the rc6 residency calculations read a second register to
> determine the actual units used for the residency value. The variable
> name 'reg' where that register value is stored shadows the function
> argument 'reg'. That can easily leave the readed utterly confused, so
> rename the internal variable to 'clk_reg'.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
Chris Wilson Jan. 19, 2015, 12:24 p.m. UTC | #2
On Mon, Jan 19, 2015 at 01:50:52PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> On VLV/CHV the rc6 residency calculations read a second register to
> determine the actual units used for the residency value. The variable
> name 'reg' where that register value is stored shadows the function
> argument 'reg'. That can easily leave the readed utterly confused, so
> rename the internal variable to 'clk_reg'.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
deepak.s@linux.intel.com Jan. 20, 2015, 3:22 a.m. UTC | #3
On Monday 19 January 2015 05:20 PM, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> On VLV/CHV the rc6 residency calculations read a second register to
> determine the actual units used for the residency value. The variable
> name 'reg' where that register value is stored shadows the function
> argument 'reg'. That can easily leave the readed utterly confused, so
> rename the internal variable to 'clk_reg'.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/i915_sysfs.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
> index 04174f0..1ca944b 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -49,14 +49,14 @@ static u32 calc_residency(struct drm_device *dev, const u32 reg)
>   
>   	/* On VLV and CHV, residency time is in CZ units rather than 1.28us */
>   	if (IS_VALLEYVIEW(dev)) {
> -		u32 reg, czcount_30ns;
> +		u32 clk_reg, czcount_30ns;
>   
>   		if (IS_CHERRYVIEW(dev))
> -			reg = CHV_CLK_CTL1;
> +			clk_reg = CHV_CLK_CTL1;
>   		else
> -			reg = VLV_CLK_CTL2;
> +			clk_reg = VLV_CLK_CTL2;
>   
> -		czcount_30ns = I915_READ(reg) >> CLK_CTL2_CZCOUNT_30NS_SHIFT;
> +		czcount_30ns = I915_READ(clk_reg) >> CLK_CTL2_CZCOUNT_30NS_SHIFT;
>   
>   		if (!czcount_30ns) {
>   			WARN(!czcount_30ns, "bogus CZ count value");

Reviewed-by: Deepak S<deepak.s@linux.intel.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index 04174f0..1ca944b 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -49,14 +49,14 @@  static u32 calc_residency(struct drm_device *dev, const u32 reg)
 
 	/* On VLV and CHV, residency time is in CZ units rather than 1.28us */
 	if (IS_VALLEYVIEW(dev)) {
-		u32 reg, czcount_30ns;
+		u32 clk_reg, czcount_30ns;
 
 		if (IS_CHERRYVIEW(dev))
-			reg = CHV_CLK_CTL1;
+			clk_reg = CHV_CLK_CTL1;
 		else
-			reg = VLV_CLK_CTL2;
+			clk_reg = VLV_CLK_CTL2;
 
-		czcount_30ns = I915_READ(reg) >> CLK_CTL2_CZCOUNT_30NS_SHIFT;
+		czcount_30ns = I915_READ(clk_reg) >> CLK_CTL2_CZCOUNT_30NS_SHIFT;
 
 		if (!czcount_30ns) {
 			WARN(!czcount_30ns, "bogus CZ count value");