Skip to content

Commit

Permalink
backlight: Avoid unecessary driver callbacks
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Helge Deller authored and Richard Purdie committed Feb 7, 2008
1 parent 488b5ec commit 5155245
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/video/backlight/backlight.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 5155245

Please sign in to comment.