mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Kitt <steve@sk2.org>
To: "Lee, Chun-Yi" <jlee@suse.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Mark Gross <markgross@kernel.org>,
	Cezary Jackiewicz <cezary.jackiewicz@gmail.com>,
	Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, Stephen Kitt <steve@sk2.org>,
	ibm-acpi-devel@lists.sourceforge.net
Subject: [PATCH 4/4] platform/x86: thinkpad_acpi: Use backlight helper
Date: Tue,  7 Jun 2022 20:46:35 +0200	[thread overview]
Message-ID: <20220607184635.1127913-5-steve@sk2.org> (raw)
In-Reply-To: <20220607184635.1127913-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: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>
Cc: ibm-acpi-devel@lists.sourceforge.net
Cc: platform-driver-x86@vger.kernel.org
---
 drivers/platform/x86/thinkpad_acpi.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index e6cb4a14cdd4..a9337bd1d125 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -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",
-- 
2.30.2


  parent reply	other threads:[~2022-06-08  0:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 18:46 [PATCH 0/4] platform/x86: Use backlight helpers Stephen Kitt
2022-06-07 18:46 ` [PATCH 1/4] platform/x86: acer-wmi: Use backlight helper Stephen Kitt
2022-06-08 15:06   ` Daniel Thompson
2022-06-07 18:46 ` [PATCH 2/4] platform/x86: apple-gmux: " Stephen Kitt
2022-06-08 15:06   ` Daniel Thompson
2022-06-07 18:46 ` [PATCH 3/4] platform/x86: compal-laptop: " Stephen Kitt
2022-06-08 15:06   ` Daniel Thompson
2022-06-07 18:46 ` Stephen Kitt [this message]
2022-06-08 15:07   ` [PATCH 4/4] platform/x86: thinkpad_acpi: " Daniel Thompson
2022-06-22  9:54 ` [PATCH 0/4] platform/x86: Use backlight helpers Hans de Goede

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=20220607184635.1127913-5-steve@sk2.org \
    --to=steve@sk2.org \
    --cc=cezary.jackiewicz@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=hmh@hmh.eng.br \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=jlee@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.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

all inboxes | Powered by JetHome®