Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4080523rwl; Sat, 7 Jan 2023 10:39:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXsEDrAS4YQVGEdXPkyI5OH470gTqxp7Su6z+emKenEQcXK4Qk6Elew455F/i8F1JG2IcCRk X-Received: by 2002:a17:902:bc81:b0:193:1e28:bc6b with SMTP id bb1-20020a170902bc8100b001931e28bc6bmr2331275plb.65.1673116775926; Sat, 07 Jan 2023 10:39:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673116775; cv=none; d=google.com; s=arc-20160816; b=zT/c9EMq4tfJbor5fLz7L1ECzIAho/GZcFRbxPEBMzxsv9cEJTI3seyzZVIi2hRZdp SaJ6i3rpaS1q9LdQo+gyxg9GLgLG7RxlAb+vDpgk2iD47caIfuKSM8VIFVE6lE4hEeVJ 2dqQY7FZD1YiJWjuwrWPKXBpiUG3d7JkAN13B5rCFX2h6qHcYOhcFQIPkRrFYEA9CPBI woAklo4jpRc+uFpYbxb0hQvbd/q0i3fE3EuyQ+pHsnWdoCXsgxoK0sW4hKcDzjrblR38 pyeQm5gMFqTLDqwm4WaUuYGW3vvBTCplOAH0Tphe0MjZuRcpSLi+mVX+bt/s5glBpog9 OE4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=YbIvIgHh3FE4EMDTT/kMARtsgRY0nND8Xhm+TY+zcTg=; b=VCguRLQdqTHurCtz5xBMcBrKoLyFzktYWN8W/KLBiiXZQ0sQi/jro3mGURqW8lGHEB bpGU4nn8ojQHauLVhr4pbMicotP7r72xUMAIz9Lz7zUeRbzfi6VSLdAprZegdiUDNDRj p4tAbhJaEgg9qLlzwuHRSlftGGPeF3x43MF9nM11myvYqXckLQ0WEH84GwFbp7gz/spR FnJmROwBqg5HevYgo8QV/zonvJr3mFuZjrDAPygUq6uMnMy9SSu3M2hSCU17YUkQcWnD S8/mg43YBLfTWy1Zoz3j9FdTHFuKJ+3G7siEy50vLDv26Bv+L0CZ0Ey2NlSG7BsmcjiN 3zoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R0Vqm0kw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v25-20020a637a19000000b004acee197e43si3621510pgc.83.2023.01.07.10.39.28; Sat, 07 Jan 2023 10:39:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R0Vqm0kw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232748AbjAGS0g (ORCPT + 56 others); Sat, 7 Jan 2023 13:26:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232480AbjAGS0Y (ORCPT ); Sat, 7 Jan 2023 13:26:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 262FD3F12A; Sat, 7 Jan 2023 10:26:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7050E60BA8; Sat, 7 Jan 2023 18:26:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id 8A382C433AE; Sat, 7 Jan 2023 18:26:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673115981; bh=5ij+2zt071FaFgXPs/8g9HMxpQ5Rvn4NOrg8o4aDjAA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=R0Vqm0kwLCUMC/FFA+SwZYvkyVvRCwUaU1sKttT/VJJBVNEHRFOf7VvRZzlHTJkZG jjwOFSnMDXFvNYr2SN2VsLrgU4CSuQ9MOmH7eo0WWSnwItqdjAYu/ZYW9aU81kUGBX R39CPgkrOZwFdoE7pNj4N9tPVvQEikdGY5kaJNMaW7A+TZIGW21KtIjU6OqRUwklQl S5JBCOzlHxApv1YqY1liRhR+fB9VwhN/rYiWd6Z2LUKDvnkbI+KBxZBmnEsLtO0Jfa l3RLZMdBIrygDW6z0hb8uQ5n1gN1WEahYBr1Nnd6gvEn+QRWEUAge3ELmYT1mbJaLT X6i2PWrdQxt1g== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74EC0C54EBC; Sat, 7 Jan 2023 18:26:21 +0000 (UTC) From: Sam Ravnborg via B4 Submission Endpoint Date: Sat, 07 Jan 2023 19:26:21 +0100 Subject: [PATCH 07/15] video: fbdev: mx3fb: Introduce backlight_get_brightness() MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230107-sam-video-backlight-drop-fb_blank-v1-7-1bd9bafb351f@ravnborg.org> References: <20230107-sam-video-backlight-drop-fb_blank-v1-0-1bd9bafb351f@ravnborg.org> In-Reply-To: <20230107-sam-video-backlight-drop-fb_blank-v1-0-1bd9bafb351f@ravnborg.org> To: Nicolas Ferre , Helge Deller , Alexandre Belloni , Claudiu Beznea , Antonino Daplas , Benjamin Herrenschmidt , Paul Mackerras , Greg Kroah-Hartman , Robin van der Gracht , Miguel Ojeda , Lee Jones , Daniel Thompson , Jingoo Han Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-staging@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, Stephen Kitt , Sam Ravnborg , Kate Stewart , Thomas Gleixner , Laurent Pinchart , Arnd Bergmann , Jani Nikula X-Mailer: b4 0.11.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1673115978; l=1512; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=drvkdW0PBheGrMYY3qAlAUiLqN5UfH4VOwcA/aXugg0=; =?utf-8?q?b=3D8iTbagfWb1Lj?= =?utf-8?q?07cocG5qMfP8Ayj4BAQY4d64KWfzkOktfkyCN7IXzBwcj/9U/iJWYWB0GCaKShTH?= 0OiuscjyAkCEJdcJGgJQX9THB3GVRSWeiPGBowlxgEHvu9p/2eio X-Developer-Key: i=sam@ravnborg.org; a=ed25519; pk=R0+pqV7BRYOAeOIGkyOrSNke7arx5y3LkEuNi37YEyU= X-Endpoint-Received: by B4 Submission Endpoint for sam@ravnborg.org/20230107 with auth_id=22 X-Original-From: Sam Ravnborg Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 From: Sam Ravnborg Introduce backlight_get_brightness() to simplify logic and avoid direct access to backlight properties. Signed-off-by: Sam Ravnborg Cc: Sam Ravnborg Cc: Kate Stewart Cc: Thomas Gleixner Cc: Laurent Pinchart Cc: Greg Kroah-Hartman Cc: Arnd Bergmann Cc: Jani Nikula --- drivers/video/fbdev/mx3fb.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/video/fbdev/mx3fb.c b/drivers/video/fbdev/mx3fb.c index b945b68984b9..bc35f664cbff 100644 --- a/drivers/video/fbdev/mx3fb.c +++ b/drivers/video/fbdev/mx3fb.c @@ -283,12 +283,7 @@ static int mx3fb_bl_get_brightness(struct backlight_device *bl) static int mx3fb_bl_update_status(struct backlight_device *bl) { struct mx3fb_data *fbd = bl_get_data(bl); - int brightness = bl->props.brightness; - - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - if (bl->props.fb_blank != FB_BLANK_UNBLANK) - brightness = 0; + int brightness = backlight_get_brightness(bl); fbd->backlight_level = (fbd->backlight_level & ~0xFF) | brightness; @@ -325,7 +320,6 @@ static void mx3fb_init_backlight(struct mx3fb_data *fbd) fbd->bl = bl; bl->props.power = FB_BLANK_UNBLANK; - bl->props.fb_blank = FB_BLANK_UNBLANK; bl->props.brightness = mx3fb_bl_get_brightness(bl); } -- 2.34.1