From patchwork Fri Jan 6 16:48:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Kitt X-Patchwork-Id: 13091640 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 9B9FDC3DA7A for ; Fri, 6 Jan 2023 17:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229568AbjAFRHI (ORCPT ); Fri, 6 Jan 2023 12:07:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230013AbjAFRGv (ORCPT ); Fri, 6 Jan 2023 12:06:51 -0500 X-Greylist: delayed 597 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 06 Jan 2023 09:06:49 PST Received: from 20.mo583.mail-out.ovh.net (20.mo583.mail-out.ovh.net [91.121.55.239]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECC082A2 for ; Fri, 6 Jan 2023 09:06:49 -0800 (PST) Received: from director9.ghost.mail-out.ovh.net (unknown [10.109.143.136]) by mo583.mail-out.ovh.net (Postfix) with ESMTP id 02DB526641 for ; Fri, 6 Jan 2023 16:50:01 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-dkv5l (unknown [10.110.171.46]) by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 34F0B1FE9B; Fri, 6 Jan 2023 16:50:01 +0000 (UTC) Received: from sk2.org ([37.59.142.107]) by ghost-submission-6684bf9d7b-dkv5l with ESMTPSA id 4GNNCjlRuGOnAQEAwhnnFg (envelope-from ); Fri, 06 Jan 2023 16:50:01 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-107S00126819975-9ec8-4c29-9bdd-5acdba6470ab, 9FE29456621203A27B372E1E0503D45BE0167874) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Lee Jones , Daniel Thompson , Jingoo Han Cc: Sam Ravnborg , Stephen Kitt , Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 4/4] backlight: tosa: Use backlight helper Date: Fri, 6 Jan 2023 17:48:55 +0100 Message-Id: <20230106164856.1453819-5-steve@sk2.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Ovh-Tracer-Id: 5852709192662877915 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrkedtgdelgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeelgeetueejffejfeejvefhtddufeejgfetleegtddukeelieelvddvteduveejtdenucfkphepuddvjedrtddrtddruddpfeejrdehledrudegvddruddtjeenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehsthgvvhgvsehskhdvrdhorhhgqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhfsgguvghvsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdfovfetjfhoshhtpehmohehkeefpdhmohguvgepshhmthhpohhuth Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.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 Reviewed-by: Sam Ravnborg Reviewed-by: Daniel Thompson --- drivers/video/backlight/tosa_bl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c index 77b71f6c19b5..e338b1f00f6a 100644 --- a/drivers/video/backlight/tosa_bl.c +++ b/drivers/video/backlight/tosa_bl.c @@ -50,13 +50,8 @@ static void tosa_bl_set_backlight(struct tosa_bl_data *data, int brightness) static int tosa_bl_update_status(struct backlight_device *dev) { - struct backlight_properties *props = &dev->props; struct tosa_bl_data *data = bl_get_data(dev); - int power = max(props->power, props->fb_blank); - int brightness = props->brightness; - - if (power) - brightness = 0; + int brightness = backlight_get_brightness(dev); tosa_bl_set_backlight(data, brightness);