From patchwork Mon Jun 1 06:51:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 11581461 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC17E60D for ; Mon, 1 Jun 2020 06:52:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B01AA207BC for ; Mon, 1 Jun 2020 06:52:20 +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" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725935AbgFAGwU (ORCPT ); Mon, 1 Jun 2020 02:52:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725283AbgFAGwT (ORCPT ); Mon, 1 Jun 2020 02:52:19 -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 7E700C061A0E; Sun, 31 May 2020 23:52:19 -0700 (PDT) Received: by mail-lf1-x143.google.com with SMTP id u16so3295914lfl.8; 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=CT6bt9Qjmns2p9US7UU1lr4GRV7nvKsSql1taZeCP4mkcopa17OAuAidD0vCWzhQGR FKXWRpeQMWA7XjgKmCiMCYgEW2Ar700elb/NPS0tRLmYZbk/76uljjGxmrXaVQbnb9st sy2R2ENuwBBX4im+tPE0A3lWMbaS2BiSJFvFrSGjYQm7hAJw40ByfvhwNs1JUbcFeRLI Bd75Gk0rnuwdyNcIpt5svHOxo4BW9pfBoKQJSKys2BRHcrfRx39zXUHD8ihigmAvuzpS uYYyasikn9FFiMgkO7R2u4bhLMj2vS8nLav5SyM4qDgBuKomFNS4kTXWhT00hw5KwPxw pmXA== X-Gm-Message-State: AOAM530XoLxU8yZlpaOc/oTUQImZkXIT8GwlXwezajL5gwCdz6V19BtS ZLFBUReX6Z/O54b+dODeNb0= 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 Cc: Andy Gross , Bartlomiej Zolnierkiewicz , Bjorn Andersson , Daniel Vetter , David Airlie , Emil Velikov , Jonathan Corbet , linux-arm-msm@vger.kernel.org, linux-pwm@vger.kernel.org, Maarten Lankhorst , Maxime Ripard , Michael Hennerich , patches@opensource.cirrus.com, Support Opensource , Thierry Reding , Thomas Zimmermann , Uwe Kleine-Konig , Peter Ujfalusi , Tomi Valkeinen , Sam Ravnborg 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 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 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; }