Commit 4edfe224 authored by Sam Ravnborg's avatar Sam Ravnborg Committed by Lee Jones

backlight: backlight: Refactor fb_notifier_callback()

Increase readability of fb_notifier_callback() by removing
a few indent levels.

No functional change.
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Reviewed-by: default avatarDaniel Thompson <daniel.thompson@linaro.org>
Reviewed-by: default avatarEmil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent c847e429
...@@ -58,20 +58,21 @@ static int fb_notifier_callback(struct notifier_block *self, ...@@ -58,20 +58,21 @@ static int fb_notifier_callback(struct notifier_block *self,
bd = container_of(self, struct backlight_device, fb_notif); bd = container_of(self, struct backlight_device, fb_notif);
mutex_lock(&bd->ops_lock); mutex_lock(&bd->ops_lock);
if (bd->ops)
if (!bd->ops->check_fb || if (!bd->ops)
bd->ops->check_fb(bd, evdata->info)) { goto out;
if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info))
goto out;
fb_blank = *(int *)evdata->data; fb_blank = *(int *)evdata->data;
if (fb_blank == FB_BLANK_UNBLANK && if (fb_blank == FB_BLANK_UNBLANK && !bd->fb_bl_on[node]) {
!bd->fb_bl_on[node]) {
bd->fb_bl_on[node] = true; bd->fb_bl_on[node] = true;
if (!bd->use_count++) { if (!bd->use_count++) {
bd->props.state &= ~BL_CORE_FBBLANK; bd->props.state &= ~BL_CORE_FBBLANK;
bd->props.fb_blank = FB_BLANK_UNBLANK; bd->props.fb_blank = FB_BLANK_UNBLANK;
backlight_update_status(bd); backlight_update_status(bd);
} }
} else if (fb_blank != FB_BLANK_UNBLANK && } else if (fb_blank != FB_BLANK_UNBLANK && bd->fb_bl_on[node]) {
bd->fb_bl_on[node]) {
bd->fb_bl_on[node] = false; bd->fb_bl_on[node] = false;
if (!(--bd->use_count)) { if (!(--bd->use_count)) {
bd->props.state |= BL_CORE_FBBLANK; bd->props.state |= BL_CORE_FBBLANK;
...@@ -79,7 +80,7 @@ static int fb_notifier_callback(struct notifier_block *self, ...@@ -79,7 +80,7 @@ static int fb_notifier_callback(struct notifier_block *self,
backlight_update_status(bd); backlight_update_status(bd);
} }
} }
} out:
mutex_unlock(&bd->ops_lock); mutex_unlock(&bd->ops_lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment