From nobody Tue Apr 28 02:37:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82A4ECCA48B for ; Tue, 7 Jun 2022 22:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384794AbiFGWQU (ORCPT ); Tue, 7 Jun 2022 18:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380110AbiFGVLa (ORCPT ); Tue, 7 Jun 2022 17:11:30 -0400 Received: from 1.mo560.mail-out.ovh.net (1.mo560.mail-out.ovh.net [46.105.63.121]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FC8721788D for ; Tue, 7 Jun 2022 11:53:11 -0700 (PDT) Received: from player796.ha.ovh.net (unknown [10.108.20.107]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id 7207E24673 for ; Tue, 7 Jun 2022 18:47:11 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player796.ha.ovh.net (Postfix) with ESMTPSA id BF54F2B4373C7; Tue, 7 Jun 2022 18:47:02 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-100R003d02dbf92-065a-4f26-9890-0ee8986a4b9e, 38FB55E0ED6224772C245AF554E1AE62085133ED) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: "Lee, Chun-Yi" , Hans de Goede , Mark Gross , Cezary Jackiewicz , Henrique de Moraes Holschuh Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH 1/4] platform/x86: acer-wmi: Use backlight helper Date: Tue, 7 Jun 2022 20:46:32 +0200 Message-Id: <20220607184635.1127913-2-steve@sk2.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220607184635.1127913-1-steve@sk2.org> References: <20220607184635.1127913-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 11326271589753915014 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddthedguddvlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeeghffhleeigffhteeiffelveefhfeiudehkedtgefhgedvleffgfejgfdtveeigeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejleeirdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheeitd Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Cc: "Lee, Chun-Yi" Cc: Hans de Goede Cc: Mark Gross Cc: platform-driver-x86@vger.kernel.org Reviewed-by: Daniel Thompson --- drivers/platform/x86/acer-wmi.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wm= i.c index 9c6943e401a6..e0230ea0cb7e 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -1615,12 +1615,7 @@ static int read_brightness(struct backlight_device *= bd) =20 static int update_bl_status(struct backlight_device *bd) { - int intensity =3D bd->props.brightness; - - if (bd->props.power !=3D FB_BLANK_UNBLANK) - intensity =3D 0; - if (bd->props.fb_blank !=3D FB_BLANK_UNBLANK) - intensity =3D 0; + int intensity =3D backlight_get_brightness(bd); =20 set_u32(intensity, ACER_CAP_BRIGHTNESS); =20 --=20 2.30.2 From nobody Tue Apr 28 02:37:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D08DCCA47F for ; Tue, 7 Jun 2022 22:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382760AbiFGWAK (ORCPT ); Tue, 7 Jun 2022 18:00:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379276AbiFGVCS (ORCPT ); Tue, 7 Jun 2022 17:02:18 -0400 X-Greylist: delayed 465 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 07 Jun 2022 11:47:22 PDT Received: from 1.mo581.mail-out.ovh.net (1.mo581.mail-out.ovh.net [178.33.45.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7FBD59326 for ; Tue, 7 Jun 2022 11:47:22 -0700 (PDT) Received: from player796.ha.ovh.net (unknown [10.111.208.240]) by mo581.mail-out.ovh.net (Postfix) with ESMTP id 688A5246D0 for ; Tue, 7 Jun 2022 18:47:20 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player796.ha.ovh.net (Postfix) with ESMTPSA id 75B782B4373EA; Tue, 7 Jun 2022 18:47:11 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-100R003534aca89-ad90-49e3-97a3-d35d654dc552, 38FB55E0ED6224772C245AF554E1AE62085133ED) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: "Lee, Chun-Yi" , Hans de Goede , Mark Gross , Cezary Jackiewicz , Henrique de Moraes Holschuh Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH 2/4] platform/x86: apple-gmux: Use backlight helper Date: Tue, 7 Jun 2022 20:46:33 +0200 Message-Id: <20220607184635.1127913-3-steve@sk2.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220607184635.1127913-1-steve@sk2.org> References: <20220607184635.1127913-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 11328804866083751558 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddthedguddvlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeeghffhleeigffhteeiffelveefhfeiudehkedtgefhgedvleffgfejgfdtveeigeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejleeirdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheekud Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Cc: Hans de Goede Cc: Mark Gross Cc: platform-driver-x86@vger.kernel.org Reviewed-by: Daniel Thompson --- drivers/platform/x86/apple-gmux.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/platform/x86/apple-gmux.c b/drivers/platform/x86/apple= -gmux.c index 57553f9b4d1d..ffe98a18440b 100644 --- a/drivers/platform/x86/apple-gmux.c +++ b/drivers/platform/x86/apple-gmux.c @@ -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 =3D bl_get_data(bd); - u32 brightness =3D bd->props.brightness; - - if (bd->props.state & BL_CORE_SUSPENDED) - return 0; + u32 brightness =3D backlight_get_brightness(bd); =20 gmux_write32(gmux_data, GMUX_PORT_BRIGHTNESS, brightness); =20 --=20 2.30.2 From nobody Tue Apr 28 02:37:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48116C433EF for ; Tue, 7 Jun 2022 21:56:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349917AbiFGV4O (ORCPT ); Tue, 7 Jun 2022 17:56:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379285AbiFGVCT (ORCPT ); Tue, 7 Jun 2022 17:02:19 -0400 X-Greylist: delayed 1149 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 07 Jun 2022 11:47:31 PDT Received: from 1.mo560.mail-out.ovh.net (1.mo560.mail-out.ovh.net [46.105.63.121]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AFBE737A3 for ; Tue, 7 Jun 2022 11:47:31 -0700 (PDT) Received: from player796.ha.ovh.net (unknown [10.108.1.219]) by mo560.mail-out.ovh.net (Postfix) with ESMTP id 8B96D2466E for ; Tue, 7 Jun 2022 18:47:29 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player796.ha.ovh.net (Postfix) with ESMTPSA id 5FF732B43742E; Tue, 7 Jun 2022 18:47:20 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-100R0036d2f136e-90d2-4dc0-b8df-64c2249e2f69, 38FB55E0ED6224772C245AF554E1AE62085133ED) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: "Lee, Chun-Yi" , Hans de Goede , Mark Gross , Cezary Jackiewicz , Henrique de Moraes Holschuh Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH 3/4] platform/x86: compal-laptop: Use backlight helper Date: Tue, 7 Jun 2022 20:46:34 +0200 Message-Id: <20220607184635.1127913-4-steve@sk2.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220607184635.1127913-1-steve@sk2.org> References: <20220607184635.1127913-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 11331338138328008326 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddthedguddvlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeeghffhleeigffhteeiffelveefhfeiudehkedtgefhgedvleffgfejgfdtveeigeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejleeirdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheeitd Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Instead of manually checking the power state in struct backlight_properties, use backlight_is_blank(). Signed-off-by: Stephen Kitt Cc: Cezary Jackiewicz Cc: Hans de Goede Cc: Mark Gross Cc: platform-driver-x86@vger.kernel.org Reviewed-by: Daniel Thompson --- drivers/platform/x86/compal-laptop.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/co= mpal-laptop.c index ab610376fdad..0942f50bd793 100644 --- a/drivers/platform/x86/compal-laptop.c +++ b/drivers/platform/x86/compal-laptop.c @@ -324,9 +324,7 @@ static int bl_update_status(struct backlight_device *b) if (ret) return ret; =20 - set_backlight_state((b->props.power =3D=3D FB_BLANK_UNBLANK) - && !(b->props.state & BL_CORE_SUSPENDED) - && !(b->props.state & BL_CORE_FBBLANK)); + set_backlight_state(!backlight_is_blank(b)); return 0; } =20 --=20 2.30.2 From nobody Tue Apr 28 02:37:18 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E8DECCA483 for ; Wed, 8 Jun 2022 00:14:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384802AbiFGWpD (ORCPT ); Tue, 7 Jun 2022 18:45:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380639AbiFGVbF (ORCPT ); Tue, 7 Jun 2022 17:31:05 -0400 Received: from 8.mo575.mail-out.ovh.net (8.mo575.mail-out.ovh.net [46.105.74.219]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 231BC22A472 for ; Tue, 7 Jun 2022 12:03:17 -0700 (PDT) Received: from player796.ha.ovh.net (unknown [10.110.208.89]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id C9F2624497 for ; Tue, 7 Jun 2022 18:47:39 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player796.ha.ovh.net (Postfix) with ESMTPSA id 940D82B437457; Tue, 7 Jun 2022 18:47:29 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-100R003051d3411-4c77-4f1a-9d56-85e7694b308c, 38FB55E0ED6224772C245AF554E1AE62085133ED) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: "Lee, Chun-Yi" , Hans de Goede , Mark Gross , Cezary Jackiewicz , Henrique de Moraes Holschuh Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Kitt , 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 Message-Id: <20220607184635.1127913-5-steve@sk2.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220607184635.1127913-1-steve@sk2.org> References: <20220607184635.1127913-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 11334152890935182935 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddthedguddvlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeeghffhleeigffhteeiffelveefhfeiudehkedtgefhgedvleffgfejgfdtveeigeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejleeirdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheejhe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Cc: Henrique de Moraes Holschuh Cc: Hans de Goede Cc: Mark Gross Cc: ibm-acpi-devel@lists.sourceforge.net Cc: platform-driver-x86@vger.kernel.org Reviewed-by: Daniel Thompson --- 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/th= inkpad_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) =20 static int brightness_update_status(struct backlight_device *bd) { - unsigned int level =3D - (bd->props.fb_blank =3D=3D FB_BLANK_UNBLANK && - bd->props.power =3D=3D FB_BLANK_UNBLANK) ? - bd->props.brightness : 0; + int level =3D backlight_get_brightness(bd); =20 dbg_printk(TPACPI_DBG_BRGHT, "backlight: attempt to set level to %d\n", --=20 2.30.2