2022-06-07 22:19:09

by Stephen Kitt

[permalink] [raw]
Subject: [PATCH 1/4] platform/x86: acer-wmi: Use backlight helper

Instead of retrieving the backlight brightness in struct
backlight_properties manually, and then checking whether the backlight
should be on at all, use backlight_get_brightness() which does all
this and insulates this from future changes.

Signed-off-by: Stephen Kitt <[email protected]>
Cc: "Lee, Chun-Yi" <[email protected]>
Cc: Hans de Goede <[email protected]>
Cc: Mark Gross <[email protected]>
Cc: [email protected]
---
drivers/platform/x86/acer-wmi.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 9c6943e401a6..e0230ea0cb7e 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1615,12 +1615,7 @@ static int read_brightness(struct backlight_device *bd)

static int update_bl_status(struct backlight_device *bd)
{
- int intensity = bd->props.brightness;
-
- if (bd->props.power != FB_BLANK_UNBLANK)
- intensity = 0;
- if (bd->props.fb_blank != FB_BLANK_UNBLANK)
- intensity = 0;
+ int intensity = backlight_get_brightness(bd);

set_u32(intensity, ACER_CAP_BRIGHTNESS);

--
2.30.2


2022-06-08 15:45:26

by Daniel Thompson

[permalink] [raw]
Subject: Re: [PATCH 1/4] platform/x86: acer-wmi: Use backlight helper

On Tue, Jun 07, 2022 at 08:46:32PM +0200, Stephen Kitt wrote:
> Instead of retrieving the backlight brightness in struct
> backlight_properties manually, and then checking whether the backlight
> should be on at all, use backlight_get_brightness() which does all
> this and insulates this from future changes.
>
> Signed-off-by: Stephen Kitt <[email protected]>
> Cc: "Lee, Chun-Yi" <[email protected]>
> Cc: Hans de Goede <[email protected]>
> Cc: Mark Gross <[email protected]>
> Cc: [email protected]

Reviewed-by: Daniel Thompson <[email protected]>


Daniel.