Message ID | 20230106164856.1453819-2-steve@sk2.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp930077wrt; Fri, 6 Jan 2023 09:12:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXvAJR6BBbEPqm/Nm+i/d4bVSbYW2Stl/l2Il1tLhuAzWqG/vq3hIy3LxrqHvk7RwVMam+5y X-Received: by 2002:a17:902:a981:b0:187:403c:7a3b with SMTP id bh1-20020a170902a98100b00187403c7a3bmr49736879plb.69.1673025137881; Fri, 06 Jan 2023 09:12:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673025137; cv=none; d=google.com; s=arc-20160816; b=sUWRMPvAkqGdCBwQWL5Pzj54tW+VpZ5vtWp6WFgZIzhGbCn0cw56HmTyw4VtI4GpW1 r+lxrEJmz8nICsMf7X0tZ0Kai0Sk/v54oifqj6qget6rqHVfMv1Q/gzSykE/6KQUFnQi XL1q5gjhNJk+3OR4XUMJZL1u5fBuvI/7SITYOYfL5pBOQOrltvrL1SZwikNTJGlUSHnp +8WX8801ueopncIBnD1XFckenyPdmHcVR8w1Zv0y3y6qtGo0icHGdnW047SK87WJOFKC MWoPChT/CKjxDkp33N4tmWCmcwlzGQ9nGAsJ7XXCru6UA557o3DEvdyhI9fcRqFqFFWi xUXQ== 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 :message-id:date:subject:cc:to:from; bh=tDH5VldQyZ5Yva2mCa6GxzBhNmE81O7JsOP/ynC/AHw=; b=YypAP1dThoLSFQOYMN/niEmMEAEhHFVlLoBOcSxkMG0M02IsVXUNnNLi5chAI9R92y LYbG+o+k/J/TYeDJMWF6IdC7tW1T6gvFHy8v3qjR9Q0IZQ7oMiuJL6X6RuCyiEDq3BCn Ia1ibHdbY/2B66ePdDO9tHx7QIStY7zS8F7tB7JXImm+5GUeX98/NbBiQm4dJO2Uo1Zk dEWtE9BeznL3xqLIP5ugqk33Z7ejjqbiIGr7D3vjgV0ypxIhpo85qmNjcp58ghzg9ifd PlAvvnBcwf2TJa+XDuW9cUwA9kJn24ZF3TjD4Eg6sqtK/FVq/vpf71qZspAfkHuFEZF+ EFHA== 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:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o17-20020a170902779100b00186ab03eebfsi1322079pll.418.2023.01.06.09.12.04; Fri, 06 Jan 2023 09:12:17 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229547AbjAFRHq (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Fri, 6 Jan 2023 12:07:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230085AbjAFRHo (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 6 Jan 2023 12:07:44 -0500 X-Greylist: delayed 1057 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 06 Jan 2023 09:07:40 PST Received: from 19.mo582.mail-out.ovh.net (19.mo582.mail-out.ovh.net [188.165.56.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F5B5F8 for <linux-kernel@vger.kernel.org>; Fri, 6 Jan 2023 09:07:40 -0800 (PST) Received: from director9.ghost.mail-out.ovh.net (unknown [10.109.143.72]) by mo582.mail-out.ovh.net (Postfix) with ESMTP id AF6232622D for <linux-kernel@vger.kernel.org>; Fri, 6 Jan 2023 16:49:58 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-dkv5l (unknown [10.110.171.46]) by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id C0B041FF00; Fri, 6 Jan 2023 16:49:57 +0000 (UTC) Received: from sk2.org ([37.59.142.107]) by ghost-submission-6684bf9d7b-dkv5l with ESMTPSA id KI4TJzVRuGOnAQEAwhnnFg (envelope-from <steve@sk2.org>); Fri, 06 Jan 2023 16:49:57 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-107S0018fb2c2a3-f80b-4d71-80ed-2036c37f7c47, 9FE29456621203A27B372E1E0503D45BE0167874) smtp.auth=steve@sk2.org X-OVh-ClientIp: 82.65.25.201 From: Stephen Kitt <steve@sk2.org> To: Lee Jones <lee@kernel.org>, Daniel Thompson <daniel.thompson@linaro.org>, Jingoo Han <jingoohan1@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org>, Stephen Kitt <steve@sk2.org>, Helge Deller <deller@gmx.de>, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND 1/4] backlight: aat2870: Use backlight helper Date: Fri, 6 Jan 2023 17:48:52 +0100 Message-Id: <20230106164856.1453819-2-steve@sk2.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 5851864767681496795 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrkedtgdelgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuthgvphhhvghnucfmihhtthcuoehsthgvvhgvsehskhdvrdhorhhgqeenucggtffrrghtthgvrhhnpeelgeetueejffejfeejvefhtddufeejgfetleegtddukeelieelvddvteduveejtdenucfkphepuddvjedrtddrtddruddpfeejrdehledrudegvddruddtjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehsthgvvhgvsehskhdvrdhorhhgqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheekvddpmhhouggvpehsmhhtphhouhht X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754294007077843854?= X-GMAIL-MSGID: =?utf-8?q?1754294007077843854?= |
Series |
[RESEND,1/4] backlight: aat2870: Use backlight helper
|
|
Commit Message
Stephen Kitt
Jan. 6, 2023, 4:48 p.m. UTC
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 <steve@sk2.org>
---
drivers/video/backlight/aat2870_bl.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
Comments
On Fri, Jan 06, 2023 at 05:48:52PM +0100, Stephen Kitt wrote: > 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 <steve@sk2.org> Lee/Daniel, will you pick these up, or should I smash them all into drm-misc-next for 6.3? Stephen, I see to be missing 3/4 here, but maybe it'll show up. -Daniel > --- > 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 >
Hi Stephen, On Fri, Jan 06, 2023 at 05:48:52PM +0100, Stephen Kitt wrote: > 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 <steve@sk2.org> Nice cleanup. Reviewed-by: Sam Ravnborg <sam@ravnborg.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
Hi Daniel, On Fri, 6 Jan 2023 18:43:36 +0100, Daniel Vetter <daniel@ffwll.ch> wrote: > On Fri, Jan 06, 2023 at 05:48:52PM +0100, Stephen Kitt wrote: > > 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 <steve@sk2.org> > > Lee/Daniel, will you pick these up, or should I smash them all into > drm-misc-next for 6.3? > > Stephen, I see to be missing 3/4 here, but maybe it'll show up. It seems to have been delayed in transit, it showed up some time after all the others on the mailing lists. If you haven’t got it yet I can resend it! Regards, Stephen
On Fri, Jan 06, 2023 at 05:48:52PM +0100, Stephen Kitt wrote: > 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 <steve@sk2.org> This RESEND seems to have dropped the Reviewed-By tags provided the last time is was circulated: https://lore.kernel.org/all/20220608143233.l5pbopafqc4n6uwq@maple.lan/ There's only four patches so I guess I can add them again so the tools can pick them up. Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Daniel.
On Fri, Jan 06, 2023 at 06:43:36PM +0100, Daniel Vetter wrote: > On Fri, Jan 06, 2023 at 05:48:52PM +0100, Stephen Kitt wrote: > > 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 <steve@sk2.org> > > Lee/Daniel, will you pick these up, or should I smash them all into > drm-misc-next for 6.3? Outside of holiday, Lee usually hoovers up the backlight patches (and negotiates about who merges what). Daniel. > > --- > > 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 > > > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch
On Mon, 09 Jan 2023, Daniel Thompson wrote: > On Fri, Jan 06, 2023 at 06:43:36PM +0100, Daniel Vetter wrote: > > On Fri, Jan 06, 2023 at 05:48:52PM +0100, Stephen Kitt wrote: > > > 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 <steve@sk2.org> > > > > Lee/Daniel, will you pick these up, or should I smash them all into > > drm-misc-next for 6.3? > > Outside of holiday, Lee usually hoovers up the backlight patches (and > negotiates about who merges what). Right, I'll collect these into the Backlight tree if there aren't any build deps involved. If there are, we'll need to devise a strategy that will likely involve immutable branches.
On Fri, 06 Jan 2023, Stephen Kitt wrote: > 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 <steve@sk2.org> > --- > drivers/video/backlight/aat2870_bl.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) Applied, thanks
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)