Skip to contentSkip to conversation

drm: shmobile: Use backlight helper

PATCH In review Stephen Kitt 2 participants 4 messages Jun 7, 2022 – Jun 8, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: shmobile: 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 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.

Cc Laurent Pinchart <[email protected]>
Cc Kieran Bingham <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/shmobile/shmob_drm_backlight.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/shmobile/shmob_drm_backlight.c +1 -5
index f6628a5ee95f..794573badfe8 100644
@@ -18,11 +18,7 @@ static int shmob_drm_backlight_update(struct backlight_device *bdev)
 	struct shmob_drm_connector *scon = bl_get_data(bdev);
 	struct shmob_drm_device *sdev = scon->connector.dev->dev_private;
 	const struct shmob_drm_backlight_data *bdata = &sdev->pdata->backlight;
-	int brightness = bdev->props.brightness;
-
-	if (bdev->props.power != FB_BLANK_UNBLANK ||
-	    bdev->props.state & BL_CORE_SUSPENDED)
-		brightness = 0;
+	int brightness = backlight_get_brightness(bdev);
 
 	return bdata->set_brightness(brightness);
 }

base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56

Signature · 1 line
2.30.2
#1 lore raw
Quoted 4 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.

Apologies for the misleading boilerplate, this patch came about as a result of cleaning up fb_blank usage but doesn't involve fb_blank itself.

Quoted 38 lines

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.

Cc Laurent Pinchart <[email protected]>
Cc Kieran Bingham <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/shmobile/shmob_drm_backlight.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/shmobile/shmob_drm_backlight.c index f6628a5ee95f..794573badfe8 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_backlight.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_backlight.c @@ -18,11 +18,7 @@ static int shmob_drm_backlight_update(struct backlight_device *bdev) struct shmob_drm_connector *scon = bl_get_data(bdev); struct shmob_drm_device *sdev = scon->connector.dev->dev_private; const struct shmob_drm_backlight_data *bdata = &sdev->pdata->backlight;

drivers/gpu/drm/shmobile/shmob_drm_backlight.c +1 -5
-	int brightness = bdev->props.brightness;
-
-	if (bdev->props.power != FB_BLANK_UNBLANK ||
-	    bdev->props.state & BL_CORE_SUSPENDED)
-		brightness = 0;
+	int brightness = backlight_get_brightness(bdev);
 
 	return bdata->set_brightness(brightness);
 }

base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56

Signature · 1 line
2.30.2
#2 lore raw

Hi Stephen,

Quoted 8 lines · Stephen Kitt
Quoted 4 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.

Apologies for the misleading boilerplate, this patch came about as a result of cleaning up fb_blank usage but doesn't involve fb_blank itself.

No worries. Would you like to submit a v2 with a better commit message ? The patch otherwise looks good to me.

Quoted 35 lines
Quoted 35 lines

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.

Cc Laurent Pinchart <[email protected]>
Cc Kieran Bingham <[email protected]>
Cc David Airlie <[email protected]>
Cc Daniel Vetter <[email protected]>
---
 drivers/gpu/drm/shmobile/shmob_drm_backlight.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/shmobile/shmob_drm_backlight.c index f6628a5ee95f..794573badfe8 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_backlight.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_backlight.c @@ -18,11 +18,7 @@ static int shmob_drm_backlight_update(struct backlight_device *bdev) struct shmob_drm_connector *scon = bl_get_data(bdev); struct shmob_drm_device *sdev = scon->connector.dev->dev_private; const struct shmob_drm_backlight_data *bdata = &sdev->pdata->backlight;

drivers/gpu/drm/shmobile/shmob_drm_backlight.c +1 -5
-	int brightness = bdev->props.brightness;
-
-	if (bdev->props.power != FB_BLANK_UNBLANK ||
-	    bdev->props.state & BL_CORE_SUSPENDED)
-		brightness = 0;
+	int brightness = backlight_get_brightness(bdev);
 
 	return bdata->set_brightness(brightness);
 }

base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56

Signature · 3 lines
Regards,

Laurent Pinchart
#3 lore raw

Hi Laurent,

Quoted 7 lines · Laurent Pinchart
Quoted 6 lines · Stephen Kitt
Quoted 4 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.

Quoted 6 lines
Quoted 3 lines

Apologies for the misleading boilerplate, this patch came about as a result of cleaning up fb_blank usage but doesn't involve fb_blank itself.

No worries. Would you like to submit a v2 with a better commit message ? The patch otherwise looks good to me.

Yes, I’ll do that.

Thanks,

Stephen