[PATCH v2 02/16] backlight: refactor fb_notifier_callback()
Daniel Thompson
daniel.thompson at linaro.org
Mon May 18 14:54:57 UTC 2020
On Sun, May 17, 2020 at 09:01:25PM +0200, Sam Ravnborg wrote:
> Increase readability of fb_notifier_callback() by removing
> a few indent levels.
> No functional change.
>
> Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
> Cc: Lee Jones <lee.jones at linaro.org>
> Cc: Daniel Thompson <daniel.thompson at linaro.org>
> Cc: Jingoo Han <jingoohan1 at gmail.com>
Reviewed-by: Daniel Thompson <daniel.thompson at linaro.org>
> ---
> drivers/video/backlight/backlight.c | 43 +++++++++++++++--------------
> 1 file changed, 22 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
> index cac3e35d7630..17f04cff50ab 100644
> --- a/drivers/video/backlight/backlight.c
> +++ b/drivers/video/backlight/backlight.c
> @@ -58,28 +58,29 @@ static int fb_notifier_callback(struct notifier_block *self,
>
> bd = container_of(self, struct backlight_device, fb_notif);
> mutex_lock(&bd->ops_lock);
> - if (bd->ops)
> - if (!bd->ops->check_fb ||
> - bd->ops->check_fb(bd, evdata->info)) {
> - fb_blank = *(int *)evdata->data;
> - if (fb_blank == FB_BLANK_UNBLANK &&
> - !bd->fb_bl_on[node]) {
> - bd->fb_bl_on[node] = true;
> - if (!bd->use_count++) {
> - bd->props.state &= ~BL_CORE_FBBLANK;
> - bd->props.fb_blank = FB_BLANK_UNBLANK;
> - backlight_update_status(bd);
> - }
> - } else if (fb_blank != FB_BLANK_UNBLANK &&
> - bd->fb_bl_on[node]) {
> - bd->fb_bl_on[node] = false;
> - if (!(--bd->use_count)) {
> - bd->props.state |= BL_CORE_FBBLANK;
> - bd->props.fb_blank = fb_blank;
> - backlight_update_status(bd);
> - }
> - }
> +
> + if (!bd->ops)
> + goto out;
> + if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info))
> + goto out;
> +
> + fb_blank = *(int *)evdata->data;
> + if (fb_blank == FB_BLANK_UNBLANK && !bd->fb_bl_on[node]) {
> + bd->fb_bl_on[node] = true;
> + if (!bd->use_count++) {
> + bd->props.state &= ~BL_CORE_FBBLANK;
> + bd->props.fb_blank = FB_BLANK_UNBLANK;
> + backlight_update_status(bd);
> + }
> + } else if (fb_blank != FB_BLANK_UNBLANK && bd->fb_bl_on[node]) {
> + bd->fb_bl_on[node] = false;
> + if (!(--bd->use_count)) {
> + bd->props.state |= BL_CORE_FBBLANK;
> + bd->props.fb_blank = fb_blank;
> + backlight_update_status(bd);
> }
> + }
> +out:
> mutex_unlock(&bd->ops_lock);
> return 0;
> }
> --
> 2.25.1
>
More information about the dri-devel
mailing list