From patchwork Fri Jul 3 18:45: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: 11642623 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 A131560D for ; Fri, 3 Jul 2020 18:46:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 88890208C7 for ; Fri, 3 Jul 2020 18:46:07 +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="hWudvJIM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726425AbgGCSqH (ORCPT ); Fri, 3 Jul 2020 14:46:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726703AbgGCSqG (ORCPT ); Fri, 3 Jul 2020 14:46:06 -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 510B8C061794; Fri, 3 Jul 2020 11:46:06 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id k17so6251268lfg.3; Fri, 03 Jul 2020 11:46:06 -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=slEyhjL47i6I9Wxhc3waVaJdqdZuvpWrNlMHpCPdtlI=; b=hWudvJIMNNbUW3X9DzjPBCCvb5ZIR6oSWPu4iLaJwfPDbd00Hi7Rk3R0vWiNrR60Nz rfBpoPiWKAovJ5AsHV5Aqgndv5gBqK6RoDgSnXgHGD2qRdJVyj7zPsWzxaj7cbNmFfEq H5kumOr2XGwekyw6aLMHigST7LM22Lp0yI6e9eoi8HarqcgDrOfXPPJHx4mjRkOq7gz0 Jh7E4jvR0dyqawG4vQQWT/sH8HW/wDSYcuxSzwpkA12OtxNuRY8bNbSzZMDom+dyIwN6 Qfw2eHWwx7Ldc2PtO4PkIyCif+BE8Ln593yOTLX1fue8dyO5Kbnz7hrBCS2vuS2Wv9oJ dKvA== 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=slEyhjL47i6I9Wxhc3waVaJdqdZuvpWrNlMHpCPdtlI=; b=IgHjKBwYF5U7aqPQlCroePRBi4F06I0UF9VD5UEMHk4TJ/DwgaC+I43aOlNH4HN19Z YfTAsML8DOlEkUOHewNzmevXHrsI6W5uJLPsjl4z16+7n3s48tRSlJECdgX5iO6vLWQd 4i4jdxhA1QV09BE8cVJnjFyXd4mPZjBAJw6LbkmDTM20nNktpNv5seFbdGuEtIV4Pp16 ullUry/AsyWUmdVghf9JbPpUJqpC8rbHZMHdwaTIzZLZxd3MMV+Q7AXmoswSs27shGvq FsXOvrWcE3hv7Mraw8wGeuFLGx4lvoGmVIgOmkIMnCe8QQWRTPVhsIoMJhjnATwPak2R Hdcw== X-Gm-Message-State: AOAM533Vdu25PldE9pQVk++DSWvotR6j6W2Ou6kfqnwQ+V6iLAA3jcau 7snacOLDcTIVw11bb7j84JM= X-Google-Smtp-Source: ABdhPJxZVEriVlg0DtABp602eurzMwv/ufWQs5sh/lb4hdctxwi/NmZJQsLASiwNE69v1pDGutzH7Q== X-Received: by 2002:a19:4a4e:: with SMTP id x75mr22707227lfa.70.1593801964841; Fri, 03 Jul 2020 11:46:04 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:4025:a614:1d5c:b7bc]) by smtp.gmail.com with ESMTPSA id h22sm4404224ljg.1.2020.07.03.11.46.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jul 2020 11:46:04 -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 v4 01/20] backlight: refactor fb_notifier_callback() Date: Fri, 3 Jul 2020 20:45:27 +0200 Message-Id: <20200703184546.144664-2-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200703184546.144664-1-sam@ravnborg.org> References: <20200703184546.144664-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 Reviewed-by: Emil Velikov 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 92d80aa0c0ef..7e249aa90b0e 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; }