linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Kitt <steve@sk2.org>
To: Antonino Daplas <adaplas@gmail.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Helge Deller <deller@gmx.de>, Paul Mackerras <paulus@samba.org>
Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Stephen Kitt <steve@sk2.org>,
	dri-devel@lists.freedesktop.org
Subject: [PATCH 4/7] fbdev: mx3fb: Use backlight helper
Date: Tue,  7 Jun 2022 21:23:32 +0200	[thread overview]
Message-ID: <20220607192335.1137249-5-steve@sk2.org> (raw)
In-Reply-To: <20220607192335.1137249-1-steve@sk2.org>

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 <steve@sk2.org>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/mx3fb.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c
index b945b68984b9..76771e126d0a 100644
--- a/drivers/video/fbdev/mx3fb.c
+++ b/drivers/video/fbdev/mx3fb.c
@@ -283,12 +283,7 @@ static int mx3fb_bl_get_brightness(struct backlight_device *bl)
 static int mx3fb_bl_update_status(struct backlight_device *bl)
 {
 	struct mx3fb_data *fbd = bl_get_data(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;
+	int brightness = backlight_get_brightness(bl);
 
 	fbd->backlight_level = (fbd->backlight_level & ~0xFF) | brightness;
 
-- 
2.30.2


  parent reply	other threads:[~2022-06-08  2:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 19:23 [PATCH 0/7] fbdev: Use backlight helpers Stephen Kitt
2022-06-07 19:23 ` [PATCH 1/7] fbdev: aty128fb: Use backlight helper Stephen Kitt
2022-06-10 20:29   ` Sam Ravnborg
2022-06-07 19:23 ` [PATCH 2/7] fbdev: atyfb: " Stephen Kitt
2022-06-07 19:23 ` [PATCH 3/7] fbdev: radeon: " Stephen Kitt
2022-06-07 19:23 ` Stephen Kitt [this message]
2022-06-07 19:23 ` [PATCH 5/7] fbdev: nvidia: " Stephen Kitt
2022-06-07 19:23 ` [PATCH 6/7] fbdev: omapfb: panel-dsi-cm: " Stephen Kitt
2022-06-07 19:23 ` [PATCH 7/7] fbdev: riva: " Stephen Kitt
2022-06-08 14:40 ` [PATCH 0/7] fbdev: Use backlight helpers Daniel Thompson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220607192335.1137249-5-steve@sk2.org \
    --to=steve@sk2.org \
    --cc=adaplas@gmail.com \
    --cc=benh@kernel.crashing.org \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).