From patchwork Sun May 17 19:01:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189106 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 23D54C433E0 for ; Sun, 17 May 2020 19:01:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0372D20809 for ; Sun, 17 May 2020 19:01:55 +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="MBqCIzMB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726559AbgEQTBy (ORCPT ); Sun, 17 May 2020 15:01:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbgEQTBy (ORCPT ); Sun, 17 May 2020 15:01:54 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5E6CC061A0C; Sun, 17 May 2020 12:01:53 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id 202so6098569lfe.5; Sun, 17 May 2020 12:01:53 -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=zjJ5TugtFafrUz9tMvPPgVQeP2vZZBra/hz3unCyA74=; b=MBqCIzMBzSoOolD7CgrY2zj0/KHIoG36rEIfx7ECTna0EC3p5iLR4b/hOYxmvMtbrF r3fgL0Dh3VOuQpLUF+rJRTN6sHztUxB/HIlATnfHC/lrsakMSQAI+Hjb6567eMQbnaFy SQWkFUg/MZ0CoirDiSQw8YfLT82cn4bNLYwLNVSJHLAlvMdRCDWHCWw/pMbbljMYXQLr oDe+T7l9Y7hAi43iNeWCi8BIY5i1vgm/Ky7y6n8g3uf18f6U0XizJMLnpMXcl0ACK1k9 dU7G3vbOsfyCmjFk5qfgkpisuxuEvwI8+Aa2PddgaTsYAQM9xX6pLNIRqH0FSOIERZqM BTlw== 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=zjJ5TugtFafrUz9tMvPPgVQeP2vZZBra/hz3unCyA74=; b=kcchXUW46pNWIu3pGNfFYLe1t/crxM4KTytropAeTE6cEHdtFf6ba+FryXQOE4L3re CX2DwJKDRDg785fboVHx1Sztl7vdg7aRuViHHXWI0oG82Gx7pX8l7oUfPFGX+c7XPiHt sIJH6YAtK4l0+BAIbmH6DRZzwdaLYD74AxMo3wJbPqPW+geQh6hVvvqq1on8n3BpSwWr nOLpNz3yraERsCTeUOoAIRC85GWXL168UV5ZREIq/ypH03qAUgviigrTDzdjwI171eRd /VE4Har1cFbtXGJd8QazJiodlPJEldnPxteZCcg7zfDIMmxrjMhN6ugHY4TePQ0OAGHo vsIw== X-Gm-Message-State: AOAM531b1m2VCl1dA9VTb2uSlrwKOttJWlecFmGKp1G6xNNYpiHY5P42 VEfb8b/f1x1tkWL3lph6Tos= X-Google-Smtp-Source: ABdhPJyNQwf2WU45rn3WQtz7QrQncxMhX+3U6IFhIvsSFjKrU8q+k0a/Ycqya6mgzGXcxDkRhBNa9A== X-Received: by 2002:ac2:44bb:: with SMTP id c27mr9295868lfm.40.1589742112363; Sun, 17 May 2020 12:01:52 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:5d55:b3eb:397b:9086]) by smtp.gmail.com with ESMTPSA id t20sm3282535lfl.17.2020.05.17.12.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 12:01:51 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson , Peter Ujfalusi , Tomi Valkeinen Cc: Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Jani Nikula , Jonathan Corbet , 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 Zimmermann , Uwe Kleine-Konig Subject: [PATCH v2 02/16] backlight: refactor fb_notifier_callback() Date: Sun, 17 May 2020 21:01:25 +0200 Message-Id: <20200517190139.740249-3-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200517190139.740249-1-sam@ravnborg.org> References: <20200517190139.740249-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 cac3e35d7630..17f04cff50ab 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 Sun May 17 19:01:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189105 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 81B8CC433DF for ; Sun, 17 May 2020 19:02:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5B97E207D3 for ; Sun, 17 May 2020 19:02:00 +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="CPPI6Nv0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726591AbgEQTCA (ORCPT ); Sun, 17 May 2020 15:02:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbgEQTB7 (ORCPT ); Sun, 17 May 2020 15:01:59 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5334DC061A0C; Sun, 17 May 2020 12:01:59 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id 82so6130485lfh.2; Sun, 17 May 2020 12:01:59 -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=XV8ji1IDXAzgoqiTjEkmwRFdCjcd4KoRPZRb8vwPSkM=; b=CPPI6Nv0NmK6Jgf2qWm7LYYc+OuCbj2lFpHs1PWenFVqPIVubsIY83GZvYfeDuppos UkKB3SeT6wmalj7wHr0oN6C1ufkJOkyXOcJqgi8JvXafMrk3IxyVYUBqxIQpxz8M1BRu m8uCTaCRadc6URt5l2kNGHcofVYu/BUShyR2qfoPk/5F4JHzLNg2Hy9fS7252RoAuqYv mAvgo0uEuHFzYcTcs6oom0VuAihNXBJ7jfkOIP555X56lPxO72xF3KeO2fxuRVY6QiHH qzbbyIMyEa1FaULMciY+6rD5k6LCqb1L9z4LhPk6eQmA3GTSvgWlPfUZ1OSAt8aimkDl P/FQ== 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=XV8ji1IDXAzgoqiTjEkmwRFdCjcd4KoRPZRb8vwPSkM=; b=G0ATi/zZ6HNqZrutTC6XnVfieidB5ybFvrExc5ZkBwGtSqybiA9JbddyVhSRR38Cw6 TNv5ulRvEZKCrsbIN4j10cbdHTTZMR40sdona5XlS471IgIM0iypVIhCqLhCqX45U8H6 PEki9q8G45KmtsKaJwyeani3T9EGFzV0MfMDJunoCyCf/9yyztYVXl/3Hb8lmwYSKIAU K3L0kqBrqzutC6OyrQEsbd8Yr5t0vMCgEFjGIiQRIuZkewWvrmxzaFt1RV5sPacalV/e dE5BuD4Zd5L3n7kkit68ggloe9gZiUpW6E77QfTeQOIjOpcaQQPMikcK4X132S2Z8ny7 JTOg== X-Gm-Message-State: AOAM531MN+zZwIQ+v1tSpKOa5yY5IjYa/8jXh9JFbX987h96xYfA6NOz GLdIYqIxkveS5OxDHOGxHgQ= X-Google-Smtp-Source: ABdhPJxELt7Vi9287IQwgCidWZHrUTSvjwrWfyZWE3Fzz5jgr5WONsYAndwhLNaQsrNw5sDoIgf/1g== X-Received: by 2002:a05:6512:3384:: with SMTP id h4mr9221349lfg.150.1589742117777; Sun, 17 May 2020 12:01:57 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:5d55:b3eb:397b:9086]) by smtp.gmail.com with ESMTPSA id t20sm3282535lfl.17.2020.05.17.12.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 12:01:57 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson , Peter Ujfalusi , Tomi Valkeinen Cc: Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Jani Nikula , Jonathan Corbet , 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 Zimmermann , Uwe Kleine-Konig Subject: [PATCH v2 04/16] backlight: improve backlight_ops documentation Date: Sun, 17 May 2020 21:01:27 +0200 Message-Id: <20200517190139.740249-5-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200517190139.740249-1-sam@ravnborg.org> References: <20200517190139.740249-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 Reviewed-by: Daniel Thompson --- 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 a0a083b35c47..519dc61ce7e4 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 Sun May 17 19:01:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189104 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 F273FC433E1 for ; Sun, 17 May 2020 19:02:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D5B3D207D3 for ; Sun, 17 May 2020 19:02:06 +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="BeOEi5gG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726610AbgEQTCG (ORCPT ); Sun, 17 May 2020 15:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbgEQTCG (ORCPT ); Sun, 17 May 2020 15:02:06 -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 AE74FC061A0C; Sun, 17 May 2020 12:02:04 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id e25so7531567ljg.5; Sun, 17 May 2020 12:02:04 -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=YRf5WUBfqQs/V8w51zkp9QQ7Mmu72mV/gJplPplr/Sc=; b=BeOEi5gGXeqqP0dDmjdY/mDJKm9g0mPHZC+M9GxAoPMbaL7Yq56NK1aocMUBf7b2rL 1upO9us9O8BOMbRKMGxzyXLQTLgpAiuplXHz7fhnpimpttBs5DJPdCJGj5d5ByWkqKib Vtufpl54zTg7Hr9bkBYlDU7xVwJ7vsKhlBeh5mCeurlKhWEAH8DH5Rx7giO3xmB3Pauf w9olTIj72VTIOvhQBChvTprkHURaqzCMORQUHSk3VHKuefvhCt1nD4ZPfVNmhqHjONPE bqaYkH3eRdVdMObRLuAWAHhstNIFWuMlQp17A62KrzNV611vf6grAnGhvYgKj8MSGbzZ M2OQ== 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=YRf5WUBfqQs/V8w51zkp9QQ7Mmu72mV/gJplPplr/Sc=; b=nFIfYdPbz9JPUDV9mtND4FDRAlpo8McXXAAilDTA/bR8jHXq48ze+bCcS92mN5VmFo xjjSEZ+9jW55D1RAzRFPzjwJ9kyBIPEZeutCJp/Krrj492i2GSDIpenD9KcwVkxhQQIo TnRH7movIDcno0gAOUaYUabrd24q8dV8tGCsbGpoLojhPq1CxnH3XDJQc4x9JNC58OrD Im66A0AQkZhuvrR/kH+Bjv1B4N5Y/txnAApKLhOusCZ7EBnJzcaFauKbZpDG7NDnDhSK jsnYAc4v5VP6AcywBVnAWmSu2fmyxZiJfcTTY3BACC4UNNHGZbKlLBlxhUWUTLmsHHZs bZQA== X-Gm-Message-State: AOAM5326q1zpwsSI4UyLtOZmGT7Fkfa/ULy3aXJt2ao0fSa2jWOZuS6W kJ3xYrp6IhsEhlAbjQi6QHM= X-Google-Smtp-Source: ABdhPJx6pGHL6HHZkTI0jH6tl6NalUG9TNmcHIJNTUkjdiFjEiQZTVGygZjvLWcOL9MU24LoRlwZnQ== X-Received: by 2002:a2e:8549:: with SMTP id u9mr7758313ljj.24.1589742123210; Sun, 17 May 2020 12:02:03 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:5d55:b3eb:397b:9086]) by smtp.gmail.com with ESMTPSA id t20sm3282535lfl.17.2020.05.17.12.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 12:02:02 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson , Peter Ujfalusi , Tomi Valkeinen Cc: Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Jani Nikula , Jonathan Corbet , 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 Zimmermann , Uwe Kleine-Konig Subject: [PATCH v2 06/16] backlight: improve backlight_device documentation Date: Sun, 17 May 2020 21:01:29 +0200 Message-Id: <20200517190139.740249-7-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200517190139.740249-1-sam@ravnborg.org> References: <20200517190139.740249-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_device 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 | 81 ++++++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 23 deletions(-) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 7f9cef299d6e..e2d72936bf05 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -14,21 +14,6 @@ #include #include -/* Notes on locking: - * - * backlight_device->ops_lock is an internal backlight lock protecting the - * ops pointer and no code outside the core should need to touch it. - * - * Access to update_status() is serialised by the update_lock mutex since - * most drivers seem to need this and historically get it wrong. - * - * Most drivers don't need locking on their get_brightness() method. - * If yours does, you need to implement it in the driver. You can use the - * update_lock mutex if appropriate. - * - * Any other use of the locks below is probably wrong. - */ - enum backlight_update_reason { BACKLIGHT_UPDATE_HOTKEY, BACKLIGHT_UPDATE_SYSFS, @@ -221,30 +206,80 @@ struct backlight_properties { enum backlight_scale scale; }; +/** + * struct backlight_device - backlight device data + * + * This structure holds all data required by a backlight device. + */ struct backlight_device { - /* Backlight properties */ + /** + * @props: + * + * Backlight properties + */ struct backlight_properties props; - /* Serialise access to update_status method */ + /** + * @update_lock: + * + * update_lock is an internal backlight lock that serialise access + * to the update_status() method. The iupdate_lock mutex shall not be used + * by backlight drivers. + */ struct mutex update_lock; - /* This protects the 'ops' field. If 'ops' is NULL, the driver that - registered this device has been unloaded, and if class_get_devdata() - points to something in the body of that driver, it is also invalid. */ + /** + * @ops_lock: + * + * ops_lock is an internal backlight lock that protects the ops pointer + * and is used around all accesses to ops and when the operations are + * invoked. The mutex shall not be used by backlight drivers. + */ struct mutex ops_lock; + + /** + * @ops: + * + * Pointer to the backlight operations. If ops is NULL, the driver that + * registered this device has been unloaded, and if class_get_devdata() + * points to something in the body of that driver, it is also invalid. + */ const struct backlight_ops *ops; - /* The framebuffer notifier block */ + /** + * @fb_notif: + * + * The framebuffer notifier block + */ struct notifier_block fb_notif; - /* list entry of all registered backlight devices */ + /** + * @entry: + * + * List entry of all registered backlight devices + */ struct list_head entry; + /** + * @dev: + * + * Parent device. + */ struct device dev; - /* Multiple framebuffers may share one backlight device */ + /** + * @fb_bl_on: + * + * Multiple fbdev's may share one backlight device. The fb_bl_on + * records the state of the individual fbdev. + */ bool fb_bl_on[FB_MAX]; + /** + * @use_count: + * + * The number of uses of fb_bl_on. + */ int use_count; }; From patchwork Sun May 17 19:01:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189103 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 BF04FC433E0 for ; Sun, 17 May 2020 19:02:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9EFC7207D3 for ; Sun, 17 May 2020 19:02:11 +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="eoE0Phsi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726639AbgEQTCL (ORCPT ); Sun, 17 May 2020 15:02:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbgEQTCK (ORCPT ); Sun, 17 May 2020 15:02:10 -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 81065C061A0C; Sun, 17 May 2020 12:02:10 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id o14so7545731ljp.4; Sun, 17 May 2020 12:02:10 -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=lyTJITcxbDoToUmt6gTU2FHs3keUF4hOsb+KMKr7qJs=; b=eoE0PhsisEt28HtrVh4X5nCR+AoiL+Q5jLEietNjDvIwlyfUxLXxquwSalpfjJwZ6d vKQKIODKuFRZSzXB/NFYX/KoYgJBig42V06iPjcF08/ET9ZrNp1WlTn02taDvrIZ/RH7 THp9ytiS8zEgaZoUlJsAWkrQb+qQKXMrpGTU36T8GhWL75qeh1wv8/JPtwSrBF/P2YDL QcGWvNBNsmM+Tr7wG+aeEUtYvG9j84izjTIJQlCNaeVMRq6eZJP+iIu5Zw8lInLDZ2H3 IKbX7GLwh9SvtRSkh1nMVAv4Otu1xAbueGQ4ahWgfps7A7oa4TJh4sjohZyLX+wOP/+4 oh0g== 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=lyTJITcxbDoToUmt6gTU2FHs3keUF4hOsb+KMKr7qJs=; b=kqGpegDhqyd1+215e6EC5hDKaavjX6VM2bKEQFy0bNyz8vVP97kyTx1JYU07OqQBab iIH0sa60X8lnkn7D9i08sRBrs3jpLrWVyTk1EORc+auiZnBBWNSgrR8/RM6XVJyplTLJ lrL53GmkAh8/8NR6sEmchicLh8MCtHxxoJAeOslxqVwwMFvAXu23ZFPfQGemJp0GUg47 dTWoRZCCxHcKfKwvtQt699LoUEzNnntaKYnEHbZhd/gKxsYL/vfroJwE8CvW8Ktca+OJ r6RkKrvRHZkH9stKbJaleVU/zVU3PViI5LBEcUa27i/jBxYS4sflz/+ol8r4rj01VLdL ut1Q== X-Gm-Message-State: AOAM532ehtW70MvPRh7ynFxmqfzbqno1B5xq0s4wo2fKykM5GnHuzJjC bUzWOM6Ljup2ETNLt0nxc4w= X-Google-Smtp-Source: ABdhPJwbi9nqxI/Wfee0MxLKNIZNWnQzw01xW5En90ZvR4pUn1myrePBdXE5gGFsHcaY0A3tC6IW4A== X-Received: by 2002:a2e:9641:: with SMTP id z1mr8313148ljh.201.1589742128521; Sun, 17 May 2020 12:02:08 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:5d55:b3eb:397b:9086]) by smtp.gmail.com with ESMTPSA id t20sm3282535lfl.17.2020.05.17.12.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 12:02:07 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson , Peter Ujfalusi , Tomi Valkeinen Cc: Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Jani Nikula , Jonathan Corbet , 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 Zimmermann , Uwe Kleine-Konig Subject: [PATCH v2 08/16] backlight: document enums in backlight.h Date: Sun, 17 May 2020 21:01:31 +0200 Message-Id: <20200517190139.740249-9-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200517190139.740249-1-sam@ravnborg.org> References: <20200517190139.740249-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 98349a2984dc..b779c29142fd 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 Sun May 17 19:01:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189102 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 A924BC433E0 for ; Sun, 17 May 2020 19:02:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 87997207D3 for ; Sun, 17 May 2020 19:02:16 +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="AuqrU1ue" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726656AbgEQTCQ (ORCPT ); Sun, 17 May 2020 15:02:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbgEQTCP (ORCPT ); Sun, 17 May 2020 15:02:15 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7066BC061A0C; Sun, 17 May 2020 12:02:15 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id d22so6091999lfm.11; Sun, 17 May 2020 12:02:15 -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=ej6ukq+60uPTP3MIHc3/HurH6JGEh6Vx0QT7mCROCYs=; b=AuqrU1ueWhxi0LOT8AQ8EKPM60KewpmUdt239G59yuYr3Tx6mulNuq6eboBbLIIz1V 33ignFrjSIKgpjtvIfdiSg7Pqe681yC0iFvaO+O0YwzVaqnmO8/2GiM7pgdrjjnp2EUJ 3rEV8ffQWuEdJpTyabljDFq25LYs3SeqGVlJHxGA1hUsmdTd4xhlkiuEzE/BeBmAtY/I VuNNU4lbuGRBnkxfigH6eEYXBvx0FmZGIaAowjr4E+t8hqkIOr5S84xQDw+coA6OFbLD oUvgbC6hHP/4sk1vF0H8V3iSBJmrIOZkNST812+y5/yycH/XPSMyWernKwtn+iTLlJM4 hp8Q== 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=ej6ukq+60uPTP3MIHc3/HurH6JGEh6Vx0QT7mCROCYs=; b=hCrYbT2to8ZxuCtWW0ZsfbO0ma9tIQaZtXDux/TPldAEa/d243rW1G1RbqQF/5bJre ddF6t9MN2ABFLEotbLVG4isd2iD5dPoiCPV1RUAcl4jM30nhCAqP8Lf8YmkjLUiBeWlY pJrBy4iPzSIk4y5l1Fib8jkDSYf7oEh+cDw8iTZn0jS02uZZ92YDfKsO4rfSjADt4XOE AmmOksrmR8Udwij2IRNYJnHG5HFsT+6guntsD9WQoa8DgaCOjlOd1HbLI0scRIs6zY7u MJVq5VUMO5ntLc5psjLYN/SM4cvE91P2ilwvHurVu427lQtpU+LieZ7BX5laaNi7LzoO KNTA== X-Gm-Message-State: AOAM533MbY6ZTkRB5hBUBdrnkBsqeBFf9LG8DQ6HWu6TEYys8utrk1DK kIPN6U2JxkXZnpDW+0XAvWU= X-Google-Smtp-Source: ABdhPJwxy8XBEDB8HEDtsuefFUzmp0iN6Azy4WO6eudwOO5aKM2R0tejYGT4yHurWN45UzLvMsvYOg== X-Received: by 2002:ac2:59c3:: with SMTP id x3mr2623468lfn.117.1589742133936; Sun, 17 May 2020 12:02:13 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:5d55:b3eb:397b:9086]) by smtp.gmail.com with ESMTPSA id t20sm3282535lfl.17.2020.05.17.12.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 12:02:13 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson , Peter Ujfalusi , Tomi Valkeinen Cc: Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Jani Nikula , Jonathan Corbet , 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 Zimmermann , Uwe Kleine-Konig Subject: [PATCH v2 10/16] backlight: drop extern from prototypes Date: Sun, 17 May 2020 21:01:33 +0200 Message-Id: <20200517190139.740249-11-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200517190139.740249-1-sam@ravnborg.org> References: <20200517190139.740249-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 eae7a5e66248..308aec67fa4f 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -444,22 +444,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 Sun May 17 19:01:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189101 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 3039BC433E0 for ; Sun, 17 May 2020 19:02:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 06C41207D3 for ; Sun, 17 May 2020 19:02:22 +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="ok8MopO9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726668AbgEQTCV (ORCPT ); Sun, 17 May 2020 15:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbgEQTCV (ORCPT ); Sun, 17 May 2020 15:02:21 -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 07343C061A0C; Sun, 17 May 2020 12:02:21 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id e25so7532061ljg.5; Sun, 17 May 2020 12:02:20 -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=5HPqfvqRtncVQoHgcS/XINMTd0DOJVWJH0ZC6vuce8s=; b=ok8MopO9rneb9yJfTROGOYbIX9MXrlnlnkw3yNr3bMxjvniQAbQ0seWhsvYALaTF9E JwLA0Ls79pqiaHECZQCysVloRWrL0GA62wfWMLm05PrhHCVG3ufoFZZJoSPx1hy6N56/ an9Wk1loxD4qVgcH3slk0rC+tHgfI0UAHVEh6XmTnetf0MePNJ9gBebdQX6qyDpGpibL QJBg46D6jYZ1sKyBRm5k+7a437LqTb14R5OIKSjZnvrtVvHCMPI1l5o1SLm/l+t99/ut 99tI1XfoqK6P9iZJZtj1SwBmRAKEH1xq43VrfUnEs1wEFYGEJmk3koLIvQyRIYiDhckN OPaQ== 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=5HPqfvqRtncVQoHgcS/XINMTd0DOJVWJH0ZC6vuce8s=; b=l6J9eSpXVcpR6ideVZM+BThVX9+zircbtMTflr404C4EvuhEkDkp86pj5At+FhOpkg IbI57Fleye3a1A+dsat5gs1bfBXPfQ+JOLsTPg9102dc/eraob4tPuYC2v1oFWRYEb0/ 8umy63n/nNH/nJh8NgEeDT8zgOrPD1ZlAM7NqcLqChXb9tgLWo+aRoGfnoNCy8CgDoJd 2przH7lDZBC2oSHsc8wkFdmcXpjUp0Z90WsWKdNUGTSnnWXir9bq/p5swUmJLAohP6Dr om/Zx0zwxLLM27yzveXa2ctdOib/1+Ao46a1dbtytAPeNhXithhV+UuglQYQbyBvqDFU 1Z0A== X-Gm-Message-State: AOAM532aS9bKV2RQEM+Br5+hnbjlSO4jaCP6Xih4qtik/Q5izUpI+Vc+ VAVuYd471SFHq2O+EHrNNbk= X-Google-Smtp-Source: ABdhPJzQHolQWwc6+x1Ugs5U3BPnVbfqs6FVluzObxl5aohq58l6EEY9wyV6a1r02QHSw8SzQtSo6w== X-Received: by 2002:a2e:b177:: with SMTP id a23mr8196584ljm.140.1589742139509; Sun, 17 May 2020 12:02:19 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:5d55:b3eb:397b:9086]) by smtp.gmail.com with ESMTPSA id t20sm3282535lfl.17.2020.05.17.12.02.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 12:02:19 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson , Peter Ujfalusi , Tomi Valkeinen Cc: Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Jani Nikula , Jonathan Corbet , 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 Zimmermann , Uwe Kleine-Konig , Daniel Vetter Subject: [PATCH v2 12/16] backlight: wire up kernel-doc documentation Date: Sun, 17 May 2020 21:01:35 +0200 Message-Id: <20200517190139.740249-13-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200517190139.740249-1-sam@ravnborg.org> References: <20200517190139.740249-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 Include backlight so the documentation is now generated with make htmldocs and friends. Signed-off-by: Sam Ravnborg Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Cc: Jonathan Corbet Reviewed-by: Daniel Thompson --- Documentation/gpu/backlight.rst | 12 ++++++++++++ Documentation/gpu/index.rst | 1 + 2 files changed, 13 insertions(+) create mode 100644 Documentation/gpu/backlight.rst diff --git a/Documentation/gpu/backlight.rst b/Documentation/gpu/backlight.rst new file mode 100644 index 000000000000..9ebfc9d0aced --- /dev/null +++ b/Documentation/gpu/backlight.rst @@ -0,0 +1,12 @@ +================= +Backlight support +================= + +.. kernel-doc:: drivers/video/backlight/backlight.c + :doc: overview + +.. kernel-doc:: include/linux/backlight.h + :internal: + +.. kernel-doc:: drivers/video/backlight/backlight.c + :export: diff --git a/Documentation/gpu/index.rst b/Documentation/gpu/index.rst index 1fcf8e851e15..c9a51e3bfb5a 100644 --- a/Documentation/gpu/index.rst +++ b/Documentation/gpu/index.rst @@ -12,6 +12,7 @@ Linux GPU Driver Developer's Guide drm-uapi drm-client drivers + backlight vga-switcheroo vgaarbiter todo From patchwork Sun May 17 19:01:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189100 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 80A40C433E0 for ; Sun, 17 May 2020 19:02:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F433207D3 for ; Sun, 17 May 2020 19:02: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="C8VbvOdp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726674AbgEQTC1 (ORCPT ); Sun, 17 May 2020 15:02:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbgEQTC0 (ORCPT ); Sun, 17 May 2020 15:02:26 -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 512C9C061A0C; Sun, 17 May 2020 12:02:26 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id h188so6120668lfd.7; Sun, 17 May 2020 12:02:26 -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=v8t7YeGruxta805OuVbRHUY0bPcsh9G6lLY/6w/o8Gc=; b=C8VbvOdph2/j2pwoQ7DsiImXfPNKAT0eHHEvwLzuP+9MN1VKrkgEuil2zrpn2ugsTO 9DpnlwmDppjg+shy1eIsgV/K3OfqI490AVv9bRXedvAyLVRkjxBJQvemDOuno4ZKkrmP nRx3NJtXmuxFv6zNZcgjvUSCFuEf9pRGOrZNQwf2qkpPTWMFd7o9saUq7pkeD4ewzzSV ZW53n2BTfBGY0Fs4l1y1a4vKRGh+lYs3QhD4R5wlYjJpeSEQZSeMYKeykNIFUAIX/VNH LpPMFgvd4wF3DrKJopwG8dZotminQkZaZBJGLOInx3Ml/GBkUycLPPvJ9C0M+5faE4gY lnyw== 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=v8t7YeGruxta805OuVbRHUY0bPcsh9G6lLY/6w/o8Gc=; b=cvs8wwihKcK0nn7JQRGahw5dD6i/PyWgqmkHiaed6ZVcwh3O3TsetTew4IYXgGr4lc UheQJC9X/o3u6uITPYtqEEmMQY4BgwQ4aeHSdZkAwvQfSulpbmO0mjt84HomZ76LugHM jfE/oqzzG3S5NRpRvmyQa6zKp9R5LkZ+9fFsn9Ut/pUbr3/M2yERq6nHJRQEHYYGESPv B2po+Le12WxxJs2e9lcSbvW0jd6XtBlYzW+YPgEWa0mt/21PKg991oTAtX64BxPdG+uK /w5yhpu/3xtLmM8H41t5Cxlm5J0YUNk2INsaY3z64BLiIR8BZHDnGVPd4mAdR0EKQaB2 PfSA== X-Gm-Message-State: AOAM532kbMhwE409aBZzmgY9qNjB2sSth/sGeeqm9Lix8lqu+Sw5EJNR LkaIJ7ueSEGKTyEj/hBWONM= X-Google-Smtp-Source: ABdhPJyo7uKvJpS51OtRduL77hMqwfbmMZUhY+3vQN+6QeXWWoevpMa889Y4H9Ca9cw+C8DjnD+zqg== X-Received: by 2002:a19:ee19:: with SMTP id g25mr9231869lfb.124.1589742144801; Sun, 17 May 2020 12:02:24 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:5d55:b3eb:397b:9086]) by smtp.gmail.com with ESMTPSA id t20sm3282535lfl.17.2020.05.17.12.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 12:02:24 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson , Peter Ujfalusi , Tomi Valkeinen Cc: Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Jani Nikula , Jonathan Corbet , 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 Zimmermann , Uwe Kleine-Konig Subject: [PATCH v2 14/16] backlight: drop backlight_put() Date: Sun, 17 May 2020 21:01:37 +0200 Message-Id: <20200517190139.740249-15-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200517190139.740249-1-sam@ravnborg.org> References: <20200517190139.740249-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 backlight_put(). Drop it and open code the two users in backlight.c. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han Reviewed-by: Daniel Thompson --- drivers/video/backlight/backlight.c | 7 +++++-- include/linux/backlight.h | 10 ---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index e23b09d03a65..7f3eecaf8317 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -679,7 +679,10 @@ static struct backlight_device *of_find_backlight(struct device *dev) static void devm_backlight_release(void *data) { - backlight_put(data); + struct backlight_device *bd = data; + + if (bd) + put_device(&bd->dev); } /** @@ -707,7 +710,7 @@ struct backlight_device *devm_of_find_backlight(struct device *dev) return bd; ret = devm_add_action(dev, devm_backlight_release, bd); if (ret) { - backlight_put(bd); + put_device(&bd->dev); return ERR_PTR(ret); } return bd; diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 99e7cdace2be..d92e523650ec 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -415,16 +415,6 @@ static inline int backlight_disable(struct backlight_device *bd) return backlight_update_status(bd); } -/** - * backlight_put - Drop backlight reference - * @bd: the backlight device to put - */ -static inline void backlight_put(struct backlight_device *bd) -{ - if (bd) - put_device(&bd->dev); -} - /** * backlight_is_blank - Return true if display is expected to be blank * @bd: the backlight device From patchwork Sun May 17 19:01:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 189099 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 8BA7AC433E0 for ; Sun, 17 May 2020 19:02:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5EAC5207D3 for ; Sun, 17 May 2020 19:02:33 +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="ofXmvO4J" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726675AbgEQTCd (ORCPT ); Sun, 17 May 2020 15:02:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbgEQTCc (ORCPT ); Sun, 17 May 2020 15:02:32 -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 E526CC061A0C; Sun, 17 May 2020 12:02:31 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id w10so7545646ljo.0; Sun, 17 May 2020 12:02:31 -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=BPcFBowave1YtlHtcL5KUNJL5KtWy85PnU1gywCC4y8=; b=ofXmvO4JuEpsYlpI9LgjTFsPYacNF3MXwFZDuvP2q5TpzAEtpkJoH0STFOuNXL/qga 9qR/oIMb75oM8WPicxMv5GTjxjrvzGkiuCxGqMFs8hgFBqWKVHEuOkHryiybxmq4tfOT 08y9cy6OBcZYHsfaZQDa2RN7hCYi82lIJdJzzNhRq+5bGwzZuoN19lw8ZwLw5kU7C5J/ Lm5Mkqhh6n1pIEKMzLBZbs6qrKM6bCbQSlv0eIvq8dhheCTSyKlYyyXng6IyfWy2N6aM 0pbTo4QKiiH7KpF/06uNuGDbDGaZR/7xnYZd5Q+qB92FonfRNuEUzcwBStAwA5koCnqi EgTQ== 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=BPcFBowave1YtlHtcL5KUNJL5KtWy85PnU1gywCC4y8=; b=dULBGP6VCBrz2KWiHcqNMHbnpWWYQYer3aAmmyZPfCpKjLvspmtoiIbLiOYXIfhMsF 2Jv6VVe+Oc8goUPazZ8kvHbdurqYyqGX2L6TqGphuYITP2da4yhZ8NBvEakK1S70Qs3+ Obg18TkdOym5K1CziI1jOEMByYHYGXD9AdWqR449wSA2VQUfM/yQt6MxN4EaO9VLon/w Ar+c54EqDTqdNpwaBwtD0BnEmhJSUX/yKkC0cWZtLOYHnvaMk52mj3i6Kmv92r0wvk2V OfSkK82PUwZ5soAzQq2daXNWlSZv9twrbJdUzwaAEeiu2bURBV6Vg87TE4I8iSiy3M92 6sXw== X-Gm-Message-State: AOAM530DSS/eELXBTEa+c1OPB6usGsdX/k82San0ZHPEklf75oDos9Ew y/v4tLdIuMkFkDK9AuZMPsE= X-Google-Smtp-Source: ABdhPJwTy7dhhDJbQyXIQzosV3IUaCEjisf6c0BSj9P8grH1/FT4xVjrx75oDBJM25xxL7+5Od7hJw== X-Received: by 2002:a2e:96c2:: with SMTP id d2mr8418154ljj.214.1589742150306; Sun, 17 May 2020 12:02:30 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:5d55:b3eb:397b:9086]) by smtp.gmail.com with ESMTPSA id t20sm3282535lfl.17.2020.05.17.12.02.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 12:02:29 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson , Peter Ujfalusi , Tomi Valkeinen Cc: Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Douglas Anderson , Jani Nikula , Jonathan Corbet , 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 Zimmermann , Uwe Kleine-Konig Subject: [PATCH v2 16/16] backlight: use backlight_is_blank() in all backlight drivers Date: Sun, 17 May 2020 21:01:39 +0200 Message-Id: <20200517190139.740249-17-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200517190139.740249-1-sam@ravnborg.org> References: <20200517190139.740249-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 of the state etc., with the backlight_is_blank() helper. This increases readability of the code and align the functionality across the drivers. v2: - Fixed so changelog is readable 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 Reviewed-by: Daniel Thompson --- 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);