From: Tom Zanussi <[email protected]>

intel_lvds_init() initializes the lvds backlight even if the lvds init
failed.  That doesn't make sense, and causes unnecessary error
messages in the kernel log.

Put the backlight init code into a separat function and only call it
if the lvds panel was successfully initialized.

Signed-off-by: Tom Zanussi <[email protected]>
---
 drivers/gpu/drm-psb/intel_lvds.c |   51 ++++++++++++++++++++-----------------
 1 files changed, 28 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm-psb/intel_lvds.c b/drivers/gpu/drm-psb/intel_lvds.c
index 218e895..6a55c9b 100644
--- a/drivers/gpu/drm-psb/intel_lvds.c
+++ b/drivers/gpu/drm-psb/intel_lvds.c
@@ -611,6 +611,33 @@ int intel_get_acpi_dod(char *method)
        kfree(buffer.pointer);
        return found;
 }
+
+static void intel_lvds_backlight_init(struct drm_device *dev)
+{
+       if ((blc_type == BLC_I2C_TYPE) || (blc_type == BLC_PWM_TYPE)){  
+               struct backlight_properties props;
+               memset(&props, 0, sizeof(struct backlight_properties));
+               props.type = BACKLIGHT_RAW;
+               /* add /sys/class/backlight interface as standard */
+               psbbl_device = backlight_device_register("psblvds", 
&dev->pdev->dev, dev, &psbbl_ops, &props);
+               if (psbbl_device){
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
+                       down(&psbbl_device->sem);
+                       psbbl_device->props->max_brightness = 
BRIGHTNESS_MAX_LEVEL;
+                       psbbl_device->props->brightness = lvds_backlight;
+                       psbbl_device->props->power = FB_BLANK_UNBLANK;
+                       psbbl_device->props->update_status(psbbl_device);
+                       up(&psbbl_device->sem);
+#else
+                       psbbl_device->props.max_brightness = 
BRIGHTNESS_MAX_LEVEL;
+                       psbbl_device->props.brightness = lvds_backlight;
+                       psbbl_device->props.power = FB_BLANK_UNBLANK;
+                       backlight_update_status(psbbl_device);
+#endif
+               }
+       }
+}
+
 /**
  * intel_lvds_init - setup LVDS outputs on this device
  * @dev: drm device
@@ -802,29 +829,6 @@ void intel_lvds_init(struct drm_device *dev)
                }
        }
 
-       if ((blc_type == BLC_I2C_TYPE) || (blc_type == BLC_PWM_TYPE)){  
-               struct backlight_properties props;
-               memset(&props, 0, sizeof(struct backlight_properties));
-               props.type = BACKLIGHT_RAW;
-               /* add /sys/class/backlight interface as standard */
-               psbbl_device = backlight_device_register("psblvds", 
&dev->pdev->dev, dev, &psbbl_ops, &props);
-               if (psbbl_device){
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,20)
-                       down(&psbbl_device->sem);
-                       psbbl_device->props->max_brightness = 
BRIGHTNESS_MAX_LEVEL;
-                       psbbl_device->props->brightness = lvds_backlight;
-                       psbbl_device->props->power = FB_BLANK_UNBLANK;
-                       psbbl_device->props->update_status(psbbl_device);
-                       up(&psbbl_device->sem);
-#else
-                       psbbl_device->props.max_brightness = 
BRIGHTNESS_MAX_LEVEL;
-                       psbbl_device->props.brightness = lvds_backlight;
-                       psbbl_device->props.power = FB_BLANK_UNBLANK;
-                       backlight_update_status(psbbl_device);
-#endif
-               }
-       }
-
 blc_out:
 
        /* Set up the DDC bus. */
@@ -939,6 +943,7 @@ blc_out:
 #endif
 
 out:
+       intel_lvds_backlight_init(dev);
        return;
 
 failed:
-- 
1.7.0.4

_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to