backlight: initialize struct backlight_properties properly
Subsystems (9)
PATCH 1/1 backlight: initialize struct backlight_properties properly
In all these files, the .power field was never correctly initialized.
--- drivers/gpu/drm/i915/intel_panel.c | 1 + drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 1 + drivers/platform/x86/toshiba_acpi.c | 1 + drivers/video/backlight/da903x_bl.c | 1 + drivers/video/backlight/pcf50633-backlight.c | 1 + drivers/video/backlight/wm831x_bl.c | 1 + drivers/video/omap2/displays/panel-acx565akm.c | 1 + 7 files changed, 7 insertions(+)
drivers/gpu/drm/i915/intel_panel.c +1 -0
@@ -342,6 +342,7 @@ int intel_panel_setup_backlight(struct drm_device *dev)else return -ENODEV ; +memset (&props,0 ,sizeof (props)); props.type =BACKLIGHT_RAW ; props.max_brightness =intel_panel_get_max_backlight (dev); dev_priv->backlight =
drivers/gpu/drm/radeon/radeon_legacy_encoders.c +1 -0
@@ -369,6 +369,7 @@ void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder, goto error; } +memset (&props,0 ,sizeof (props)); props.max_brightness =MAX_RADEON_LEVEL ; props.type =BACKLIGHT_RAW ; bd = backlight_device_register("radeon_bl", &drm_connector->kdev,
drivers/platform/x86/toshiba_acpi.c +1 -0
@@ -1095,6 +1095,7 @@ static int __devinit toshiba_acpi_setup_backlight(struct toshiba_acpi_dev *dev) ret =get_tr_backlight_status (dev, &enabled); dev->tr_backlight_supported = !ret; +memset (&props,0 ,sizeof (props)); props.type =BACKLIGHT_PLATFORM ; props.max_brightness =HCI_LCD_BRIGHTNESS_LEVELS -1 ;
drivers/video/backlight/da903x_bl.c +1 -0
@@ -136,6 +136,7 @@ static int da903x_backlight_probe(struct platform_device *pdev)da903x_write (data->da903x_dev,DA9034_WLED_CONTROL2 ,DA9034_WLED_ISET (pdata->output_current)); +memset (&props,0 ,sizeof (props)); props.type =BACKLIGHT_RAW ; props.max_brightness = max_brightness; bl = backlight_device_register(pdev->name, data->da903x_dev, data,
drivers/video/backlight/pcf50633-backlight.c +1 -0
@@ -111,6 +111,7 @@ static int __devinit pcf50633_bl_probe(struct platform_device *pdev)if (!pcf_bl)return -ENOMEM ; +memset (&bl_props,0 ,sizeof (bl_props)); bl_props.type =BACKLIGHT_RAW ; bl_props.max_brightness =0x3f ; bl_props.power =FB_BLANK_UNBLANK ;
drivers/video/backlight/wm831x_bl.c +1 -0
@@ -194,6 +194,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev) data->current_brightness =0 ; data->isink_reg = isink_reg; +memset (&props,0 ,sizeof (props)); props.type =BACKLIGHT_RAW ; props.max_brightness = max_isel; bl = backlight_device_register("wm831x", &pdev->dev, data,
drivers/video/omap2/displays/panel-acx565akm.c +1 -0
@@ -532,6 +532,7 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)/*------- Backlight control --------*/ +memset (&props,0 ,sizeof (props)); props.fb_blank =FB_BLANK_UNBLANK ; props.power =FB_BLANK_UNBLANK ; props.type =BACKLIGHT_RAW ;
Signature · 1 line
1.7.9.5
Quoted 4 lines · Corentin Chary
In all these files, the .power field was never correctly initialized.
Signed-off-by Corentin Chary <[email protected]>
It looks good.
Best regards,
Jingoo Han
Quoted 103 lines
--- drivers/gpu/drm/i915/intel_panel.c | 1 + drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 1 + drivers/platform/x86/toshiba_acpi.c | 1 + drivers/video/backlight/da903x_bl.c | 1 + drivers/video/backlight/pcf50633-backlight.c | 1 + drivers/video/backlight/wm831x_bl.c | 1 + drivers/video/omap2/displays/panel-acx565akm.c | 1 + 7 files changed, 7 insertions(+)drivers/gpu/drm/i915/intel_panel.c +1
-0@@ -342,6 +342,7 @@ int intel_panel_setup_backlight(struct drm_device *dev)else return -ENODEV ; +memset (&props,0 ,sizeof (props)); props.type =BACKLIGHT_RAW ; props.max_brightness =intel_panel_get_max_backlight (dev); dev_priv->backlight =drivers/gpu/drm/radeon/radeon_legacy_encoders.c +1
-0@@ -369,6 +369,7 @@ void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder, goto error; } +memset (&props,0 ,sizeof (props)); props.max_brightness =MAX_RADEON_LEVEL ; props.type =BACKLIGHT_RAW ; bd = backlight_device_register("radeon_bl", &drm_connector->kdev,drivers/platform/x86/toshiba_acpi.c +1
-0@@ -1095,6 +1095,7 @@ static int __devinit toshiba_acpi_setup_backlight(struct toshiba_acpi_dev *dev) ret =get_tr_backlight_status (dev, &enabled); dev->tr_backlight_supported = !ret; +memset (&props,0 ,sizeof (props)); props.type =BACKLIGHT_PLATFORM ; props.max_brightness =HCI_LCD_BRIGHTNESS_LEVELS -1 ;drivers/video/backlight/da903x_bl.c +1
-0@@ -136,6 +136,7 @@ static int da903x_backlight_probe(struct platform_device *pdev)da903x_write (data->da903x_dev,DA9034_WLED_CONTROL2 ,DA9034_WLED_ISET (pdata->output_current)); +memset (&props,0 ,sizeof (props)); props.type =BACKLIGHT_RAW ; props.max_brightness = max_brightness; bl = backlight_device_register(pdev->name, data->da903x_dev, data,drivers/video/backlight/pcf50633-backlight.c +1
-0@@ -111,6 +111,7 @@ static int __devinit pcf50633_bl_probe(struct platform_device *pdev)if (!pcf_bl)return -ENOMEM ; +memset (&bl_props,0 ,sizeof (bl_props)); bl_props.type =BACKLIGHT_RAW ; bl_props.max_brightness =0x3f ; bl_props.power =FB_BLANK_UNBLANK ;drivers/video/backlight/wm831x_bl.c +1
-0@@ -194,6 +194,7 @@ static int wm831x_backlight_probe(struct platform_device *pdev) data->current_brightness =0 ; data->isink_reg = isink_reg; +memset (&props,0 ,sizeof (props)); props.type =BACKLIGHT_RAW ; props.max_brightness = max_isel; bl = backlight_device_register("wm831x", &pdev->dev, data,drivers/video/omap2/displays/panel- renamed from drivers/video/omap2/displays/panel-acx565akm.c +0
-0
acx565akm.c
index d26f37a..74e7cf0 100644drivers/video/omap2/displays/panel-acx565akm.c +1
-1@@ -532,6 +532,7 @@ static int acx_panel_probe(struct omap_dss_device *dssdev)/*------- Backlight control --------*/ +memset (&props,0 ,sizeof (props)); props.fb_blank =FB_BLANK_UNBLANK ; props.power =FB_BLANK_UNBLANK ; props.type =BACKLIGHT_RAW ; --1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Dave Airlie
maintainerQuoted 6 lines · Corentin Chary
In all these files, the .power field was never correctly initialized.
Signed-off-by Corentin Chary <[email protected]>---
drivers/gpu/drm/i915/intel_panel.c | 1 +drivers/gpu/drm/radeon/radeon_legacy_encoders.c| 1 +
I've taken these two hunks into drm-next.
Dave.
drivers/gpu/drm/i915/intel_panel.c int intel_panel_setup_backlight(struct drm_device *dev) · line 345
Quoted 11 lines · On Mon, 21 May 2012 09:24:35 +0200 Corentin Chary <[email protected]>…
In all these files, the .power field was never correctly initialized.
...
drivers/gpu/drm/i915/intel_panel.c +1
-0@@ -342,6 +342,7 @@ int intel_panel_setup_backlight(struct drm_device *dev)else return -ENODEV ; +memset (&props,0 ,sizeof (props));
This code is all still quite fragile. What happens if we add a new field to backlight_properties? We need to go edit a zillion drivers?
There are two ways of fixing this:
a) write and use
void backlight_properties_init(struct backlight_properties *props,
int type, int max_brightness, etc);
or
b) edit all sites to do
struct backlight_properties bl_props = {
.type = BACKLIGHT_RAW,
.max_brighness = intel_panel_get_max_backlight(dev), .power = FB_BLANK_UNBLANK,
};
they're largely equivalent - the struct will be zeroed out and then certain fields will be initialised. a) is a bit better because some future field may not want the all-zeroes pattern (eg, a spinlock).
But they're both better than what we have now!