[PATCH v2 16/16] backlight: use backlight_is_blank() in all backlight drivers

Emil Velikov emil.l.velikov at gmail.com
Wed May 20 10:56:43 UTC 2020


Hi Sam,

On Sun, 17 May 2020 at 20:02, Sam Ravnborg <sam at ravnborg.org> wrote:

> --- a/drivers/video/backlight/88pm860x_bl.c
> +++ b/drivers/video/backlight/88pm860x_bl.c
> @@ -123,13 +123,7 @@ static int pm860x_backlight_update_status(struct backlight_device *bl)
>  {
>         int brightness = bl->props.brightness;
>
> -       if (bl->props.power != FB_BLANK_UNBLANK)
> -               brightness = 0;
> -
> -       if (bl->props.fb_blank != FB_BLANK_UNBLANK)
> -               brightness = 0;
> -
> -       if (bl->props.state & BL_CORE_SUSPENDED)
> +       if (backlight_is_blank(bl))
>                 brightness = 0;
Off the top of my head, the above two lines should really be in backlight core.
There's nothing driver specific to them, plus it minimises the chances
of next-driver getting it wrong.


> --- a/drivers/video/backlight/as3711_bl.c
> +++ b/drivers/video/backlight/as3711_bl.c
> @@ -107,13 +107,11 @@ static int as3711_bl_update_status(struct backlight_device *bl)
>         int brightness = bl->props.brightness;
>         int ret = 0;
>
> -       dev_dbg(&bl->dev, "%s(): brightness %u, pwr %x, blank %x, state %x\n",
> +       dev_dbg(&bl->dev, "%s(): brightness %u, pwr %x, state %x\n",
>                 __func__, bl->props.brightness, bl->props.power,
> -               bl->props.fb_blank, bl->props.state);
> +               bl->props.state);
>
Let's also move this to backlight core.

-Emil


More information about the dri-devel mailing list