提交 51552453 编写于 作者: H Helge Deller 提交者: Richard Purdie

backlight: Avoid unecessary driver callbacks

Avoid driver callbacks when the brightness hasn't changed since
they're not necessary.
Signed-off-by: NHelge Deller <deller@gmx.de>
Signed-off-by: NRichard Purdie <rpurdie@rpsys.net>
上级 488b5ec8
......@@ -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;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册