Skip to contentSkip to conversation

gma500: silence an unused variable warning

PATCH In review Dan Carpenter 4 participants 4 messages May 10, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gma500: silence an unused variable warning

If CONFIG_BACKLIGHT_CLASS_DEVICE is disabled then GCC warns that:

	drivers/gpu/drm/gma500/opregion.c:154:6: warning:
		unused variable ‘max’ [-Wunused-variable]

Which give me a chance to use the new config_enabled() macro. :)

drivers/gpu/drm/gma500/opregion.c +6 -6
index 05661bf..d2125ba 100644
@@ -151,7 +151,6 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	struct opregion_asle *asle = dev_priv->opregion.asle;
 	struct backlight_device *bd = dev_priv->backlight_device;
-	u32 max;
 
 	DRM_DEBUG_DRIVER("asle set backlight %x\n", bclp);
 
@@ -165,11 +164,12 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	if (bclp > 255)
 		return ASLE_BACKLIGHT_FAILED;
 
-#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
-	max = bd->props.max_brightness;
-	bd->props.brightness = bclp * max / 255;
-	backlight_update_status(bd);
-#endif
+	if (config_enabled(CONFIG_BACKLIGHT_CLASS_DEVICE)) {
+		int max = bd->props.max_brightness;
+		bd->props.brightness = bclp * max / 255;
+		backlight_update_status(bd);
+	}
+
 	asle->cblv = (bclp * 0x64) / 0xff | ASLE_CBLV_VALID;
 
 	return 0;
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dan Carpenter

If CONFIG_BACKLIGHT_CLASS_DEVICE is disabled then GCC warns that:

	drivers/gpu/drm/gma500/opregion.c:154:6: warning:
		unused variable ‘max’ [-Wunused-variable]

Which give me a chance to use the new config_enabled() macro. :)

The first [direct] user of config_enabled()! :)

Quoted 33 lines
drivers/gpu/drm/gma500/opregion.c +6 -6
index 05661bf..d2125ba 100644
@@ -151,7 +151,6 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	struct opregion_asle *asle = dev_priv->opregion.asle;
 	struct backlight_device *bd = dev_priv->backlight_device;
-	u32 max;
 
 	DRM_DEBUG_DRIVER("asle set backlight %x\n", bclp);
 
@@ -165,11 +164,12 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	if (bclp > 255)
 		return ASLE_BACKLIGHT_FAILED;
 
-#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
-	max = bd->props.max_brightness;
-	bd->props.brightness = bclp * max / 255;
-	backlight_update_status(bd);
-#endif
+	if (config_enabled(CONFIG_BACKLIGHT_CLASS_DEVICE)) {
+		int max = bd->props.max_brightness;
+		bd->props.brightness = bclp * max / 255;
+		backlight_update_status(bd);
+	}
+
 	asle->cblv = (bclp * 0x64) / 0xff | ASLE_CBLV_VALID;
 
 	return 0;
Signature · 1 line
 Kirill A. Shutemov

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Acked-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter

Am Donnerstag, den 10.05.2012, 10:33 +0300 schrieb Dan Carpenter:

Quoted 5 lines

If CONFIG_BACKLIGHT_CLASS_DEVICE is disabled then GCC warns that:

	drivers/gpu/drm/gma500/opregion.c:154:6: warning:
		unused variable ‘max’ [-Wunused-variable]

Which give me a chance to use the new config_enabled() macro. :)

Also the variable type is changed from u32 to int.

Quoted 1 line
Quoted 20 lines
drivers/gpu/drm/gma500/opregion.c +0 -5
index 05661bf..d2125ba 100644
@@ -151,7 +151,6 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	struct opregion_asle *asle = dev_priv->opregion.asle;
 	struct backlight_device *bd = dev_priv->backlight_device;
-	u32 max;
 
 	DRM_DEBUG_DRIVER("asle set backlight %x\n", bclp);
 
@@ -165,11 +164,12 @@ static u32 asle_set_backlight(struct drm_device *dev, u32 bclp)
 	if (bclp > 255)
 		return ASLE_BACKLIGHT_FAILED;
 
-#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
-	max = bd->props.max_brightness;
-	bd->props.brightness = bclp * max / 255;
-	backlight_update_status(bd);

drivers/gpu/drm/gma500/opregion.c static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) · line 175

Quoted 10 lines
drivers/gpu/drm/gma500/opregion.c +6 -1
-#endif
+	if (config_enabled(CONFIG_BACKLIGHT_CLASS_DEVICE)) {
+		int max = bd->props.max_brightness;
+		bd->props.brightness = bclp * max / 255;
+		backlight_update_status(bd);
+	}
+
 	asle->cblv = (bclp * 0x64) / 0xff | ASLE_CBLV_VALID;
 
 	return 0;

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

Acked-by on v1 1/1
#3 lore raw
In reply to Dan Carpenter
Quoted 7 lines · On Thu, 10 May 2012 10:33:02 +0300 Dan Carpenter <[email protected]>…

If CONFIG_BACKLIGHT_CLASS_DEVICE is disabled then GCC warns that:

	drivers/gpu/drm/gma500/opregion.c:154:6: warning:
		unused variable ‘max’ [-Wunused-variable]

Which give me a chance to use the new config_enabled() macro. :)

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel