From nobody Mon Apr 27 04:53:41 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 E2158C433EF for ; Thu, 16 Jun 2022 17:43:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236960AbiFPRnH (ORCPT ); Thu, 16 Jun 2022 13:43:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236657AbiFPRnG (ORCPT ); Thu, 16 Jun 2022 13:43:06 -0400 Received: from 7.mo584.mail-out.ovh.net (7.mo584.mail-out.ovh.net [178.33.253.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 845521D0C3 for ; Thu, 16 Jun 2022 10:43:04 -0700 (PDT) Received: from player760.ha.ovh.net (unknown [10.108.20.200]) by mo584.mail-out.ovh.net (Postfix) with ESMTP id 96ADD25136 for ; Thu, 16 Jun 2022 17:04:54 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player760.ha.ovh.net (Postfix) with ESMTPSA id 69C3F2BA93F59; Thu, 16 Jun 2022 17:04:46 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-109S00346fcc5bb-3e02-4ca4-bc11-402143604e80, EEA695ED62D0B30D35F9F30395731DD21189161B) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Benjamin Herrenschmidt Cc: Daniel Thompson , Stephen Kitt , Michael Ellerman , Christophe Leroy , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] macintosh: via-pmu-backlight: Use backlight helper Date: Thu, 16 Jun 2022 19:04:24 +0200 Message-Id: <20220616170425.1346081-1-steve@sk2.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 7112872661861631707 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddvfedguddtfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeelgeetueejffejfeejvefhtddufeejgfetleegtddukeelieelvddvteduveejtdenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejiedtrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheekge Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Stephen Kitt Cc: Benjamin Herrenschmidt Cc: Michael Ellerman Cc: Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org --- Changes since v2: clarified commit title --- drivers/macintosh/via-pmu-backlight.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-= pmu-backlight.c index 2194016122d2..c2d87e7fa85b 100644 --- a/drivers/macintosh/via-pmu-backlight.c +++ b/drivers/macintosh/via-pmu-backlight.c @@ -71,12 +71,7 @@ static int pmu_backlight_get_level_brightness(int level) static int __pmu_backlight_update_status(struct backlight_device *bd) { struct adb_request req; - int level =3D bd->props.brightness; - - - if (bd->props.power !=3D FB_BLANK_UNBLANK || - bd->props.fb_blank !=3D FB_BLANK_UNBLANK) - level =3D 0; + int level =3D backlight_get_brightness(bd); =20 if (level > 0) { int pmulevel =3D pmu_backlight_get_level_brightness(level); base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56 --=20 2.30.2