From patchwork Fri Jun 16 20:33:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 693457 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46BFFEB64DD for ; Fri, 16 Jun 2023 20:35:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231944AbjFPUfE (ORCPT ); Fri, 16 Jun 2023 16:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234169AbjFPUey (ORCPT ); Fri, 16 Jun 2023 16:34:54 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76D513A9D; Fri, 16 Jun 2023 13:34:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686947693; x=1718483693; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=0Nx2tcrNyouaIATaj8ZYKNJsnZ50pb885XPfiz8v0YY=; b=CmIUOiAxtG2HcnFEAZd5AybuBQGxXB75Gwbs2c8jZGTLzwnDSQ5YdyHb k7NjCsX5ozLYxJq9d8zM57JdLtVhw9ogpytNFgeXh+qhRLVVn5G1Kji+/ dHftGGYyHaZrIK5mu4OKpEKd2A/g6EhOabnvLdlugk1HxSKmaFPPzBXiP PFE/y35CRbI/0iua0pglmk00Nrqjucys6AVqXzqzUntbVHbwhL/qNjPj6 CPXofaPZmYGmRWqyUjUxsFIxRAb7nXMHUtJBVVRuVQSpnqGFh09Y1RFWi 13ijtQJTlqxUfOoE8Dl3qXnMY38hRY7x8Mp9EvzQIgj8BVKWJyki4ASsa A==; X-IronPort-AV: E=McAfee;i="6600,9927,10743"; a="358181774" X-IronPort-AV: E=Sophos;i="6.00,248,1681196400"; d="scan'208";a="358181774" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 13:34:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10743"; a="802964395" X-IronPort-AV: E=Sophos;i="6.00,248,1681196400"; d="scan'208";a="802964395" Received: from inesxmail01.iind.intel.com ([10.223.154.20]) by FMSMGA003.fm.intel.com with ESMTP; 16 Jun 2023 13:34:50 -0700 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 52262911E8; Sat, 17 Jun 2023 02:04:49 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 4C53819B; Sat, 17 Jun 2023 02:04:49 +0530 (IST) From: Raag Jadav To: linus.walleij@linaro.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, mallikarjunappa.sangannavar@intel.com, pandith.n@intel.com, Raag Jadav Subject: [PATCH for-next v1 1/3] pinctrl: baytrail: reduce scope of spinlock in ->dbg_show() hook Date: Sat, 17 Jun 2023 02:03:54 +0530 Message-Id: <20230616203356.27343-2-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230616203356.27343-1-raag.jadav@intel.com> References: <20230616203356.27343-1-raag.jadav@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Reduce scope of spinlock to IO operations in ->dbg_show() hook and save a few bytes. add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-12 (-12) Function old new delta byt_gpio_dbg_show 890 878 -12 Total: Before=17029, After=17017, chg -0.07% Signed-off-by: Raag Jadav --- drivers/pinctrl/intel/pinctrl-baytrail.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index d53952f5c87c..54d3c5c26944 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -1241,30 +1241,30 @@ static void byt_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) for (i = 0; i < vg->soc->npins; i++) { const struct intel_community *comm; + void __iomem *conf_reg, *val_reg; const char *pull_str = NULL; const char *pull = NULL; - void __iomem *reg; unsigned long flags; const char *label; unsigned int pin; - raw_spin_lock_irqsave(&byt_lock, flags); pin = vg->soc->pins[i].number; - reg = byt_gpio_reg(vg, pin, BYT_CONF0_REG); - if (!reg) { + + conf_reg = byt_gpio_reg(vg, pin, BYT_CONF0_REG); + if (!conf_reg) { seq_printf(s, "Pin %i: can't retrieve CONF0\n", pin); - raw_spin_unlock_irqrestore(&byt_lock, flags); continue; } - conf0 = readl(reg); - reg = byt_gpio_reg(vg, pin, BYT_VAL_REG); - if (!reg) { + val_reg = byt_gpio_reg(vg, pin, BYT_VAL_REG); + if (!val_reg) { seq_printf(s, "Pin %i: can't retrieve VAL\n", pin); - raw_spin_unlock_irqrestore(&byt_lock, flags); continue; } - val = readl(reg); + + raw_spin_lock_irqsave(&byt_lock, flags); + conf0 = readl(conf_reg); + val = readl(val_reg); raw_spin_unlock_irqrestore(&byt_lock, flags); comm = byt_get_community(vg, pin); From patchwork Fri Jun 16 20:33:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 693456 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39672EB64DB for ; Fri, 16 Jun 2023 20:35:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230244AbjFPUfD (ORCPT ); Fri, 16 Jun 2023 16:35:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233180AbjFPUey (ORCPT ); Fri, 16 Jun 2023 16:34:54 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E8DF3A9B; Fri, 16 Jun 2023 13:34:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686947693; x=1718483693; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=gqFVDbmVob3I2MoqOIXVaTRuNrQ5hYWbmLsucJsf0nY=; b=ac68FdO8tQy5GdqPGg00jlGyicPp/O8zg5oDTh5gS4tMXn750INuM/qg aAvSFlkz+zEwD0rarNEzT0po+jYyQYSqwZ/G4pPIFrcIxwVCwYyz8C2l8 xWF+2pRQxXK/K1acH47LnR3ZSEFiB6T+Qinj84DLbg9BZeIgpFJ2wJu8v d3IUrGzcWAV9pVMtVpgI1L7oRkJJCIe40cpjegMzty6r4Z8o5cud8r2Jb nSvlAAWfkUW+vNHpGDzO8OZWR490D6C2Z1421c0O5wfDHX22berNG1ST0 ilcfGTtjilIQbijl+HODZQ7IQVTjE0JpH8H6FT/WTTXk/KYygBoHyq+kF g==; X-IronPort-AV: E=McAfee;i="6600,9927,10743"; a="358181776" X-IronPort-AV: E=Sophos;i="6.00,248,1681196400"; d="scan'208";a="358181776" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 13:34:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10743"; a="802964400" X-IronPort-AV: E=Sophos;i="6.00,248,1681196400"; d="scan'208";a="802964400" Received: from inesxmail01.iind.intel.com ([10.223.154.20]) by FMSMGA003.fm.intel.com with ESMTP; 16 Jun 2023 13:34:50 -0700 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 57A7B911EA; Sat, 17 Jun 2023 02:04:49 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 5461CCA; Sat, 17 Jun 2023 02:04:49 +0530 (IST) From: Raag Jadav To: linus.walleij@linaro.org, mika.westerberg@linux.intel.com, andriy.shevchenko@linux.intel.com Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, mallikarjunappa.sangannavar@intel.com, pandith.n@intel.com, Raag Jadav Subject: [PATCH for-next v1 3/3] pinctrl: baytrail: invert if condition Date: Sat, 17 Jun 2023 02:03:56 +0530 Message-Id: <20230616203356.27343-4-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230616203356.27343-1-raag.jadav@intel.com> References: <20230616203356.27343-1-raag.jadav@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Invert if condition and get rid of redundant else. Signed-off-by: Raag Jadav --- drivers/pinctrl/intel/pinctrl-baytrail.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-baytrail.c b/drivers/pinctrl/intel/pinctrl-baytrail.c index 97ead2c58b66..27aef62fc7c0 100644 --- a/drivers/pinctrl/intel/pinctrl-baytrail.c +++ b/drivers/pinctrl/intel/pinctrl-baytrail.c @@ -753,9 +753,7 @@ static void byt_gpio_clear_triggering(struct intel_pinctrl *vg, unsigned int off value = readl(reg); /* Do not clear direct-irq enabled IRQs (from gpio_disable_free) */ - if (value & BYT_DIRECT_IRQ_EN) - /* nothing to do */ ; - else + if (!(value & BYT_DIRECT_IRQ_EN)) value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL); writel(value, reg);