backlight: as3711_bl: Simplify update_status
Replaces the open-coded checks of the state, with the backlight_get_brightness() helper. This increases readability of the code and align the functionality across the drivers. Furthermore drop the debug prints in update_status(). If we need debug printing then we can add it to the backlight core. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
2144d00ed0
commit
5a09765dde
|
@ -104,17 +104,10 @@ static int as3711_bl_update_status(struct backlight_device *bl)
|
||||||
struct as3711_bl_data *data = bl_get_data(bl);
|
struct as3711_bl_data *data = bl_get_data(bl);
|
||||||
struct as3711_bl_supply *supply = to_supply(data);
|
struct as3711_bl_supply *supply = to_supply(data);
|
||||||
struct as3711 *as3711 = supply->as3711;
|
struct as3711 *as3711 = supply->as3711;
|
||||||
int brightness = bl->props.brightness;
|
int brightness;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
dev_dbg(&bl->dev, "%s(): brightness %u, pwr %x, blank %x, state %x\n",
|
brightness = backlight_get_brightness(bl);
|
||||||
__func__, bl->props.brightness, bl->props.power,
|
|
||||||
bl->props.fb_blank, bl->props.state);
|
|
||||||
|
|
||||||
if (bl->props.power != FB_BLANK_UNBLANK ||
|
|
||||||
bl->props.fb_blank != FB_BLANK_UNBLANK ||
|
|
||||||
bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
|
|
||||||
brightness = 0;
|
|
||||||
|
|
||||||
if (data->type == AS3711_BL_SU1) {
|
if (data->type == AS3711_BL_SU1) {
|
||||||
ret = as3711_set_brightness_v(as3711, brightness,
|
ret = as3711_set_brightness_v(as3711, brightness,
|
||||||
|
|
Loading…
Reference in a new issue