From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06DEDC433DF for ; Thu, 28 May 2020 13:40:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9AC820814 for ; Thu, 28 May 2020 13:40:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="IX/dkhCu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390475AbgE1NkT (ORCPT ); Thu, 28 May 2020 09:40:19 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:55662 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390335AbgE1NkS (ORCPT ); Thu, 28 May 2020 09:40:18 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04SDdBlV065808; Thu, 28 May 2020 08:39:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1590673151; bh=npcL3ousxWc1AEURyZoxtYuBN6xsP8qyoExeUUSoYTA=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=IX/dkhCumikC0x7t9yO26t5+QMBpufcvKxieWktH8VBX8AKm2JObBIvciaZj1rQCa AWvc+/HTh3bF1ekc59cAO3MoM9kK33d5kmIDzcty5sAf9Vs+6ON2i0yz/ftMompkkY LuZG5lM7BfhV4u2utHUpoWv5ABrdAaWxXZSJBjZs= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04SDdBkD117338; Thu, 28 May 2020 08:39:11 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Thu, 28 May 2020 08:39:11 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Thu, 28 May 2020 08:39:11 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04SDd5F9023994; Thu, 28 May 2020 08:39:06 -0500 Subject: Re: [PATCH v2 03/16] backlight: add backlight_is_blank() To: Sam Ravnborg , , Jingoo Han , Lee Jones , Daniel Thompson , Tomi Valkeinen CC: Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Jani Nikula , Jonathan Corbet , Linus Walleij , , , Maarten Lankhorst , Maxime Ripard , Michael Hennerich , , Russell King , Support Opensource , Thierry Reding , Thomas Zimmermann , Uwe Kleine-Konig References: <20200517190139.740249-1-sam@ravnborg.org> <20200517190139.740249-4-sam@ravnborg.org> From: Peter Ujfalusi X-Pep-Version: 2.0 Message-ID: <7da620d2-d919-bd5d-e7ed-677248eb2719@ti.com> Date: Thu, 28 May 2020 16:39:47 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <20200517190139.740249-4-sam@ravnborg.org> Content-Type: multipart/mixed; boundary="------------22FFE234B984B96DE7353063" Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org --------------22FFE234B984B96DE7353063 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On 17/05/2020 22.01, Sam Ravnborg wrote: > The backlight support has two properties that express the state: > - power > - state >=20 > It is un-documented and easy to get wrong. > Add backlight_is_blank() helper to make it simpler for drivers > to get the check of the state correct. >=20 > A lot of drivers also includes checks for fb_blank. > This check is redundant when the state is checked > and thus not needed in this helper function. > But added anyway to avoid introducing subtle bug > due to the creative use in some drivers. >=20 > Rolling out this helper to all relevant backlight drivers > will eliminate almost all accesses to fb_blank. Reviewed-by: Peter Ujfalusi > v2: > - Added fb_blank condition (Daniel) >=20 > Signed-off-by: Sam Ravnborg > Cc: Daniel Vetter > Cc: Lee Jones > Cc: Daniel Thompson > Cc: Jingoo Han > --- > include/linux/backlight.h | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) >=20 > diff --git a/include/linux/backlight.h b/include/linux/backlight.h > index c7d6b2e8c3b5..a0a083b35c47 100644 > --- a/include/linux/backlight.h > +++ b/include/linux/backlight.h > @@ -175,6 +175,25 @@ static inline void backlight_put(struct backlight_= device *bd) > put_device(&bd->dev); > } > =20 > +/** > + * backlight_is_blank - Return true if display is expected to be blank= > + * @bd: the backlight device > + * > + * Display is expected to be blank if any of these is true:: > + * > + * 1) if power in not UNBLANK > + * 2) if fb_blank is not UNBLANK > + * 3) if state indicate BLANK or SUSPENDED > + * > + * Returns true if display is expected to be blank, false otherwise. > + */ > +static inline bool backlight_is_blank(struct backlight_device *bd) > +{ > + return bd->props.power !=3D FB_BLANK_UNBLANK || > + bd->props.fb_blank !=3D FB_BLANK_UNBLANK || > + bd->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK); > +} > + > extern struct backlight_device *backlight_device_register(const char *= name, > struct device *dev, void *devdata, const struct backlight_ops *ops, > const struct backlight_properties *props); >=20 - P=C3=A9ter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki --------------22FFE234B984B96DE7353063 Content-Type: application/pgp-keys; name="pEpkey.asc" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="pEpkey.asc" -----BEGIN PGP PUBLIC KEY BLOCK----- mQENBFki4nsBCAD3BM+Ogt951JlaDloruEjoZk/Z+/37CjP0fY2mqLhBOzkpx95u X1Fquf0KfVk+ZzCd25XGOZEtpZNlXfbxRr2iRWPS5RW2FeLYGvg2TTJCpSr+ugKu OOec6KECCUotGbGhpYwBrbarJNEwDcAzPK7UJYa1rhWOmkpZJ1hXF1hUghB84q35 8DmN4sGLcsIbVdRFZ1tWFh4vGBFV9LsoDZIrnnANb6/XMX78s+tr3RG3GZBaFPl8 jO5IIv0UIGNUKaYlNVFYthjGCzOqtstHchWuK9eQkR7m1+Vc+ezh1qK0VJydIcjn OtoMZZL7RAz13LB9vmcJjbQPnI7dJojz/M7zABEBAAG0JlBldGVyIFVqZmFsdXNp IDxwZXRlci51amZhbHVzaUB0aS5jb20+iQFOBBMBCAA4FiEE+dBcpRFvJjZw+uta LCayis85LN4FAlki4nsCGwMFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQLCay is85LN4QjggAzxxxXqiWpA3vuj9yrlGLft3BeGKWqF8+RzdeRvshtNdpGeIFf+r5 AJVR71R1w89Qeb4DGXus7qsKiafdFGG7yxbuhw8a5wUm+ZncBXA+ETn3OyVtl8g8 r/ZcPX420jClBNTVuL0sSnyqDFDrt5f+uAFOIwsnHdpns174Zu9QhgYxdvdZ+jMh Psb745O9EVeNvdfUIRdrVjb4IhJKNIzkb0Tulsz5xeCJReUYpxZU1jzEq3YZqIou +fi+oS4wlJuSoxKKTmIXtSeEy/weStF1XHMo6vLYqzaK4FyIuclqeuYUYSVy2425 7TMXugaI+O85AEI6KW8MCcu1NucSfAWUabkBDQRZIuJ7AQgAypKq8iIugpHxWA2c Ck6MQdPBT6cOEVK0tjeHaHAVOUPiw9Pq+ssMifdIkDdqXNZ3RLH/X2svYvd8c81C egqshfB8nkJ5EKmQc9d7s0EwnYT8OwsoVb3c2WXnsdcKEyu2nHgyeJEUpPpMPyLc +PWhoREifttab4sOPktepdnUbvrDK/gkjHmiG6+L2owSn637N+Apo3/eQuDajfEu kybxK19ReRcp6dbqWSBGSeNB32c/zv1ka37bTMNVUY39Rl+/8lA/utLfrMeACHRO FGO1BexMASKUdmlB0v9n4BaJFGrAJYAFJBNHLCDemqkU7gjaiimuHSjwuP0Wk7Ct KQJfVQARAQABiQE2BBgBCAAgFiEE+dBcpRFvJjZw+utaLCayis85LN4FAlki4nsC GwwACgkQLCayis85LN7kCwgAoy9r3ZQfJNOXO1q/YQfpEELHn0p8LpwliSDUS1xL sswyxtZS8LlW8PjlTXuBLu38Vfr0vGav7oyV7TkhnKT3oBOLXanyZqwgyZSKNEGB PB4v3Fo7YTzpfSofiwuz03uyfjTxiMGjonxSb+YxM7HBHfzjrOKKlg02fK+lWNZo m5lXugeWD7U6JJguNdYfr+U4zYIblelUImcIE+wnR0oLzUEVDIWSpVrl/OqS3Rzo mw8wBsHksTHrbgUnKL0SCzYc90BTeKbyjEBnVDr+dlfbxRxkB8h9RMPMdjodvXzS Gfsa9V/k4XAsh7iX9EUVBbnmjA61ySxU/w98h96jMuteTg=3D=3D =3DeQmw -----END PGP PUBLIC KEY BLOCK----- --------------22FFE234B984B96DE7353063--