From patchwork Thu May 14 19:09:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189143 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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 D91F2C433E7 for ; Thu, 14 May 2020 19:10:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B712C206A5 for ; Thu, 14 May 2020 19:10:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oj0oQMsc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730285AbgENTK0 (ORCPT ); Thu, 14 May 2020 15:10:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730284AbgENTKY (ORCPT ); Thu, 14 May 2020 15:10:24 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E09A2C061A0C; Thu, 14 May 2020 12:10:23 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id g4so4777558ljl.2; Thu, 14 May 2020 12:10:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5PQMEcv1NfMXN6wgUUifwpupdvWgrHF4WujE2wy4cnE=; b=oj0oQMsctNEpY1Wsm80tWYK/q7dzRkAqb6HlnzXJUL19Cgmz4XskAKYFsBqvAuDqmR Tb6ANd9TbmRjHWu2Fi4ZgPck973cCMYCiI2gGKP2evVR8HKW0Uec8a1bSvCX4jMsBtp7 v+PgVhXgn1CHe9CRVJDwFex4n1MFv0Fq9MPCLFjQ1soe26jMwinI6RRNQVOrtUJjKFQD zk95KlNJOtSxy/L3D0nlWAmJuotrWdD9Rl/dQMGD7QjXrO1VMCxoZCdCWKu+n0OHOQsC OLAwaYaIaM9+L8bl5EYgYapIbN4gS07Zp9eAIW7DiVadx9TmJKp0aam96POD0/0IpIcO 10fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=5PQMEcv1NfMXN6wgUUifwpupdvWgrHF4WujE2wy4cnE=; b=joq7i9GEN6euVwz3qWMQXvEcTi+hTQ/2rjgs1Pdq6mOMunxVydHaCXJHU4umcJzNeq diWZs4s+YNfJDSwBsMpfHM/RH1nrUSKyh5iYC4s2d2Ebsg93+LFjr1THxkXnCWSMWO32 Jpgvfz5llaUkWxYEOiruY575cscvCaB8dU6Mkz221abQmpeMm/9Krc0EjyEpRav9uz6g yoqz9bnnB92E9qXIVfYFFTBQeTD1RRWu2fBAMP/VrPJOwODQY8sbMYxUsT4NOlqyOKjI x4PE3zNuLhjTR+XQfgY0gjddlYICRcGnKB3Cb0wZpvw3z8++KQJ1lBPvjZtMU6vIPhda LGCQ== X-Gm-Message-State: AOAM533lZJN/IlubdAteb6Sh5/9WTGIbWFe6w4XDq+C9UxKeqhReRTHs ZGy8awnXlXtHeUy4EPAAXU0= X-Google-Smtp-Source: ABdhPJzQGH3odWJt1CgHuRerG8SSDuaUrK5vOO5PmO0Wr7eBmwauHxTg8DZWDE/ijgcS4S+dMFzoxg== X-Received: by 2002:a2e:9843:: with SMTP id e3mr3717492ljj.249.1589483422387; Thu, 14 May 2020 12:10:22 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:21 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Cc: Allison Randal , Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Enrico Weigelt , Jani Nikula , Jonathan Corbet , Jyri Sarha , Kate Stewart , Kefeng Wang , Laurent Pinchart , Linus Walleij , linux-arm-msm@vger.kernel.org, linux-pwm@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Michael Hennerich , patches@opensource.cirrus.com, Russell King , Sam Ravnborg , Support Opensource , Thierry Reding , Thomas Gleixner , Thomas Zimmermann , Tomi Valkeinen , Uwe Kleine Konig , Zheng Bin Subject: [PATCH v1 04/18] backlight: make of_find_backlight static Date: Thu, 14 May 2020 21:09:47 +0200 Message-Id: <20200514191001.457441-5-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-1-sam@ravnborg.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org There are no external users of of_find_backlight, as they have all changed to use the managed version. Make of_find_backlight static to prevent new external users. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/backlight.c | 31 ++++++++++------------------- include/linux/backlight.h | 6 ------ 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index cac3e35d7630..511bb382c584 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -600,22 +600,7 @@ struct backlight_device *of_find_backlight_by_node(struct device_node *node) EXPORT_SYMBOL(of_find_backlight_by_node); #endif -/** - * of_find_backlight - Get backlight device - * @dev: Device - * - * This function looks for a property named 'backlight' on the DT node - * connected to @dev and looks up the backlight device. - * - * Call backlight_put() to drop the reference on the backlight device. - * - * Returns: - * A pointer to the backlight device if found. - * Error pointer -EPROBE_DEFER if the DT property is set, but no backlight - * device is found. - * NULL if there's no backlight property. - */ -struct backlight_device *of_find_backlight(struct device *dev) +static struct backlight_device *of_find_backlight(struct device *dev) { struct backlight_device *bd = NULL; struct device_node *np; @@ -641,7 +626,6 @@ struct backlight_device *of_find_backlight(struct device *dev) return bd; } -EXPORT_SYMBOL(of_find_backlight); static void devm_backlight_release(void *data) { @@ -652,9 +636,16 @@ static void devm_backlight_release(void *data) * devm_of_find_backlight - Resource-managed of_find_backlight() * @dev: Device * - * Device managed version of of_find_backlight(). - * The reference on the backlight device is automatically - * dropped on driver detach. + * This function looks for a property named 'backlight' on the DT node + * connected to @dev and looks up the backlight device. + * The lookup is device managed so the reference to the backlight device + * is automatically dropped on driver detach. + * + * Returns: + * A pointer to the backlight device if found. + * Error pointer -EPROBE_DEFER if the DT property is set, but no backlight + * device is found. + * NULL if there's no backlight property. */ struct backlight_device *devm_of_find_backlight(struct device *dev) { diff --git a/include/linux/backlight.h b/include/linux/backlight.h index c7d6b2e8c3b5..a0f03bb322d7 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -219,14 +219,8 @@ of_find_backlight_by_node(struct device_node *node) #endif #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) -struct backlight_device *of_find_backlight(struct device *dev); struct backlight_device *devm_of_find_backlight(struct device *dev); #else -static inline struct backlight_device *of_find_backlight(struct device *dev) -{ - return NULL; -} - static inline struct backlight_device * devm_of_find_backlight(struct device *dev) { From patchwork Thu May 14 19:09:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189142 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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 99325C433DF for ; Thu, 14 May 2020 19:10:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77DF5206DC for ; Thu, 14 May 2020 19:10:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CVItBRgQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730290AbgENTK3 (ORCPT ); Thu, 14 May 2020 15:10:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730289AbgENTK2 (ORCPT ); Thu, 14 May 2020 15:10:28 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D456C061A0C; Thu, 14 May 2020 12:10:28 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id a9so3574460lfb.8; Thu, 14 May 2020 12:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=es7L7BT5X1JhlaIi9tn96sUgeVkIuHpmkzZvtAwIcug=; b=CVItBRgQEjiAp4UKpopUfv37fyjDo1mY+XLZ8itHw+itr+e6Dc2W1Vwv+h7O94kTKO ojVnxcMI0XuVLhYbZThBf7xSndRQhUZSUZygweq503IdIl7oGa+TRkVU/DAqknpwVA6X 5bEKgfcjbRZqcFUz+Thpwnr7oStu1zNdb2ghP8iQ/wS46V6lMGfIv0ZJItty3by/0hQ4 IQRDi7Kk0xZ39rzzeWMQM6XgJ+9P9vc5XpXlmbrKDKLDNbvetdJN+utHwluVYHA91VyE sn4qpE62jAztmy4V6sw51DHoW0Gb2YlPqpjmqYegPOojTKEuWN9eAiXcYRW6u0eIXkJU udHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=es7L7BT5X1JhlaIi9tn96sUgeVkIuHpmkzZvtAwIcug=; b=WVhpE7TmyACU8F+T8fq7XozhblFFPr64zlc54fyd6HJf8u2lfpRoPBFcOWPSu6IHbL qddZFKpqwXO/EGOygetxypGZqKmQc15cdf6eoLl2iavdxsvGR994wVfrF4X+2RbkcnX2 /SVS3oaFCCRWybafuWq4QfYFOJFe+gAgIKVy0+cEBVpjN6EF39RS2scGOppkQze6UU0W q4+cn3JhtBReIhBSGnaZpUeaCyxHIxG6GfJpgtlwJstGNmt52Xkw/uCcLwDEeulRP30L 9ZEtB5eMnwDT6zhTvDhAM7fiJPNQN1iBWa2DR9dIPRCzjGTGRYOcKcKp9uwbNr3J7p06 EBfQ== X-Gm-Message-State: AOAM5304ZotrTkgnEaDXJvFrSSBW0eGRWzkPIi/IBnYGAjHqlZFrcvRZ TBvv7eH/M77PGQK3AHyLCnw= X-Google-Smtp-Source: ABdhPJz8pGerusE9OOKAKVj0mi5K/KXSSEFkTv+0WU6pZ/84b7vD0iKdmma7g9JVVyDE/6Qynkos6Q== X-Received: by 2002:ac2:4436:: with SMTP id w22mr4268011lfl.55.1589483426792; Thu, 14 May 2020 12:10:26 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:26 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Cc: Allison Randal , Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Enrico Weigelt , Jani Nikula , Jonathan Corbet , Jyri Sarha , Kate Stewart , Kefeng Wang , Laurent Pinchart , Linus Walleij , linux-arm-msm@vger.kernel.org, linux-pwm@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Michael Hennerich , patches@opensource.cirrus.com, Russell King , Sam Ravnborg , Support Opensource , Thierry Reding , Thomas Gleixner , Thomas Zimmermann , Tomi Valkeinen , Uwe Kleine Konig , Zheng Bin Subject: [PATCH v1 06/18] backlight: make of_find_backlight_by_node() static Date: Thu, 14 May 2020 21:09:49 +0200 Message-Id: <20200514191001.457441-7-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-1-sam@ravnborg.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org There are no external users of of_find_backlight_by_node(). Make it static so we keep it that way. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/backlight.c | 22 +++++++++------------- include/linux/backlight.h | 10 ---------- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 547aa3e1a03a..91dfcf4a2087 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -577,19 +577,9 @@ static int of_parent_match(struct device *dev, const void *data) return dev->parent && dev->parent->of_node == data; } -/** - * of_find_backlight_by_node() - find backlight device by device-tree node - * @node: device-tree node of the backlight device - * - * Returns a pointer to the backlight device corresponding to the given DT - * node or NULL if no such backlight device exists or if the device hasn't - * been probed yet. - * - * This function obtains a reference on the backlight device and it is the - * caller's responsibility to drop the reference by calling put_device() on - * the backlight device's .dev field. - */ -struct backlight_device *of_find_backlight_by_node(struct device_node *node) +/* Find backlight device by device-tree node */ +static struct backlight_device * +of_find_backlight_by_node(struct device_node *node) { struct device *dev; @@ -598,6 +588,12 @@ struct backlight_device *of_find_backlight_by_node(struct device_node *node) return dev ? to_backlight_device(dev) : NULL; } EXPORT_SYMBOL(of_find_backlight_by_node); +#else +static struct backlight_device * +of_find_backlight_by_node(struct device_node *node) +{ + return NULL; +} #endif static struct backlight_device *of_find_backlight(struct device *dev) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 3d757a850b88..b7839ea9d00a 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -198,16 +198,6 @@ struct generic_bl_info { void (*kick_battery)(void); }; -#ifdef CONFIG_OF -struct backlight_device *of_find_backlight_by_node(struct device_node *node); -#else -static inline struct backlight_device * -of_find_backlight_by_node(struct device_node *node) -{ - return NULL; -} -#endif - #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) struct backlight_device *devm_of_find_backlight(struct device *dev); #else From patchwork Thu May 14 19:09:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189141 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=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 C626EC433E6 for ; Thu, 14 May 2020 19:10:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A782D206A5 for ; Thu, 14 May 2020 19:10:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KV/zGbts" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729051AbgENTKc (ORCPT ); Thu, 14 May 2020 15:10:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730292AbgENTKb (ORCPT ); Thu, 14 May 2020 15:10:31 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7660C061A0C; Thu, 14 May 2020 12:10:30 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id v5so3550658lfp.13; Thu, 14 May 2020 12:10:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BQs36UgnZaPqNCAzoKYxz5KT6Lkm6yBS/09B/P3wXNw=; b=KV/zGbtsbcJBxUhUrfp45Uhh9notrMrdzzIKpcIeNRZ/UIuQ/tcjKahpPEWXfvxjQb fWQduc+4oFVyt7yP8uiuMgRZYrIvtzZIsyxgQIUbPgznA9JEDfpPvg6cIzkEXUjvLDZo he3er8hWZZU0Y4FfDT/EexB/aBkbi9afI923EWgCYS5/odE77G00lIdQ9AeypaW6gdU6 llakEYcUjg33wxYGfyHigCcxeRFC/qukFHM3HxAM9cbekovP2VNIiu2OiHn5Hz9azwIG IkzaQwXo3GYPH6OXim2AktQ+wWIk6d5QgDhExmYL8tbK7KhBCvtPQZ1w4CvKnxZEPGlV 90Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BQs36UgnZaPqNCAzoKYxz5KT6Lkm6yBS/09B/P3wXNw=; b=V3uRItbEUyih1D9q+JRL5xz8wGlKMlG2cOj/e/bLZzGmA9Yk0tSeXP/utGZpnYFkM3 2qYW7Wp7B4kgXCGObz/AieRCyzA07chWDbSBwIvffJWKLDgEXyMfv421pW3WJULd9ogZ cMrPQ8dbWfwd0fkE1EL+GFm/j1H3FGaKpAEcjNsk0NG9wTevEGIlYb4uzhcuuRp7pmNK sVQuIdykrhXfECzGWY6N5EJM2ynH8Lf5ALpiIah7Cu+kKKSE0P3Nt+hJwb2J272I4HvH 5Z4GkCQKq7Z9lQijUVYogGEndOWeBbXqm3KNjOWriAc9Bgo/qfpkOuPHYPbU0ANqCjWy GnZg== X-Gm-Message-State: AOAM533kt0QB9w2nQjz7ZtjxaPLTRPNPWp23UmlnDxlFUyecQsxvYuI2 U7JuiWf+Jn1mtVlsvps+c4A= X-Google-Smtp-Source: ABdhPJyaih7Y5ge2hEfQtSUZ8mgLT+i9VMogVKUGX/RzFXXlVNpwUIo3AxeVCYK+anlI7bCTNwaz4Q== X-Received: by 2002:ac2:44cd:: with SMTP id d13mr2565957lfm.2.1589483429230; Thu, 14 May 2020 12:10:29 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:28 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Cc: Allison Randal , Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Enrico Weigelt , Jani Nikula , Jonathan Corbet , Jyri Sarha , Kate Stewart , Kefeng Wang , Laurent Pinchart , Linus Walleij , linux-arm-msm@vger.kernel.org, linux-pwm@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Michael Hennerich , patches@opensource.cirrus.com, Russell King , Sam Ravnborg , Support Opensource , Thierry Reding , Thomas Gleixner , Thomas Zimmermann , Tomi Valkeinen , Uwe Kleine Konig , Zheng Bin Subject: [PATCH v1 07/18] backlight: refactor fb_notifier_callback() Date: Thu, 14 May 2020 21:09:50 +0200 Message-Id: <20200514191001.457441-8-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-1-sam@ravnborg.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Increase readability of fb_notifier_callback() by removing a few indent levels. No functional change. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- drivers/video/backlight/backlight.c | 43 +++++++++++++++-------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 91dfcf4a2087..5e08f4f1c99a 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -58,28 +58,29 @@ static int fb_notifier_callback(struct notifier_block *self, bd = container_of(self, struct backlight_device, fb_notif); mutex_lock(&bd->ops_lock); - if (bd->ops) - if (!bd->ops->check_fb || - bd->ops->check_fb(bd, evdata->info)) { - fb_blank = *(int *)evdata->data; - if (fb_blank == FB_BLANK_UNBLANK && - !bd->fb_bl_on[node]) { - bd->fb_bl_on[node] = true; - if (!bd->use_count++) { - bd->props.state &= ~BL_CORE_FBBLANK; - bd->props.fb_blank = FB_BLANK_UNBLANK; - backlight_update_status(bd); - } - } else if (fb_blank != FB_BLANK_UNBLANK && - bd->fb_bl_on[node]) { - bd->fb_bl_on[node] = false; - if (!(--bd->use_count)) { - bd->props.state |= BL_CORE_FBBLANK; - bd->props.fb_blank = fb_blank; - backlight_update_status(bd); - } - } + + if (!bd->ops) + goto out; + if (bd->ops->check_fb && !bd->ops->check_fb(bd, evdata->info)) + goto out; + + fb_blank = *(int *)evdata->data; + if (fb_blank == FB_BLANK_UNBLANK && !bd->fb_bl_on[node]) { + bd->fb_bl_on[node] = true; + if (!bd->use_count++) { + bd->props.state &= ~BL_CORE_FBBLANK; + bd->props.fb_blank = FB_BLANK_UNBLANK; + backlight_update_status(bd); + } + } else if (fb_blank != FB_BLANK_UNBLANK && bd->fb_bl_on[node]) { + bd->fb_bl_on[node] = false; + if (!(--bd->use_count)) { + bd->props.state |= BL_CORE_FBBLANK; + bd->props.fb_blank = fb_blank; + backlight_update_status(bd); } + } +out: mutex_unlock(&bd->ops_lock); return 0; } From patchwork Thu May 14 19:09:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189139 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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 0BB56C433DF for ; Thu, 14 May 2020 19:10:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1FEA2076A for ; Thu, 14 May 2020 19:10:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hmEzwt90" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728752AbgENTKk (ORCPT ); Thu, 14 May 2020 15:10:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728366AbgENTKg (ORCPT ); Thu, 14 May 2020 15:10:36 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BD0BC061A0C; Thu, 14 May 2020 12:10:36 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id 8so3611613lfp.4; Thu, 14 May 2020 12:10:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=62dugcWsovCeCskk/LKWdY/i7tcZK4WDkmw+PPDUYp0=; b=hmEzwt90DZ7x99DPyRV6/hvrG2vuVWtFc62KnUO3UBwXxpBa4RO+CO0Yd4cwPS1GPU PsZhmR/YGuJbKV1hs5Ah0j2oll5bCnbp+SJLk4CiL76I9JpIYfKvDGXMs410dHKyLFVV 2QFgL0oKBOSbKK5nfGLrWpfz1AzvNAuWO2G7nlYD1KwjaqZd6efLZLTcWEg6kdCXkq/y d08f96AQ7fGekUXvVfIVuvX7qjp3qfJaEa7Nry04lPM8p5aJDuJJoZAX19OX4qydbEH3 ewBrwT57tPyR9qdrYGwCDHi59X+F8Z/b5cpdzF83DmfGG6VIgbzDjX0u/NH0SbSfxZP5 d1ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=62dugcWsovCeCskk/LKWdY/i7tcZK4WDkmw+PPDUYp0=; b=ou4zDtqeRekqF0a/23E7a/ESb3To92FBWH/ydiGEKo76ih/gRuWQSkCyVhMZIBXVTB HvZZiETWKV6IiAo/mKTUzPpFqtaqNsiR5nshIFFIGwLMEG3eRsGk+FoLQGwhhTL5QB24 w9F6to8LivyvG+7YeYvNksgJ1ReiSY/YmkCY/MtNsaqkeHB4TZlSBf2bf0jUnpLDV98u 9s1yPen9eNC5uigHX08V38X8W+gXciYixXNUKRhss47NQ1H0lxDh/rNbG26CpLO+aqwH k7ugjA77Feo6e/ftiYObQU8/tgPbTXyBL3EfSqAi6AruQJunD1UqdHyGxDcGIkEuklhj 1lCQ== X-Gm-Message-State: AOAM530xR6M9Dqz9CbFWkZ+YkSsjnw31fgZNDSVO+ate4xAcJbJS1VCx 8u2z43O2h32xHR27gWHAzgg= X-Google-Smtp-Source: ABdhPJw+1WHsEHe6VbX3gtcUnN10QNwuwD64Zx0hRMjc16fHurTG/QV6aCvAhZrWJ1MOCzc4ALaROA== X-Received: by 2002:ac2:4da1:: with SMTP id h1mr4242794lfe.152.1589483434518; Thu, 14 May 2020 12:10:34 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:33 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Cc: Allison Randal , Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Enrico Weigelt , Jani Nikula , Jonathan Corbet , Jyri Sarha , Kate Stewart , Kefeng Wang , Laurent Pinchart , Linus Walleij , linux-arm-msm@vger.kernel.org, linux-pwm@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Michael Hennerich , patches@opensource.cirrus.com, Russell King , Sam Ravnborg , Support Opensource , Thierry Reding , Thomas Gleixner , Thomas Zimmermann , Tomi Valkeinen , Uwe Kleine Konig , Zheng Bin Subject: [PATCH v1 09/18] backlight: improve backlight_ops documentation Date: Thu, 14 May 2020 21:09:52 +0200 Message-Id: <20200514191001.457441-10-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-1-sam@ravnborg.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Improve the documentation for backlight_ops and adapt it to kernel-doc style. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 60 +++++++++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index e67e926de1e2..51f0d0abea25 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -55,19 +55,67 @@ enum backlight_scale { struct backlight_device; struct fb_info; +/** + * struct backlight_ops - backlight operations + * + * The backlight operations are specifed when the backlight device is registered. + */ struct backlight_ops { + /** + * @options: + * + * The options parameter is used to adjust the behaviour of the core. + * Set BL_CORE_SUSPENDRESUME to get the update_status() operation called + * upon suspend and resume. + */ unsigned int options; #define BL_CORE_SUSPENDRESUME (1 << 0) - /* Notify the backlight driver some property has changed */ + /** + * @update_status: + * + * Notify the backlight driver some property has changed. + * The update_status operation is protected by the update_lock. + * + * The backlight driver is expected to use backlight_is_blank() + * to check if the display is blanked and set brightness accordingly. + * update_status() is called when any of the properties has changed. + * + * RETURNS: + * + * 0 on sucees, negative error code if any failure occured. + */ int (*update_status)(struct backlight_device *); - /* Return the current backlight brightness (accounting for power, - fb_blank etc.) */ + + /** + * @get_brightness: + * + * Return the current backlight brightness. + * The driver may implement this as a readback from the HW. + * This operation is optional and if not present then the current brightness + * property value is used. + * + * RETURNS: + * + * A brightness value which is 0 or a positive numer. + * On failure a negative error code is returned. + */ int (*get_brightness)(struct backlight_device *); - /* Check if given framebuffer device is the one bound to this backlight; - return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ - int (*check_fb)(struct backlight_device *, struct fb_info *); + + /** + * @check_fb: + * + * Check if given framebuffer device is the one bound to this backlight. + * This operation is optional and if not implemented it is assumed that the + * fbdev is always the one bound to the backlight. + * + * RETURNS: + * + * If info is NULL or the info matches the fbdev bound to the backlight return true. + * If info does not match the fbdev bound to the backlight return false. + */ + int (*check_fb)(struct backlight_device *bd, struct fb_info *info); }; /* This structure defines all the properties of a backlight */ From patchwork Thu May 14 19:09:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189140 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=-7.9 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, EXCUSE_4, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 51378C433E4 for ; Thu, 14 May 2020 19:10:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25583206F1 for ; Thu, 14 May 2020 19:10:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cidQOtSQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730298AbgENTKj (ORCPT ); Thu, 14 May 2020 15:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728752AbgENTKi (ORCPT ); Thu, 14 May 2020 15:10:38 -0400 Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E731C061A0E; Thu, 14 May 2020 12:10:38 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id 202so128447lfe.5; Thu, 14 May 2020 12:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DU9BwH5P6JpnKqtdKJ6tqvGSR4Gzunk38snlPE5mOfk=; b=cidQOtSQ/2cvmUi149fw0puJ03Rou6Ou3yGl+kps97oZSBOHCqwFqaes1QXK3q8lyp nuNk+dbzYSoQnX0F061oC5j8HDGQMuhdkqoGoW5xJRX7nSw4D7x3xrkn2nQ6n0Q5alqw 3OIhhmAT0SN4V5SN4/GC5TQB/rkJoq/XopbU5UVXTu+cslDxLjZrlYueolViXrKKoDuL hGR8uCjg/ypoQS423tRoCcD9K6DMisYG8T3KxVUT7cYp51U+T5ESQcye8Fk4dOAmBxY3 AdmEJy3Ek/x0/cQeAG4aac5OJNc/0Dt8HtN5BORz4zNyQQoICTlTjf/Jdk8qw/8j1R1T zT4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=DU9BwH5P6JpnKqtdKJ6tqvGSR4Gzunk38snlPE5mOfk=; b=McJq4fED+i0xP5q4NNSCxOW2fnFmcxiRG0+EIWfqgDhXGogKVMg1fbeOpPvMggZ3nr mAOcXTH3vyLgrBCrQ1Ax9CsyrHYOFybACVaTAJG5pOEapzE77L798ZIu12KJFm5Q14U6 8RrNnyBjlMgr/cWq5eSgSU1kP2L3roxJDud60lgoqvNneBXQALY8khJa+KVoUiQaPk3y ObgVuNIvO6iIzxLXbnl4SD+5omTfP6g74HmnRh4VxWMG3kHNWL5Zjnwg9OmxhSl4GlYt yT63tdKK66PFQLLHQCBYFycOoY4Qxt6Kvs5cR+KK4FVkFa7mJJRx/6AWc46B4I6zUZLB eMFQ== X-Gm-Message-State: AOAM5311OHUTAsWRLo6g4Kp37isejXiwCiw2wNBC0F4zzZ9MFWx9r+dl bVZZkBXsQ54QdO7XGf2oS8s= X-Google-Smtp-Source: ABdhPJzMUI3wXjuWNAVuLeVxiJIQ+xHYSiwpRZJ0PPAitpNM8uo7AAQUzfKu+agdL1tLH8/i1w/U2A== X-Received: by 2002:a19:c04:: with SMTP id 4mr3990355lfm.17.1589483436799; Thu, 14 May 2020 12:10:36 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:36 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Cc: Allison Randal , Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Enrico Weigelt , Jani Nikula , Jonathan Corbet , Jyri Sarha , Kate Stewart , Kefeng Wang , Laurent Pinchart , Linus Walleij , linux-arm-msm@vger.kernel.org, linux-pwm@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Michael Hennerich , patches@opensource.cirrus.com, Russell King , Sam Ravnborg , Support Opensource , Thierry Reding , Thomas Gleixner , Thomas Zimmermann , Tomi Valkeinen , Uwe Kleine Konig , Zheng Bin Subject: [PATCH v1 10/18] backlight: improve backlight_properties documentation Date: Thu, 14 May 2020 21:09:53 +0200 Message-Id: <20200514191001.457441-11-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-1-sam@ravnborg.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Improve the documentation for backlight_properties and adapt it to kernel-doc style. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 101 +++++++++++++++++++++++++++++++++----- 1 file changed, 90 insertions(+), 11 deletions(-) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 51f0d0abea25..c81b77af44d4 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -118,28 +118,107 @@ struct backlight_ops { int (*check_fb)(struct backlight_device *bd, struct fb_info *info); }; -/* This structure defines all the properties of a backlight */ +/** + * struct backlight_properties - backlight properties + * + * This structure defines all the properties of a backlight. + */ struct backlight_properties { - /* Current User requested brightness (0 - max_brightness) */ + /** + * @brightness: + * + * The current requested brightness by the user. + * The backlight core makes sure the range is (0 - max_brightness) + * when the brightness is set via the sysfs attribute: + * /sys/class/backlight//brightness. + * + * This value can be set in the backlight_properties passed + * to devm_backlight_device_register() to set a default brightness + * value. + */ int brightness; - /* Maximal value for brightness (read-only) */ + + /** + * @max_brightness: + * + * The maximum brightness value. + * + * This value must be set in the backlight_properties passed + * to devm_backlight_device_register(). + * + * This property must not be modified by a driver except + * before registering the backlight device as explained above. + */ int max_brightness; - /* Current FB Power mode (0: full on, 1..3: power saving - modes; 4: full off), see FB_BLANK_XXX */ + + /** + * @power: + * + * The current power mode. User space configure the power mode using + * the sysfs attribute: /sys/class/backlight//bl_power + * When the power property is updated update_status() is called. + * + * The possible values are: (0: full on, 1..3: power saving + * modes; 4: full off), see FB_BLANK_XXX. + * + * When the backlight device is enabled @power is set + * to FB_BLANK_UNBLANK. When the backlight device is disabled + * @power is set to FB_BLANK_POWERDOWN. + */ int power; - /* FB Blanking active? (values as for power) */ - /* Due to be removed, please use (state & BL_CORE_FBBLANK) */ + + /** + * @fb_blank: + * + * When the FBIOBLANK ioctl is called fb_blank is set to the + * blank parameter and the update_status() operation is called. + * + * When the backlight device is enabled @fb_blank is set + * to FB_BLANK_UNBLANK. When the backlight device is disabled + * @fb_blank is set to FB_BLANK_POWERDOWN. + * + * This property must not be modified by a driver. + * The backlight driver shall never read this variable, + * as the necessary info is avaialble via the state. + * + * fb_blank is deprecated and will be removed. + */ int fb_blank; - /* Backlight type */ + + /** + * @type: + * + * The type of backlight supported. + * The backlight type allows userspace to make appropriate + * policy desicions based on the backlight type. + * + * This value must be set in the backlight_properties + * passed to devm_backlight_device_register(). + */ enum backlight_type type; - /* Flags used to signal drivers of state changes */ + + /** + * @state: + * + * The state property is used to inform drivers of state changes + * when the update_status() operation is called. + * The state is a bitmask. BL_CORE_FBBLANK is set when the display + * is expected to be blank. BL_CORE_SUSPENDED is set when the + * driver is suspended. + * + * This property must not be modified by a driver. + */ unsigned int state; - /* Type of the brightness scale (linear, non-linear, ...) */ - enum backlight_scale scale; #define BL_CORE_SUSPENDED (1 << 0) /* backlight is suspended */ #define BL_CORE_FBBLANK (1 << 1) /* backlight is under an fb blank event */ + /** + * @scale: + * + * The type of the brightness scale (linear, non-linear, ...) + */ + enum backlight_scale scale; }; struct backlight_device { From patchwork Thu May 14 19:09:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189138 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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 A42BBC433EA for ; Thu, 14 May 2020 19:10:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 85E95206F1 for ; Thu, 14 May 2020 19:10:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="l7NkQzxm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727830AbgENTKp (ORCPT ); Thu, 14 May 2020 15:10:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729158AbgENTKo (ORCPT ); Thu, 14 May 2020 15:10:44 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3489AC061A0C; Thu, 14 May 2020 12:10:44 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id h4so4714984ljg.12; Thu, 14 May 2020 12:10:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7NL7oOh2YpmGkieh3R7y/HMeuTthqrGLkMzsF1Tg8k0=; b=l7NkQzxmJKlSolH7PJHAvYG4SzzLtTDVkv7A5b8wb8TSIjPhQGtgXsYBBxnnIAKqbX pJchKTttYj1Gbcaqq2XupUvICzobt2Mdl1t7G2DjVrE3+Gc/y0pP4bJCp89MlCOLUl0w 6YK2XlFOt1c286dSaBmDauQ6RcHYnYLOKfyPPaAsKIYpTc58IFpkPagWZURSJewPXbg5 EPtuXM63ZGxf3p+ucfulm5rjpVbQkDph0XKtaojCjYaAxEudP3XAelw/UxLGxdNb498w eIf4RiMOc8ZesgTFe1ULkkmrT+hrwmmOvibWieZpqaLpBXNGmTQo1k5leY/tBU65PwP7 0OIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=7NL7oOh2YpmGkieh3R7y/HMeuTthqrGLkMzsF1Tg8k0=; b=nbv492qkhxz9XMW3PrTyQLOoWpjDL6mV1T/z/IrQXvGMQAC7VcZ17vYostiTLrlIAt XJPBRLQyuCCeoVxOl86YIa4SlJILdXtF/0GxuE5K59hUN7TLOTi75eP04a9mIUos+qjA x6rYPM86d8SF6oOTED/4JMWYEro483xgQd/AxyqTXOqtkxRZHpMw4pcUFeMUCSRWMvRv vjN2ymSmEO8mtbUEG2KSWQyYdKZXzCBX6gn4kZDDvwJlBZMQs5Tp4ZLBRGx9HK3ZItW/ KrKMZ8yh9O1vRU5+lLiarpG2hXMIhLyC7L9zkDCulKHCnXHY7buAwUj0HcLFICLs8Ef9 WR9A== X-Gm-Message-State: AOAM530nzppfPkeRS5tJCCpqUUYBz2WY/VQUVSKeZTcG93m6AIY0U097 mqFtmUniF88pDKWQkDAMHLE= X-Google-Smtp-Source: ABdhPJzKDt4XU/BmWeiLV6W594VhbfU7W8uhu8wo1ZRThIlXSSv8E9xcMBsJko0RoOFHj/dT79mvAQ== X-Received: by 2002:a05:651c:c8:: with SMTP id 8mr3521844ljr.182.1589483442684; Thu, 14 May 2020 12:10:42 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:42 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Cc: Allison Randal , Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Enrico Weigelt , Jani Nikula , Jonathan Corbet , Jyri Sarha , Kate Stewart , Kefeng Wang , Laurent Pinchart , Linus Walleij , linux-arm-msm@vger.kernel.org, linux-pwm@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Michael Hennerich , patches@opensource.cirrus.com, Russell King , Sam Ravnborg , Support Opensource , Thierry Reding , Thomas Gleixner , Thomas Zimmermann , Tomi Valkeinen , Uwe Kleine Konig , Zheng Bin Subject: [PATCH v1 13/18] backlight: document enums in backlight.h Date: Thu, 14 May 2020 21:09:56 +0200 Message-Id: <20200514191001.457441-14-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-1-sam@ravnborg.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add kernel-doc documentation for the backlight enums Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 84 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index b8e78549a48c..bedc0c9885b6 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -14,26 +14,110 @@ #include #include +/** + * enum backlight_update_reason - what method was used to update backlight + * + * A driver indicates the method (reason) used for updating the backlight + * when calling backlight_force_update(). + */ enum backlight_update_reason { + /** + * @BACKLIGHT_UPDATE_HOTKEY: + * + * The backlight was updated using a hot-key. + */ BACKLIGHT_UPDATE_HOTKEY, + + /** + * @BACKLIGHT_UPDATE_SYSFS: + * + * The backlight was updated using sysfs. + */ BACKLIGHT_UPDATE_SYSFS, }; +/** + * enum backlight_type - the type of backlight control + * + * The type of interface used to control the backlight. + */ enum backlight_type { + /** + * @BACKLIGHT_RAW: + * + * The backlight is controlled using hardware registers directly. + */ BACKLIGHT_RAW = 1, + + /** + * @BACKLIGHT_PLATFORM: + * + * The backlight is controller using a platform-specific interface. + */ BACKLIGHT_PLATFORM, + + /** + * @BACKLIGHT_FIRMWARE: + * + * The backlight is controlled using a standard firmware interface. + */ BACKLIGHT_FIRMWARE, + + /** + * @BACKLIGHT_TYPE_MAX: Number of entries. + */ BACKLIGHT_TYPE_MAX, }; +/** + * enum backlight_notification - the type of notification + * + * The notifications that is used for notification sent to the receiver + * that registered notifications using backlight_register_notifier(). + */ enum backlight_notification { + /** + * @BACKLIGHT_REGISTERED: + * + * The backlight device is registered. + */ BACKLIGHT_REGISTERED, + + /** + * @BACKLIGHT_UNREGISTERED: + * + * The backlight revice is unregistered. + */ BACKLIGHT_UNREGISTERED, }; +/** enum backlight_scale - the type of scale used for brightness values + * + * The type of scale used for brightness values. + */ enum backlight_scale { + /** + * @BACKLIGHT_SCALE_UNKNOWN: + * + * The scale is unknown. + */ BACKLIGHT_SCALE_UNKNOWN = 0, + + /** + * @BACKLIGHT_SCALE_LINEAR: + * + * The scale is linear, so the brigness increase is the same + * when increasing with the same steps (more or less). + */ BACKLIGHT_SCALE_LINEAR, + + /** + * @BACKLIGHT_SCALE_NON_LINEAR: + * + * The scale is not linear. This is often used when the brightness + * values tries to adjust to the relative perception of the eye + * demanding a non-linear scale. + */ BACKLIGHT_SCALE_NON_LINEAR, }; From patchwork Thu May 14 19:09:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189137 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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 9CD0CC433DF for ; Thu, 14 May 2020 19:10:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 797FE206F1 for ; Thu, 14 May 2020 19:10:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R7Nzrctq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729800AbgENTKt (ORCPT ); Thu, 14 May 2020 15:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728174AbgENTKs (ORCPT ); Thu, 14 May 2020 15:10:48 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 309F1C061A0C; Thu, 14 May 2020 12:10:48 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id z22so3635158lfd.0; Thu, 14 May 2020 12:10:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=k+fYBnpUxdD0+lpDaEI6w4m+CbJ5UGddgxFwRuGeORE=; b=R7NzrctqgtXQJS3grrlCPGzWGsCfe4ksm+P7pT2D3yz0IXyglmxFJjfYfjTpkVhphC yp0XR+p/ME4HsJIM7OK34eEY/Ry/Ig/Yij4eN5Y/keWxcEyfoJt3j54KL7BUUJc3Hjwi KxdjGN4yZFeuBwMNS0LV+9ZYsTt5Gie6RegfdgoZDk+tKGNyl0KMqmxM3G9/WfFCvzUQ HRxXA/UZHyoIMafTAlpilKiSSCJNIwGUrR53dItkAGwTHNNx3ujbIGicy/0Orppqz/sE ZkPDj9Cs5JE6aDPh/el55OykGqpwNCHjZDjTMX3Ga7/U+SV4I88WDDT66wY77pjFFlBy 4x2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=k+fYBnpUxdD0+lpDaEI6w4m+CbJ5UGddgxFwRuGeORE=; b=KJDCF/bacDTrDLvB5qFmunsCMgWZFKLSduRH4V316DN5ELR2IdRAx266xiaq18/let BrXPit8w/eh/984+qqsqIkFyYv75Mfmzg966SRldrjPdUdDIHxT183GrgS+n2ea7rc5T f0DedNnAO0Emi/UZXVRaueNkPUxDIa90tBv2WY3GUb+rjY9loGNG9nChPG+uMXHcMaaa 9TSqkneN3QXmRudkjCeAQFI50wFcrQv9U9g+I34b3FHM5OnkQLkRFq7MxLSg44+YWYAi Q0xJo16czBC+4KDMSHUVmyGb1CAXPPCSS1Kp6g1lYuwL723ByBfWuBNNHapP8esoik1G f9CA== X-Gm-Message-State: AOAM530bH2KdG8+mTGwRDupVJ6WhtsViQckZkUCbNNnIdok9htKI29gT lj3YNrGmlYbgJmGzeCEpBoI= X-Google-Smtp-Source: ABdhPJwH8dTDYPDQIUpGDGvj6FZ3qIeYzBsHCr3lDzcRaF/M7CXtfPsF3/BedGYjm3vTx1CBz7gtLw== X-Received: by 2002:ac2:596e:: with SMTP id h14mr4244342lfp.215.1589483446686; Thu, 14 May 2020 12:10:46 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:45 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Cc: Allison Randal , Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Enrico Weigelt , Jani Nikula , Jonathan Corbet , Jyri Sarha , Kate Stewart , Kefeng Wang , Laurent Pinchart , Linus Walleij , linux-arm-msm@vger.kernel.org, linux-pwm@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Michael Hennerich , patches@opensource.cirrus.com, Russell King , Sam Ravnborg , Support Opensource , Thierry Reding , Thomas Gleixner , Thomas Zimmermann , Tomi Valkeinen , Uwe Kleine Konig , Zheng Bin Subject: [PATCH v1 15/18] backlight: drop extern from prototypes Date: Thu, 14 May 2020 21:09:58 +0200 Message-Id: <20200514191001.457441-16-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-1-sam@ravnborg.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org No need to put "extern" in front of prototypes. While touching the prototypes adjust indent to follow the kernel style. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 35fdc277bdc5..99fc1c950578 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -432,22 +432,25 @@ static inline bool backlight_is_blank(struct backlight_device *bd) 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); -extern struct backlight_device *devm_backlight_device_register( - struct device *dev, const char *name, struct device *parent, - void *devdata, const struct backlight_ops *ops, - const struct backlight_properties *props); -extern void backlight_device_unregister(struct backlight_device *bd); -extern void devm_backlight_device_unregister(struct device *dev, - struct backlight_device *bd); -extern void backlight_force_update(struct backlight_device *bd, - enum backlight_update_reason reason); -extern int backlight_register_notifier(struct notifier_block *nb); -extern int backlight_unregister_notifier(struct notifier_block *nb); -extern struct backlight_device *backlight_device_get_by_type(enum backlight_type type); -extern int backlight_device_set_brightness(struct backlight_device *bd, unsigned long brightness); +struct backlight_device * +backlight_device_register(const char *name, struct device *dev, void *devdata, + const struct backlight_ops *ops, + const struct backlight_properties *props); +struct backlight_device * +devm_backlight_device_register(struct device *dev, const char *name, + struct device *parent, void *devdata, + const struct backlight_ops *ops, + const struct backlight_properties *props); +void backlight_device_unregister(struct backlight_device *bd); +void devm_backlight_device_unregister(struct device *dev, + struct backlight_device *bd); +void backlight_force_update(struct backlight_device *bd, + enum backlight_update_reason reason); +int backlight_register_notifier(struct notifier_block *nb); +int backlight_unregister_notifier(struct notifier_block *nb); +struct backlight_device *backlight_device_get_by_type(enum backlight_type type); +int backlight_device_set_brightness(struct backlight_device *bd, + unsigned long brightness); #define to_backlight_device(obj) container_of(obj, struct backlight_device, dev) From patchwork Thu May 14 19:10:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189136 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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 8C537C433DF for ; Thu, 14 May 2020 19:10:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5AF63206F1 for ; Thu, 14 May 2020 19:10:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qB5TrxOz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728928AbgENTK5 (ORCPT ); Thu, 14 May 2020 15:10:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1730308AbgENTKy (ORCPT ); Thu, 14 May 2020 15:10:54 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E01EC061A0C; Thu, 14 May 2020 12:10:54 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id d21so4742718ljg.9; Thu, 14 May 2020 12:10:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0TjjfHtIftg6y1deaf9Au+YmodMuSD9MQOJ+iJ1XC7I=; b=qB5TrxOzjLBBhlSoGt8TqwqgBxxHnB0NHvQ5aJh23W7xd7hF8BHRW1acVqQuik1z8G WCT7g1li4wyVYG5WrY0Gemk+2wP79/KYP9bmc5dLvzzKxVs1Ke4S3CghcZzH5wJkcGVL WNsxhcM1y//UKZWYIujGlYMZtUmGZODaYaLqgoI5xT53TP9oo+uDOLZZw2+9lzJ24bKN aEoxZ7aeHyJdqoSMBituxppxjqTodvptmgzozN94QgdBlRT/+s2+xGG050MB14g18D3v TaF2DptPjPQpk7APo75MKikXLg4XHptLwAFmgkEohJD5YUJnd3qpy+Ud93+GLXu8GPX5 WEGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=0TjjfHtIftg6y1deaf9Au+YmodMuSD9MQOJ+iJ1XC7I=; b=f6l5i0+WjRj+W3rqQRt8weljgpMBDngzJrbkBZtHR/DO/3Qw8BJIHlOpYaJx5/zV4W 8MaYRRKI63gNCcBCzvxlzvGMa46vP5Q8/aU46v87C9fDRbhSAZZvjOopPlp2tf+Iekwh OozvuVNcZJYm2cRlwo0eFEhoyEuU3vfhqPDRXjb7njbe82njRZe0JAHcZ/gexOr/Ju/0 SW7cNSb45jfOW5fAO74Z0gr/Qj/v6iDVcVg9A1Ee1DJ5wGJ/q/7V3zQ87zg9xs9Wwaw/ +oxUsTTQ+Nl161s8xypOieoewyyyY3dBrMiEfQWDWQqiDp0WUEfb+Gk4kRBPU4F+0DvK uWeg== X-Gm-Message-State: AOAM530HdIVKil6mv6V1d+q2aay1Bo8qV4wDe5/vO8FY2pT6RhorYtpw gzeD8qBNyubIUfs9BZIFJok= X-Google-Smtp-Source: ABdhPJxpxx/dPjZR2NjE1DnmTmJigaruwKU6OtMCe86mU8Qk4zIy8kOoYxSwtVLnPSHdFZ1PkniTQw== X-Received: by 2002:a05:651c:1027:: with SMTP id w7mr3670125ljm.205.1589483452641; Thu, 14 May 2020 12:10:52 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:8d23:71d:e677:1c7c]) by smtp.gmail.com with ESMTPSA id q30sm2362958lfd.32.2020.05.14.12.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 12:10:52 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Cc: Allison Randal , Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Enrico Weigelt , Jani Nikula , Jonathan Corbet , Jyri Sarha , Kate Stewart , Kefeng Wang , Laurent Pinchart , Linus Walleij , linux-arm-msm@vger.kernel.org, linux-pwm@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Michael Hennerich , patches@opensource.cirrus.com, Russell King , Sam Ravnborg , Support Opensource , Thierry Reding , Thomas Gleixner , Thomas Zimmermann , Tomi Valkeinen , Uwe Kleine Konig , Zheng Bin Subject: [PATCH v1 18/18] backlight: use backlight_is_blank() in all backlight drivers Date: Thu, 14 May 2020 21:10:01 +0200 Message-Id: <20200514191001.457441-19-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200514191001.457441-1-sam@ravnborg.org> References: <20200514191001.457441-1-sam@ravnborg.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Replaces the open-coded checks if the state etc., with the backlight_is_blank() helper. This increases readability of the code and aling the functionality. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Cc: Michael Hennerich Cc: Support Opensource Cc: Thierry Reding Cc: "Uwe Kleine-König" Cc: Andy Gross Cc: Bjorn Andersson Cc: linux-pwm@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org Cc: patches@opensource.cirrus.com --- drivers/video/backlight/88pm860x_bl.c | 8 +------- drivers/video/backlight/adp5520_bl.c | 5 +---- drivers/video/backlight/adp8860_bl.c | 5 +---- drivers/video/backlight/adp8870_bl.c | 5 +---- drivers/video/backlight/as3711_bl.c | 8 +++----- drivers/video/backlight/bd6107.c | 4 +--- drivers/video/backlight/corgi_lcd.c | 5 +---- drivers/video/backlight/cr_bllcd.c | 22 +++++++--------------- drivers/video/backlight/da903x_bl.c | 8 +------- drivers/video/backlight/ep93xx_bl.c | 3 +-- drivers/video/backlight/gpio_backlight.c | 4 +--- drivers/video/backlight/hp680_bl.c | 4 +--- drivers/video/backlight/jornada720_bl.c | 2 +- drivers/video/backlight/kb3886_bl.c | 4 +--- drivers/video/backlight/led_bl.c | 4 +--- drivers/video/backlight/lm3533_bl.c | 4 +--- drivers/video/backlight/locomolcd.c | 4 +--- drivers/video/backlight/lv5207lp.c | 4 +--- drivers/video/backlight/max8925_bl.c | 8 +------- drivers/video/backlight/pwm_bl.c | 4 +--- drivers/video/backlight/qcom-wled.c | 4 +--- drivers/video/backlight/tps65217_bl.c | 4 +--- drivers/video/backlight/wm831x_bl.c | 8 +------- 23 files changed, 31 insertions(+), 100 deletions(-) diff --git a/drivers/video/backlight/88pm860x_bl.c b/drivers/video/backlight/88pm860x_bl.c index 20d96a5ac384..162c83ab0f5a 100644 --- a/drivers/video/backlight/88pm860x_bl.c +++ b/drivers/video/backlight/88pm860x_bl.c @@ -123,13 +123,7 @@ static int pm860x_backlight_update_status(struct backlight_device *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; - - if (bl->props.state & BL_CORE_SUSPENDED) + if (backlight_is_blank(bl)) brightness = 0; return pm860x_backlight_set(bl, brightness); diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index 0f63f76723a5..d817b0d95c9d 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c @@ -67,10 +67,7 @@ static int adp5520_bl_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bl)) brightness = 0; return adp5520_bl_set(bl, brightness); diff --git a/drivers/video/backlight/adp8860_bl.c b/drivers/video/backlight/adp8860_bl.c index 19968104fc47..a0ce2a3701fa 100644 --- a/drivers/video/backlight/adp8860_bl.c +++ b/drivers/video/backlight/adp8860_bl.c @@ -363,10 +363,7 @@ static int adp8860_bl_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bl)) brightness = 0; return adp8860_bl_set(bl, brightness); diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c index 4c0032010cfe..ae4269fdb189 100644 --- a/drivers/video/backlight/adp8870_bl.c +++ b/drivers/video/backlight/adp8870_bl.c @@ -401,10 +401,7 @@ static int adp8870_bl_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK) - brightness = 0; - - if (bl->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bl)) brightness = 0; return adp8870_bl_set(bl, brightness); diff --git a/drivers/video/backlight/as3711_bl.c b/drivers/video/backlight/as3711_bl.c index 33f0f0f2e8b3..7fa76008c7bf 100644 --- a/drivers/video/backlight/as3711_bl.c +++ b/drivers/video/backlight/as3711_bl.c @@ -107,13 +107,11 @@ static int as3711_bl_update_status(struct backlight_device *bl) int brightness = bl->props.brightness; int ret = 0; - dev_dbg(&bl->dev, "%s(): brightness %u, pwr %x, blank %x, state %x\n", + dev_dbg(&bl->dev, "%s(): brightness %u, pwr %x, state %x\n", __func__, bl->props.brightness, bl->props.power, - bl->props.fb_blank, bl->props.state); + bl->props.state); - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) + if (backlight_is_blank(bl)) brightness = 0; if (data->type == AS3711_BL_SU1) { diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c index d5d5fb457e78..f6a5c1dba3bc 100644 --- a/drivers/video/backlight/bd6107.c +++ b/drivers/video/backlight/bd6107.c @@ -84,9 +84,7 @@ static int bd6107_backlight_update_status(struct backlight_device *backlight) struct bd6107 *bd = bl_get_data(backlight); int brightness = backlight->props.brightness; - if (backlight->props.power != FB_BLANK_UNBLANK || - backlight->props.fb_blank != FB_BLANK_UNBLANK || - backlight->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) + if (backlight_is_blank(backlight)) brightness = 0; if (brightness) { diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c index 25ef0cbd7583..c9adf4e26355 100644 --- a/drivers/video/backlight/corgi_lcd.c +++ b/drivers/video/backlight/corgi_lcd.c @@ -422,10 +422,7 @@ static int corgi_bl_update_status(struct backlight_device *bd) struct corgi_lcd *lcd = bl_get_data(bd); int intensity = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) intensity = 0; if (corgibl_flags & CORGIBL_SUSPENDED) diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c index 4624b7b7c6a6..d5ab7675f55c 100644 --- a/drivers/video/backlight/cr_bllcd.c +++ b/drivers/video/backlight/cr_bllcd.c @@ -59,26 +59,18 @@ struct cr_panel { static int cr_backlight_set_intensity(struct backlight_device *bd) { - int intensity = bd->props.brightness; u32 addr = gpio_bar + CRVML_PANEL_PORT; u32 cur = inl(addr); - if (bd->props.power == FB_BLANK_UNBLANK) - intensity = FB_BLANK_UNBLANK; - if (bd->props.fb_blank == FB_BLANK_UNBLANK) - intensity = FB_BLANK_UNBLANK; - if (bd->props.power == FB_BLANK_POWERDOWN) - intensity = FB_BLANK_POWERDOWN; - if (bd->props.fb_blank == FB_BLANK_POWERDOWN) - intensity = FB_BLANK_POWERDOWN; - - if (intensity == FB_BLANK_UNBLANK) { /* FULL ON */ - cur &= ~CRVML_BACKLIGHT_OFF; - outl(cur, addr); - } else if (intensity == FB_BLANK_POWERDOWN) { /* OFF */ + if (backlight_is_blank(bd)) { + /* OFF */ cur |= CRVML_BACKLIGHT_OFF; outl(cur, addr); - } /* anything else, don't bother */ + } else { + /* FULL ON */ + cur &= ~CRVML_BACKLIGHT_OFF; + outl(cur, addr); + } return 0; } diff --git a/drivers/video/backlight/da903x_bl.c b/drivers/video/backlight/da903x_bl.c index 62540e4bdedb..ca351badfdcf 100644 --- a/drivers/video/backlight/da903x_bl.c +++ b/drivers/video/backlight/da903x_bl.c @@ -79,13 +79,7 @@ static int da903x_backlight_update_status(struct backlight_device *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; - - if (bl->props.state & BL_CORE_SUSPENDED) + if (backlight_is_blank(bl)) brightness = 0; return da903x_backlight_set(bl, brightness); diff --git a/drivers/video/backlight/ep93xx_bl.c b/drivers/video/backlight/ep93xx_bl.c index 4149e0b2f83c..491185df1411 100644 --- a/drivers/video/backlight/ep93xx_bl.c +++ b/drivers/video/backlight/ep93xx_bl.c @@ -38,8 +38,7 @@ static int ep93xxbl_update_status(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bl)) brightness = 0; return ep93xxbl_set(bl, brightness); diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 75409ddfba3e..94b65e4d2aa0 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -25,9 +25,7 @@ static int gpio_backlight_get_next_brightness(struct backlight_device *bl) { int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) + if (backlight_is_blank(bl)) brightness = 0; return brightness; diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c index 8ea42b8d9bc8..01d805ca8415 100644 --- a/drivers/video/backlight/hp680_bl.c +++ b/drivers/video/backlight/hp680_bl.c @@ -35,9 +35,7 @@ static void hp680bl_send_intensity(struct backlight_device *bd) u16 v; int intensity = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) intensity = 0; if (hp680bl_suspended) intensity = 0; diff --git a/drivers/video/backlight/jornada720_bl.c b/drivers/video/backlight/jornada720_bl.c index f0385f9cf9da..996f7ba3b373 100644 --- a/drivers/video/backlight/jornada720_bl.c +++ b/drivers/video/backlight/jornada720_bl.c @@ -54,7 +54,7 @@ static int jornada_bl_update_status(struct backlight_device *bd) jornada_ssp_start(); /* If backlight is off then really turn it off */ - if ((bd->props.power != FB_BLANK_UNBLANK) || (bd->props.fb_blank != FB_BLANK_UNBLANK)) { + if (backlight_is_blank(bd)) { ret = jornada_ssp_byte(BRIGHTNESSOFF); if (ret != TXDUMMY) { dev_info(&bd->dev, "brightness off timeout\n"); diff --git a/drivers/video/backlight/kb3886_bl.c b/drivers/video/backlight/kb3886_bl.c index 1dfe13c18925..a0fd5d3d82f5 100644 --- a/drivers/video/backlight/kb3886_bl.c +++ b/drivers/video/backlight/kb3886_bl.c @@ -89,9 +89,7 @@ static int kb3886bl_send_intensity(struct backlight_device *bd) { int intensity = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) intensity = 0; if (kb3886bl_flags & KB3886BL_SUSPENDED) intensity = 0; diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c index 3f66549997c8..c655ddd99cfb 100644 --- a/drivers/video/backlight/led_bl.c +++ b/drivers/video/backlight/led_bl.c @@ -56,9 +56,7 @@ static int led_bl_update_status(struct backlight_device *bl) struct led_bl_data *priv = bl_get_data(bl); int brightness = bl->props.brightness; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & BL_CORE_FBBLANK) + if (backlight_is_blank(bl)) brightness = 0; if (brightness > 0) diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c index ee09d1bd02b9..476146b62c4e 100644 --- a/drivers/video/backlight/lm3533_bl.c +++ b/drivers/video/backlight/lm3533_bl.c @@ -41,9 +41,7 @@ static int lm3533_bl_update_status(struct backlight_device *bd) struct lm3533_bl *bl = bl_get_data(bd); int brightness = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - brightness = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) brightness = 0; return lm3533_ctrlbank_set_brightness(&bl->cb, (u8)brightness); diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index cdc02e04f89d..8064cad8d683 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c @@ -113,9 +113,7 @@ static int locomolcd_set_intensity(struct backlight_device *bd) { int intensity = bd->props.brightness; - if (bd->props.power != FB_BLANK_UNBLANK) - intensity = 0; - if (bd->props.fb_blank != FB_BLANK_UNBLANK) + if (backlight_is_blank(bd)) intensity = 0; if (locomolcd_flags & LOCOMOLCD_SUSPENDED) intensity = 0; diff --git a/drivers/video/backlight/lv5207lp.c b/drivers/video/backlight/lv5207lp.c index c6ad73a784e2..ef8aa9803577 100644 --- a/drivers/video/backlight/lv5207lp.c +++ b/drivers/video/backlight/lv5207lp.c @@ -48,9 +48,7 @@ static int lv5207lp_backlight_update_status(struct backlight_device *backlight) struct lv5207lp *lv = bl_get_data(backlight); int brightness = backlight->props.brightness; - if (backlight->props.power != FB_BLANK_UNBLANK || - backlight->props.fb_blank != FB_BLANK_UNBLANK || - backlight->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) + if (backlight_is_blank(backlight)) brightness = 0; if (brightness) { diff --git a/drivers/video/backlight/max8925_bl.c b/drivers/video/backlight/max8925_bl.c index 97cc260ff9d1..b8af2c6407d3 100644 --- a/drivers/video/backlight/max8925_bl.c +++ b/drivers/video/backlight/max8925_bl.c @@ -66,13 +66,7 @@ static int max8925_backlight_update_status(struct backlight_device *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; - - if (bl->props.state & BL_CORE_SUSPENDED) + if (backlight_is_blank(bl)) brightness = 0; return max8925_backlight_set(bl, brightness); diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 82b8d7594701..7d0ffcd37f07 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -111,9 +111,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl) int brightness = bl->props.brightness; struct pwm_state state; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & BL_CORE_FBBLANK) + if (backlight_is_blank(bl)) brightness = 0; if (pb->notify) diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c index 3d276b30a78c..9600f5d58ece 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -261,9 +261,7 @@ static int wled_update_status(struct backlight_device *bl) u16 brightness = bl->props.brightness; int rc = 0; - if (bl->props.power != FB_BLANK_UNBLANK || - bl->props.fb_blank != FB_BLANK_UNBLANK || - bl->props.state & BL_CORE_FBBLANK) + if (backlight_is_blank(bl)) brightness = 0; mutex_lock(&wled->lock); diff --git a/drivers/video/backlight/tps65217_bl.c b/drivers/video/backlight/tps65217_bl.c index 762e3feed097..1041e5e62ee3 100644 --- a/drivers/video/backlight/tps65217_bl.c +++ b/drivers/video/backlight/tps65217_bl.c @@ -82,9 +82,7 @@ static int tps65217_bl_update_status(struct backlight_device *bl) if (bl->props.state & BL_CORE_SUSPENDED) brightness = 0; - if ((bl->props.power != FB_BLANK_UNBLANK) || - (bl->props.fb_blank != FB_BLANK_UNBLANK)) - /* framebuffer in low power mode or blanking active */ + if (backlight_is_blank(bl)) brightness = 0; if (brightness > 0) { diff --git a/drivers/video/backlight/wm831x_bl.c b/drivers/video/backlight/wm831x_bl.c index e55977d54c15..dc2ab6c8b7f9 100644 --- a/drivers/video/backlight/wm831x_bl.c +++ b/drivers/video/backlight/wm831x_bl.c @@ -93,13 +93,7 @@ static int wm831x_backlight_update_status(struct backlight_device *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; - - if (bl->props.state & BL_CORE_SUSPENDED) + if (backlight_is_blank(bl)) brightness = 0; return wm831x_backlight_set(bl, brightness);