Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4070800rwl; Sat, 7 Jan 2023 10:28:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXuMYmJKSBg/rFAKabVnwe52upOdA0/vWSP0abSITvo8YeIMC3EWjOFRSGqMnDjAMFnZ7ZXg X-Received: by 2002:a17:90a:1912:b0:226:8efb:2ce2 with SMTP id 18-20020a17090a191200b002268efb2ce2mr18952245pjg.22.1673116116128; Sat, 07 Jan 2023 10:28:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673116116; cv=none; d=google.com; s=arc-20160816; b=yT7QUk7TmltUtWFOOsTpEb43c30DKq+uAFYKkecQjrUgK+e3h6qh8R6Irkb4d95ZPF Y4mqnuggycAlamXczRGdX57i314wK3ZrZhC8ZLi7pviY9Y5PdhxbLZhiGk3gQEsgtdgB SlcP6eSY5icrxc4cNEQzd/QbEJFQrTuuWPU77TT235xyqu5MMOwJ86zbf7ZDZNbk832S 2yKFJTjf579e0vYXze6md16ZQ2OJjU9uN0IBKH7q+tE5FMuBWpL+zjccSV8xbZNklZRu 3pm5EZtgktrpKnscrn/OVIDJJPIW6LoCLsPURiPY8NEv16VUUk5OYwJ82vZUX1MXzSgb mjWQ== 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=k+g0QSqQpZBLqsmzCOxMfLk47tpIBp1asqXpgAo/14c=; b=f819j15H7xEJgk7EejieMAoPD6hPiFggb7SEplh/jhNOOt/7bbPrdsEVMizSoJKxp0 4iCQwodQSVy3fO63vTD6sICaNobnr+vwILtKJEM7maN4s9+gw+NX4c1r/Mef+3jPb/kr 3cRC5tVMnjVk+wBa6htfbt+tgkj3zzeCegHqSj55yrPlqFtedxJf4WndMwJ2/k4DSKdQ 0XdUFIgtJGzgSgUize+J8nDmTbJF3Yt+4In5AIKASQDwCc5uVvhHhGF6MHeBCpZ2hrL5 /kemzmvTLK8YAsxHkhwzO9OUSNrjm3jy+Kliu2Y4M22qXluy9FPT6GDqVjM/vVCefIAh b52g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a+TGg0za; 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 ip11-20020a17090b314b00b00219741bac53si5224953pjb.123.2023.01.07.10.28.29; Sat, 07 Jan 2023 10:28:36 -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=a+TGg0za; 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 S232974AbjAGS1J (ORCPT + 54 others); Sat, 7 Jan 2023 13:27:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232494AbjAGS0Y (ORCPT ); Sat, 7 Jan 2023 13:26:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D78137260; Sat, 7 Jan 2023 10:26:23 -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 9F55860BB5; Sat, 7 Jan 2023 18:26:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id D6118C43396; 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=NopO6/WDONQttpL/maFut1E5RlkJB2uOICrSmRTuvrs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=a+TGg0zalLu1IZUe0Dusx60kOUTAgJB6i2V0ntZSdpG5hA7ZzF9GFzb2Jzh5cLqTV udilmzFV/9GY2Q3+sJ1scx5kxvtRS4G/9uxntABwo7uUwhgf6vFzlxK7WJqaNC5zMo 2N3akNeLX30I+ZVwfVcQoVc25k6ocdIxpIS3uirQJC6Ehp1L01MwXb9Exhe/1cLaPD 6BQnOgaCjj1iWPKfalhHAuMKx/39xYumSGulqURz1zsjcovak9tmiWrsqRY/YJaXxL xZsAIM0ke+gx7atPRAuPhTvpBKHxO1nLnBlU+RrLEzUE+Ak8SXCQIo7SBDQpfYHPnz UFvQ6BGEyrU1g== 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 C4E09C54EBC; Sat, 7 Jan 2023 18:26:21 +0000 (UTC) From: Sam Ravnborg via B4 Submission Endpoint Date: Sat, 07 Jan 2023 19:26:25 +0100 Subject: [PATCH 11/15] powerpc: via-pmu-backlight: 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-11-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 X-Mailer: b4 0.11.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1673115978; l=1090; i=sam@ravnborg.org; s=20230107; h=from:subject:message-id; bh=lPqymbzfNTifpXa2QzoPI3zSglttX8N9s2/xbxu8aQ4=; =?utf-8?q?b=3DoM0VPahuDXBa?= =?utf-8?q?8NICHQ0XEZfUD/cH3Cz8tGxqgZI94evf9mznv/gWoWJFlh9dpNlj1GiU49BWm0cl?= g1Zmn+5lAV0k2VgXGHyPJ7cqtCg0PIxR/iXKZWAR3vZGmqh+vYaD 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: Benjamin Herrenschmidt Cc: Sam Ravnborg Cc: linuxppc-dev@lists.ozlabs.org --- 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 = bd->props.brightness; - - - if (bd->props.power != FB_BLANK_UNBLANK || - bd->props.fb_blank != FB_BLANK_UNBLANK) - level = 0; + int level = backlight_get_brightness(bd); if (level > 0) { int pmulevel = pmu_backlight_get_level_brightness(level); -- 2.34.1