From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-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=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 72FE3C433DF for ; Mon, 1 Jun 2020 06:52:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4831C207BC for ; Mon, 1 Jun 2020 06:52:25 +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="aAgWshPn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4831C207BC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF6AB6E060; Mon, 1 Jun 2020 06:52:20 +0000 (UTC) Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by gabe.freedesktop.org (Postfix) with ESMTPS id CCC2F6E07B for ; Mon, 1 Jun 2020 06:52:19 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id w15so3272940lfe.11 for ; Sun, 31 May 2020 23:52:19 -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=1eeMoKxAzqRLfG82D7/NnXCikugDW+fdpYxngSA6iFI=; b=aAgWshPneNtHmvHZbOwLSMACJLA/eyikM9LREx0iVbyS5NGKrOEOP2hPXuVAKYHQL7 mENPh0g/Z2u1Vu+ikgWrRmUu/xXwS00twheq0sTee++UxWHOyY7mfWxFxu3EZSIejxQ7 I6LzBW/OO9PrLK24/JMwaUQzDF4fgYdVU9brt1pEtGlq4yk7qocwJ65H2bBwwory75IK MLa0kPOebSLE+HCR8R1L3LQY0SPPbegvpSfVkC8oDwNpZplt7eIYKJSUSjpnh0dMZpOS 0YSA0sZRHRshNqmk2nPd+AbkN8RdTed1so3OzYp0em5688mOo4IRV0/BFLNRXP3TnKCm T9+A== 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=1eeMoKxAzqRLfG82D7/NnXCikugDW+fdpYxngSA6iFI=; b=XUYnK/jIEAlv79Wi1irdSSziQdsF+NUtWMTI6K3Hiv3L6oFROWzOYQSj7b/+s+kBef 7PWrHM715waFaI9gMmJihnitQIOwwk5AiXp/0tsWxJ+9r0F0WL9LgVYS70LrH8f7hA0q IJNFPyUD2AVVYIrP96M/8YILCm4Cv+hraz35sRoli3s5y+090+bl1AOrLIV5O55iDNOF 22iNNnMPcpw1l6k8IUfhZtVaZrFOSxzPA5H+hukbFSJdJkL5ce1bKLFzB0nJxBktIH6j DfQS8o6gW2YDvvQ6KMkyxG4SPtelHBSfAYxwOZj08BEQukMeplJMaYrLWfgPJVPhLyYY 12eQ== X-Gm-Message-State: AOAM532pKIekgdjbNBdFCd9hcG8DGvM/OR6T4nY6DlXaqp920GiTaEzn jwSuXghqv42rZX0Unxq25AC/bAHNm/Q= X-Google-Smtp-Source: ABdhPJyFSkTjFfWMMJZinRAJ4OlypddpujAqkuiCerdpn5kIaB5I3o/t8Iy1sv1JBlw6uJwWJTzuoA== X-Received: by 2002:ac2:4886:: with SMTP id x6mr10335237lfc.198.1590994338004; Sun, 31 May 2020 23:52:18 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:281d:a604:434c:a58d]) by smtp.gmail.com with ESMTPSA id e13sm2540462ljl.117.2020.05.31.23.52.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 23:52:17 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v3 01/13] backlight: refactor fb_notifier_callback() Date: Mon, 1 Jun 2020 08:51:55 +0200 Message-Id: <20200601065207.492614-2-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601065207.492614-1-sam@ravnborg.org> References: <20200601065207.492614-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Support Opensource , Michael Hennerich , Bartlomiej Zolnierkiewicz , David Airlie , Daniel Vetter , Tomi Valkeinen , Jonathan Corbet , Emil Velikov , Bjorn Andersson , Peter Ujfalusi , Andy Gross , Thierry Reding , Thomas Zimmermann , linux-arm-msm@vger.kernel.org, Uwe Kleine-Konig , Sam Ravnborg , patches@opensource.cirrus.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Increase readability of fb_notifier_callback() by removing a few indent levels. No functional change. Signed-off-by: Sam Ravnborg Reviewed-by: Daniel Thompson 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; } -- 2.25.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel