]> git.karo-electronics.de Git - linux-beck.git/commitdiff
OMAP: DSS2: Taal: add locks to taal_bl_update_status
authorTomi Valkeinen <tomi.valkeinen@nokia.com>
Thu, 15 Apr 2010 13:41:07 +0000 (16:41 +0300)
committerTomi Valkeinen <tomi.valkeinen@nokia.com>
Tue, 3 Aug 2010 12:18:47 +0000 (15:18 +0300)
taal_bl_update_status was missing locks to protect taal_data. This caused
a kernel crash randomly, as the code attempted to set the brightness while
the OMAP's DSI block was actually disabled.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
drivers/video/omap2/displays/panel-taal.c

index aaf5d308a046d6db9d42708964e8f717247ea0dd..d2e2ac7444e06a4eabd886c3073c8931f8197507 100644 (file)
@@ -290,24 +290,26 @@ static int taal_bl_update_status(struct backlight_device *dev)
 
        dev_dbg(&dssdev->dev, "update brightness to %d\n", level);
 
+       mutex_lock(&td->lock);
+
        if (td->use_dsi_bl) {
                if (td->enabled) {
                        dsi_bus_lock();
                        r = taal_dcs_write_1(DCS_BRIGHTNESS, level);
                        dsi_bus_unlock();
-                       if (r)
-                               return r;
+               } else {
+                       r = 0;
                }
        } else {
                if (!dssdev->set_backlight)
-                       return -EINVAL;
-
-               r = dssdev->set_backlight(dssdev, level);
-               if (r)
-                       return r;
+                       r = -EINVAL;
+               else
+                       r = dssdev->set_backlight(dssdev, level);
        }
 
-       return 0;
+       mutex_unlock(&td->lock);
+
+       return r;
 }
 
 static int taal_bl_get_intensity(struct backlight_device *dev)