]> err.no Git - linux-2.6/commitdiff
backlight: Avoid unecessary driver callbacks
authorHelge Deller <deller@gmx.de>
Sun, 13 Jan 2008 23:01:13 +0000 (23:01 +0000)
committerRichard Purdie <rpurdie@rpsys.net>
Thu, 7 Feb 2008 09:31:52 +0000 (09:31 +0000)
Avoid driver callbacks when the brightness hasn't changed since
they're not necessary.

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
drivers/video/backlight/backlight.c

index 4840fe217e4d30edc8dcc41318720a6e6fede59d..39394757679c0882f9a2765486163383bee0935c 100644 (file)
@@ -94,8 +94,10 @@ static ssize_t backlight_store_power(struct device *dev,
        mutex_lock(&bd->ops_lock);
        if (bd->ops) {
                pr_debug("backlight: set power to %d\n", power);
-               bd->props.power = power;
-               backlight_update_status(bd);
+               if (bd->props.power != power) {
+                       bd->props.power = power;
+                       backlight_update_status(bd);
+               }
                rc = count;
        }
        mutex_unlock(&bd->ops_lock);
@@ -132,8 +134,10 @@ static ssize_t backlight_store_brightness(struct device *dev,
                else {
                        pr_debug("backlight: set brightness to %d\n",
                                 brightness);
-                       bd->props.brightness = brightness;
-                       backlight_update_status(bd);
+                       if (bd->props.brightness != brightness) {
+                               bd->props.brightness = brightness;
+                               backlight_update_status(bd);
+                       }
                        rc = count;
                }
        }