platform/x86: Use backlight helpers
Subsystems (3)
cover platform/x86: Use backlight helpers
backlight_properties.fb_blank is deprecated. The states it represents are handled by other properties; but instead of accessing those properties directly, drivers should use the helpers provided by backlight.h.
This will ultimately allow fb_blank to be removed.
Stephen Kitt (4):
platform/x86: acer-wmi: Use backlight helper platform/x86: apple-gmux: Use backlight helper platform/x86: compal-laptop: Use backlight helper platform/x86: thinkpad_acpi: Use backlight helper
drivers/platform/x86/acer-wmi.c | 7 +------ drivers/platform/x86/apple-gmux.c | 5 +---- drivers/platform/x86/compal-laptop.c | 4 +--- drivers/platform/x86/thinkpad_acpi.c | 5 +---- 4 files changed, 4 insertions(+), 17 deletions(-)
base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
Signature · 1 line
2.30.2
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.
--- drivers/platform/x86/acer-wmi.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -6
@@ -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 );
Signature · 1 line
2.30.2
Re: [PATCH 1/4] platform/x86: acer-wmi: Use backlight helper
Quoted 10 lines · Stephen Kitt
Instead of retrieving the backlight brightness in struct
backlight_propertiesmanually, and then checking whether the backlight should be on at all, usebacklight_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]>
Daniel.
PATCH 2/4 platform/x86: apple-gmux: Use backlight helper
In reply to Stephen KittInstead 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.
--- drivers/platform/x86/apple-gmux.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/platform/x86/apple-gmux.c +1 -4
@@ -291,10 +291,7 @@ static int gmux_get_brightness(struct backlight_device *bd)static int gmux_update_status (struct backlight_device *bd) {struct apple_gmux_data *gmux_data =bl_get_data (bd); -u32 brightness = bd->props.brightness; - -if (bd->props.state &BL_CORE_SUSPENDED ) -return 0 ; +u32 brightness =backlight_get_brightness (bd);gmux_write32 (gmux_data,GMUX_PORT_BRIGHTNESS , brightness);
Signature · 1 line
2.30.2
Re: [PATCH 2/4] platform/x86: apple-gmux: Use backlight helper
Quoted 9 lines · Stephen Kitt
Instead of retrieving the backlight brightness in struct
backlight_propertiesmanually, and then checking whether the backlight should be on at all, usebacklight_get_brightness()which does all this and insulates this from future changes.Signed-off-by Stephen Kitt <[email protected]>Cc Hans de Goede <[email protected]>Cc Mark Gross <[email protected]>
Daniel.
PATCH 3/4 platform/x86: compal-laptop: Use backlight helper
In reply to Stephen KittInstead of manually checking the power state in struct backlight_properties, use backlight_is_blank().
--- drivers/platform/x86/compal-laptop.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/platform/x86/compal-laptop.c +1 -3
@@ -324,9 +324,7 @@ static int bl_update_status(struct backlight_device *b)if (ret)return ret; -set_backlight_state ((b->props.power ==FB_BLANK_UNBLANK ) - && !(b->props.state &BL_CORE_SUSPENDED ) - && !(b->props.state &BL_CORE_FBBLANK )); +set_backlight_state (!backlight_is_blank (b));return 0 ; }
Signature · 1 line
2.30.2
Re: [PATCH 3/4] platform/x86: compal-laptop: Use backlight helper
Quoted 8 lines · Stephen Kitt
Instead of manually checking the power state in struct
backlight_properties, usebacklight_is_blank().Signed-off-by Stephen Kitt <[email protected]>Cc Cezary Jackiewicz <[email protected]>Cc Hans de Goede <[email protected]>Cc Mark Gross <[email protected]>
Daniel.
PATCH 4/4 platform/x86: thinkpad_acpi: Use backlight helper
In reply to Stephen KittInstead 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.
--- drivers/platform/x86/thinkpad_acpi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/platform/x86/thinkpad_acpi.c +1 -4
@@ -6796,10 +6796,7 @@ static int brightness_set(unsigned int value)static int brightness_update_status (struct backlight_device *bd) { -unsigned int level = - (bd->props.fb_blank ==FB_BLANK_UNBLANK && - bd->props.power ==FB_BLANK_UNBLANK ) ? - bd->props.brightness :0 ; +int level =backlight_get_brightness (bd); dbg_printk(TPACPI_DBG_BRGHT, "backlight: attempt to set level to %d\n",
Signature · 1 line
2.30.2
Re: [PATCH 4/4] platform/x86: thinkpad_acpi: Use backlight helper
Quoted 11 lines · Stephen Kitt
Instead of retrieving the backlight brightness in struct
backlight_propertiesmanually, and then checking whether the backlight should be on at all, usebacklight_get_brightness()which does all this and insulates this from future changes.Signed-off-by Stephen Kitt <[email protected]>Cc Henrique de Moraes Holschuh <[email protected]>Cc Hans de Goede <[email protected]>Cc Mark Gross <[email protected]>
Daniel.
Hi,
Quoted 13 lines · Stephen Kitt
backlight_properties.fb_blank is deprecated. The states it represents are handled by other properties; but instead of accessing those properties directly, drivers should use the helpers provided by
backlight.h.This will ultimately allow
fb_blankto be removed.Stephen Kitt (4):
platform/x86: acer-wmi: Use backlight helper platform/x86: apple-gmux: Use backlight helper platform/x86: compal-laptop: Use backlight helper platform/x86:thinkpad_acpi: Use backlight helper
Quoted 5 lines
drivers/platform/x86/acer-wmi.c | 7 +------ drivers/platform/x86/apple-gmux.c | 5 +---- drivers/platform/x86/compal-laptop.c | 4 +--- drivers/platform/x86/thinkpad_acpi.c | 5 +---- 4 files changed, 4 insertions(+), 17 deletions(-)
Thank you for your patch-series, I've applied the series to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.
Regards,
Hans