staging: ftbft: Use backlight helper
Subsystems (3)
PATCH 1/1 staging: ftbft: Use backlight helper
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.
Instead of manually checking the power state in struct backlight_properties, use backlight_is_blank().
--- drivers/staging/fbtft/fb_ssd1351.c | 3 +-- drivers/staging/fbtft/fbtft-core.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/staging/fbtft/fb_ssd1351.c +1 -2
@@ -196,8 +196,7 @@ static int update_onboard_backlight(struct backlight_device *bd)"%s: power=%d, fb_blank=%d\n" , __func__, bd->props.power, bd->props.fb_blank); - on = (bd->props.power ==FB_BLANK_UNBLANK ) && - (bd->props.fb_blank ==FB_BLANK_UNBLANK ); + on = !backlight_is_blank (bd);/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */ write_reg (par,0xB5 , on ?0x03 :0x02 );
drivers/staging/fbtft/fbtft-core.c +1 -2
@@ -137,8 +137,7 @@ static int fbtft_backlight_update_status(struct backlight_device *bd)"%s: polarity=%d, power=%d, fb_blank=%d\n" , __func__, polarity, bd->props.power, bd->props.fb_blank); -if ((bd->props.power ==FB_BLANK_UNBLANK ) && - (bd->props.fb_blank ==FB_BLANK_UNBLANK )) +if (!backlight_is_blank (bd))gpiod_set_value (par->gpio.led[0 ], polarity);else gpiod_set_value (par->gpio.led[0 ], !polarity);
base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
Signature · 1 line
2.30.2
Quoted 7 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.Instead of manually checking the power state in struct
backlight_properties, usebacklight_is_blank().
Quoted 48 lines
Signed-off-by Stephen Kitt <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc "Noralf Trønnes" <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Len Baker <[email protected]>--- drivers/staging/fbtft/fb_ssd1351.c | 3 +-- drivers/staging/fbtft/fbtft-core.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)drivers/staging/fbtft/fb_ssd1351.c +1
-2@@ -196,8 +196,7 @@ static int update_onboard_backlight(struct backlight_device *bd)"%s: power=%d, fb_blank=%d\n" , __func__, bd->props.power, bd->props.fb_blank); - on = (bd->props.power ==FB_BLANK_UNBLANK ) && - (bd->props.fb_blank ==FB_BLANK_UNBLANK ); + on = !backlight_is_blank (bd);/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */ write_reg (par,0xB5 , on ?0x03 :0x02 );drivers/staging/fbtft/fbtft-core.c +1
-2@@ -137,8 +137,7 @@ static int fbtft_backlight_update_status(struct backlight_device *bd)"%s: polarity=%d, power=%d, fb_blank=%d\n" , __func__, polarity, bd->props.power, bd->props.fb_blank); -if ((bd->props.power ==FB_BLANK_UNBLANK ) && - (bd->props.fb_blank ==FB_BLANK_UNBLANK )) +if (!backlight_is_blank (bd))gpiod_set_value (par->gpio.led[0 ], polarity);else gpiod_set_value (par->gpio.led[0 ], !polarity);base-commit:
f2906aa863381afb0015a9eb7fefad885d4e5a56Signature · 1 line
2.30.2
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 8 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.Instead of manually checking the power state in struct
backlight_properties, usebacklight_is_blank().
Quoted 10 lines
Signed-off-by Stephen Kitt <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc "Noralf Trønnes" <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Len Baker <[email protected]>
Daniel.
Hi Stephen,
Quoted 28 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.Instead of manually checking the power state in struct
backlight_properties, usebacklight_is_blank().Signed-off-by Stephen Kitt <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc "Noralf Trønnes" <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Len Baker <[email protected]>--- drivers/staging/fbtft/fb_ssd1351.c | 3 +-- drivers/staging/fbtft/fbtft-core.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)drivers/staging/fbtft/fb_ssd1351.c +0
-0
drivers/staging/fbtft/fb_ssd1351.c static int update_onboard_backlight(struct backlight_device *bd) · line 197
Quoted 2 lines
drivers/staging/fbtft/fb_ssd1351.c +0
-0@@ -196,8 +196,7 @@ static int update_onboard_backlight(struct backlight_device *bd)"%s: power=%d, fb_blank=%d\n" , __func__, bd->props.power, bd->props.fb_blank);
Could you try to kill this use of props.fb_blank too? ^^^^^^
A local variable should do the trick.
Sam
Quoted 25 lines
drivers/staging/fbtft/fb_ssd1351.c +1
-2- on = (bd->props.power ==FB_BLANK_UNBLANK ) && - (bd->props.fb_blank ==FB_BLANK_UNBLANK ); + on = !backlight_is_blank (bd);/* Onboard backlight connected to GPIO0 on SSD1351, GPIO1 unused */ write_reg (par,0xB5 , on ?0x03 :0x02 );drivers/staging/fbtft/fbtft-core.c +1
-2@@ -137,8 +137,7 @@ static int fbtft_backlight_update_status(struct backlight_device *bd)"%s: polarity=%d, power=%d, fb_blank=%d\n" , __func__, polarity, bd->props.power, bd->props.fb_blank); -if ((bd->props.power ==FB_BLANK_UNBLANK ) && - (bd->props.fb_blank ==FB_BLANK_UNBLANK )) +if (!backlight_is_blank (bd))gpiod_set_value (par->gpio.led[0 ], polarity);else gpiod_set_value (par->gpio.led[0 ], !polarity);base-commit:
f2906aa863381afb0015a9eb7fefad885d4e5a56Signature · 1 line
2.30.2
Hi Sam,
Quoted 24 lines · Sam Ravnborg
Quoted 23 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.Instead of manually checking the power state in struct
backlight_properties, usebacklight_is_blank().Signed-off-by Stephen Kitt <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc "Noralf Trønnes" <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Len Baker <[email protected]>--- drivers/staging/fbtft/fb_ssd1351.c | 3 +-- drivers/staging/fbtft/fbtft-core.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
Quoted 9 lines
Review static int update_onboard_backlight(struct · line 197
Quoted 7 lines
(quoted diff) +0
-0
b/drivers/staging/fbtft/fb_ssd1351.cindex6fd549a424d5..b8d55aa8c5c7100644 ---a/drivers/staging/fbtft/fb_ssd1351.c
+++b/drivers/staging/fbtft/fb_ssd1351.c(quoted diff) +0
-0@@ -196,8 +196,7 @@ static int update_onboard_backlight(struct backlight_device *bd) "%s: power=%d, fb_blank=%d\n", __func__, bd->props.power, bd->props.fb_blank);Could you try to kill this use of props.fb_blank too? ^^^^^^
A local variable should do the trick.
I have a pending patch changing this to show props.state instead, that way the debug info shows all the backlight-relevant information from props. How does that sound?
Regards,
Stephen
Quoted 37 lines · Stephen Kitt
Hi Sam,
Quoted 24 lines · Sam Ravnborg
Quoted 23 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.Instead of manually checking the power state in struct
backlight_properties, usebacklight_is_blank().Signed-off-by Stephen Kitt <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc "Noralf Trønnes" <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc Andy Shevchenko <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Len Baker <[email protected]>--- drivers/staging/fbtft/fb_ssd1351.c | 3 +-- drivers/staging/fbtft/fbtft-core.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)Quoted 9 lines
Review static int update_onboard_backlight(struct · line 197
Quoted 7 lines
(quoted diff) +0
-0
b/drivers/staging/fbtft/fb_ssd1351.cindex6fd549a424d5..b8d55aa8c5c7100644 ---a/drivers/staging/fbtft/fb_ssd1351.c
+++b/drivers/staging/fbtft/fb_ssd1351.c(quoted diff) +0
-0@@ -196,8 +196,7 @@ static int update_onboard_backlight(struct backlight_device *bd) "%s: power=%d, fb_blank=%d\n", __func__, bd->props.power, bd->props.fb_blank);Could you try to kill this use of props.fb_blank too? ^^^^^^
A local variable should do the trick.
Quoted 3 lines
I have a pending patch changing this to show props.state instead, that way the debug info shows all the backlight-relevant information from props. How does that sound?
In the end we want to have only _one_ state for backlight, so the simpler solution that just use one of the helpers would be better. For this driver there is no reason to do much anyway.
Sam