Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2222565iof; Tue, 7 Jun 2022 23:41:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzwNs1jCB/534bt79Jxwvg+OJrWclsP8l2v9b9VGGYJdAiG+ezkhhBhRv47VE4VKFdatqZ X-Received: by 2002:a63:1f22:0:b0:3fc:b45d:2c83 with SMTP id f34-20020a631f22000000b003fcb45d2c83mr28457170pgf.69.1654670467203; Tue, 07 Jun 2022 23:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654670467; cv=none; d=google.com; s=arc-20160816; b=OEf0pcmieCH0hlABxjlcnHeDOtjcKm0+q+6g/8Yq1icEnvbqSrydTFDqFhBquATAdB qiDnPs9YYY9HhDyZUsQbV+A97hlS8Rq5q5qxTWCw489zLU/806cEPpGaZmGSOF5K5bp2 S/KiIPjQBdNjRx3j4mneoUas34qnUNRsc7R30yQEuUJWH214VhYZavLFK350BK/VBEGb Pi5jULrGpCGGpRPMCI93R7fCVs5Q101QaXkfQaOygAeiXkZQ4c5/rblbJ8B/Q6p/8sHl xULWjFLf95z/yMnw5fU7UrskVcnnxxLesflDmrOkvNOtlSl8mJ3rxqVLjgq+fTVk/2XN F3bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=C1pGkFrxXTxK9jyr2g7bTezzDl1AM+EbPwGrRJUTZsI=; b=IrNiq/slvSqgf8uuMAND1F/J1MZLah6kP8BQQS3cZvyAiYB/zp+HPGHAcPD6+2sACQ YSaGnpmLzMjhwE2F5BL7gu2iwjRgGZGRocEFFOT2/hiJcWD9T3n7eOzz828GLG3+eRid EKZkfDhuPjwXivTSC9Iz66wAMPcKZJVYzTdKZAlJtv3kKw0OVM+8E/IvD4uw5K1Jhn1h 35+0oWDhMOvG7Uq8zulcvfsduMIjTSzJb4Uwij2679G813btrtNOVpUpEVV5AZB/xGO1 BEMsqupjzQdCOn+6MrKNreIppnrLbWWPVAh9Gan1+in7jH2U0d8a+dzQli8Lbsuj/ok1 49Sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k3-20020a17090a3e8300b001e070f1ddabsi27096151pjc.65.2022.06.07.23.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:41:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 93A5737A39; Tue, 7 Jun 2022 23:01:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346349AbiFHCtG (ORCPT + 99 others); Tue, 7 Jun 2022 22:49:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345799AbiFHCeD (ORCPT ); Tue, 7 Jun 2022 22:34:03 -0400 Received: from 3.mo550.mail-out.ovh.net (3.mo550.mail-out.ovh.net [46.105.60.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6288318C47 for ; Tue, 7 Jun 2022 12:59:34 -0700 (PDT) Received: from player797.ha.ovh.net (unknown [10.111.208.192]) by mo550.mail-out.ovh.net (Postfix) with ESMTP id 5295D23DC3 for ; Tue, 7 Jun 2022 19:09:57 +0000 (UTC) Received: from sk2.org (82-65-25-201.subs.proxad.net [82.65.25.201]) (Authenticated sender: steve@sk2.org) by player797.ha.ovh.net (Postfix) with ESMTPSA id 647C5273DCAA9; Tue, 7 Jun 2022 19:09:48 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-102R004cfc32490-50c5-4837-a6e8-e39166bfb3cd, 38FB55E0ED6224772C245AF554E1AE62085133ED) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt To: Lee Jones , Daniel Thompson , Jingoo Han , Helge Deller Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Kitt Subject: [PATCH 1/4] backlight: aat2870: Use backlight helper Date: Tue, 7 Jun 2022 21:09:22 +0200 Message-Id: <20220607190925.1134737-2-steve@sk2.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220607190925.1134737-1-steve@sk2.org> References: <20220607190925.1134737-1-steve@sk2.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 11710766409107932806 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvfedruddthedgudeffecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeeghffhleeigffhteeiffelveefhfeiudehkedtgefhgedvleffgfejgfdtveeigeenucfkpheptddrtddrtddrtddpkedvrdeihedrvdehrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopehplhgrhigvrhejleejrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshhtvghvvgesshhkvddrohhrghdpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheehtd X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: Helge Deller Cc: dri-devel@lists.freedesktop.org Cc: linux-fbdev@vger.kernel.org --- drivers/video/backlight/aat2870_bl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/video/backlight/aat2870_bl.c b/drivers/video/backlight/aat2870_bl.c index a7af9adafad6..1cbb303e9c88 100644 --- a/drivers/video/backlight/aat2870_bl.c +++ b/drivers/video/backlight/aat2870_bl.c @@ -59,7 +59,7 @@ static int aat2870_bl_update_status(struct backlight_device *bd) struct aat2870_bl_driver_data *aat2870_bl = bl_get_data(bd); struct aat2870_data *aat2870 = dev_get_drvdata(aat2870_bl->pdev->dev.parent); - int brightness = bd->props.brightness; + int brightness = backlight_get_brightness(bd); int ret; if ((brightness < 0) || (bd->props.max_brightness < brightness)) { @@ -70,11 +70,6 @@ static int aat2870_bl_update_status(struct backlight_device *bd) dev_dbg(&bd->dev, "brightness=%d, power=%d, state=%d\n", bd->props.brightness, bd->props.power, bd->props.state); - if ((bd->props.power != FB_BLANK_UNBLANK) || - (bd->props.state & BL_CORE_FBBLANK) || - (bd->props.state & BL_CORE_SUSPENDED)) - brightness = 0; - ret = aat2870->write(aat2870, AAT2870_BLM, (u8)aat2870_brightness(aat2870_bl, brightness)); if (ret < 0) -- 2.30.2