* [patch] gma500: silence an unused variable warning
@ 2012-05-10 7:33 Dan Carpenter
2012-05-10 8:01 ` Kirill A. Shutemov
2012-05-10 15:30 ` Alan Cox
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2012-05-10 7:33 UTC (permalink / raw)
To: David Airlie
Cc: Dave Airlie, kernel-janitors, dri-devel, Kirill A. Shutemov,
Alan Cox
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. :)
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/gpu/drm/gma500/opregion.c b/drivers/gpu/drm/gma500/opregion.c
index 05661bf..d2125ba 100644
--- a/drivers/gpu/drm/gma500/opregion.c
+++ b/drivers/gpu/drm/gma500/opregion.c
@@ -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;
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [patch] gma500: silence an unused variable warning
2012-05-10 7:33 [patch] gma500: silence an unused variable warning Dan Carpenter
@ 2012-05-10 8:01 ` Kirill A. Shutemov
2012-05-10 15:30 ` Alan Cox
1 sibling, 0 replies; 3+ messages in thread
From: Kirill A. Shutemov @ 2012-05-10 8:01 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Dave Airlie, kernel-janitors, dri-devel, Alan Cox
[-- Attachment #1: Type: text/plain, Size: 1669 bytes --]
On Thu, May 10, 2012 at 10:33:02AM +0300, Dan Carpenter wrote:
> 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()! :)
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/gpu/drm/gma500/opregion.c b/drivers/gpu/drm/gma500/opregion.c
> index 05661bf..d2125ba 100644
> --- a/drivers/gpu/drm/gma500/opregion.c
> +++ b/drivers/gpu/drm/gma500/opregion.c
> @@ -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;
--
Kirill A. Shutemov
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [patch] gma500: silence an unused variable warning
2012-05-10 7:33 [patch] gma500: silence an unused variable warning Dan Carpenter
2012-05-10 8:01 ` Kirill A. Shutemov
@ 2012-05-10 15:30 ` Alan Cox
1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2012-05-10 15:30 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Dave Airlie, kernel-janitors, dri-devel, Kirill A. Shutemov
On Thu, 10 May 2012 10:33:02 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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. :)
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Alan Cox <alan@linux.intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-10 15:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-10 7:33 [patch] gma500: silence an unused variable warning Dan Carpenter
2012-05-10 8:01 ` Kirill A. Shutemov
2012-05-10 15:30 ` Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).