From patchwork Fri Jun 9 08:25:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 105414 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp796436vqr; Fri, 9 Jun 2023 01:33:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4d5XXYfQfsUCltEJ1HOUjZ5OE1btBOh7MJGSQtgxpPN+Vno2O/slS0m1dgztHfvHNrf4Nt X-Received: by 2002:a05:6a21:3a4a:b0:119:6112:5364 with SMTP id zu10-20020a056a213a4a00b0011961125364mr344805pzb.59.1686299620839; Fri, 09 Jun 2023 01:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686299620; cv=none; d=google.com; s=arc-20160816; b=JIbuXmZVtOPf0a1butVLH6kP+ieLzq8cWDgy8o1/As2tqxgSAX3ToWTeTqJ1V80bTl ibQ+Wn8oNk514Sg+qMnt70cLH2hKorpPTKvMEbFfnEGS0bBoG0JJOreGFHNB58WLIrwO CkNipkDPRTt9dole3RthY7Y3ed+AzWewPsS+fwqO5QPcYh81+qOh+4ZmmObgGPKtk/3n UAyt2CaqvvvUZ4OmvZeDFI/rUC1TQ42j1eK2HSJqqW3xVj9M4BHHjrXnjlvqKmFLT9Uj TRKKXxzDALLyc2UD3dPgWzmdwmLcyqjUqP/EsNNr+CsQYf5zXdiSdNLl4r7idZC3BT17 CnjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=SnJ929mGeDyStusqpCTD6FWPnXgvfSKWLy8KwWwaItQ=; b=bNttLLxVFX4zQEQInQIEDiXd1v3d2k5YEsXb7vfPBIAeglg4ButgiXD7cYnyyBfDJZ 0XXRWFoI4F0UmdO3tH28vLIkwvp7T2NnOU+d2ajZICRuQETso+M1gtQ121klcSKVVa/f Y5rp2IJF+lnbqlGpzuu/lET5UaoNjiHaa24kZFMuZVLjOPgvhhSsA0hHRs8bAALSGdJn qiHqVza5Lof7NqjRYbeY4g55eBtGnG+Yodf/XzJSq6pdUBKNGIZqw9gZy3GuO+kC67Mx Zu0Cn2O1k5Odg96tO4xJxJKtJniQmxGZcZ2ghZ51CbEgIP7vs81OX+c2zQvLYEH8kTi7 fwhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZG8wtSDR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m23-20020a637d57000000b0053ef4189de6si2295785pgn.372.2023.06.09.01.33.23; Fri, 09 Jun 2023 01:33:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZG8wtSDR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240931AbjFII1y (ORCPT + 99 others); Fri, 9 Jun 2023 04:27:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241656AbjFII0S (ORCPT ); Fri, 9 Jun 2023 04:26:18 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBF573A88; Fri, 9 Jun 2023 01:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686299163; x=1717835163; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=FdOUg0wrIHPy8S0vIosISMVGhprK8AkkqdGWBQxA5zY=; b=ZG8wtSDRucr0V6x7dRWIb/aLTq35esGqxL2smpKzEj0R/lLFy4FcSVCe mVz3T+XDWAKY2433pQ2hDs5TOW4d2kwIi2P7SJjdi0Ep22RjRiKc8XKCF 7+Gtihi81BhtlK4wRiSEQKFiRffKX14Z2dX/f+ntjAac+VefC0U46ZlH/ ixmEcXecSnd0KpagsTuuQOn+lwuZYVW0zJrSvQXGABhd48e3IwiTprBa6 xs1jTvUpfc5U6R+09lwwAaNjfRvj/MjbU0ICBmOk7N5i/mTgGGu2G9hLW vnX14liewaWirwrgwzBYTBRGQSf04Pc2ETodaih49eiAU1x0NElebdsmT w==; X-IronPort-AV: E=McAfee;i="6600,9927,10735"; a="342222300" X-IronPort-AV: E=Sophos;i="6.00,228,1681196400"; d="scan'208";a="342222300" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2023 01:26:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10735"; a="713424276" X-IronPort-AV: E=Sophos;i="6.00,228,1681196400"; d="scan'208";a="713424276" Received: from inesxmail01.iind.intel.com ([10.223.154.20]) by fmsmga007.fm.intel.com with ESMTP; 09 Jun 2023 01:25:59 -0700 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 060B71435B; Fri, 9 Jun 2023 13:55:59 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id F387DAB; Fri, 9 Jun 2023 13:55:58 +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 v2 1/4] pinctrl: intel: refine set_mux hook Date: Fri, 9 Jun 2023 13:55:36 +0530 Message-Id: <20230609082539.24311-2-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230609082539.24311-1-raag.jadav@intel.com> References: <20230609082539.24311-1-raag.jadav@intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768213311098757633?= X-GMAIL-MSGID: =?utf-8?q?1768213311098757633?= Utilize a temporary variable for common shift operation inside ->set_mux() hook and improve readability. Signed-off-by: Raag Jadav --- drivers/pinctrl/intel/pinctrl-intel.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index c7a71c49df0a..e8adf2580321 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -411,18 +411,19 @@ static int intel_pinmux_set_mux(struct pinctrl_dev *pctldev, /* Now enable the mux setting for each pin in the group */ for (i = 0; i < grp->grp.npins; i++) { void __iomem *padcfg0; - u32 value; + u32 value, pmode; padcfg0 = intel_get_padcfg(pctrl, grp->grp.pins[i], PADCFG0); - value = readl(padcfg0); + value = readl(padcfg0); value &= ~PADCFG0_PMODE_MASK; if (grp->modes) - value |= grp->modes[i] << PADCFG0_PMODE_SHIFT; + pmode = grp->modes[i]; else - value |= grp->mode << PADCFG0_PMODE_SHIFT; + pmode = grp->mode; + value |= pmode << PADCFG0_PMODE_SHIFT; writel(value, padcfg0); } From patchwork Fri Jun 9 08:25:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 105427 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp799879vqr; Fri, 9 Jun 2023 01:42:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7s5vHgtRRKkjxhQrD0pY4vucs59vcOEq3Ivy5qWXSwnm3U6TSdgDmGDIkgqURctk2EmOaJ X-Received: by 2002:a17:903:5d0:b0:1ae:2b95:7125 with SMTP id kf16-20020a17090305d000b001ae2b957125mr357084plb.63.1686300175013; Fri, 09 Jun 2023 01:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686300174; cv=none; d=google.com; s=arc-20160816; b=vo/lt49lhYoQ2mLDJcQmy1QZ/70GuffSe3l4JTXqeGcyP/eGjNUWyGD15QSVuWEGFu wcYk4A9dqePY7LbY/0damhgtMEsnyAkR+ycHoHfKEluUq5TZuVs76/sUxx3Tk2BWZIkh yjOxhex69YA7HjeoF/VbcMKfCLeHraN2VtDhEMTc93tdpJbeCsVCF6ohq8Y53UTWzC7Y 3+SAkEfi50rdDt5vjkiqgBQMEAIW6WtwBLtQ9wCk2jRM1eNYhn8wOwJEIpRNfBNjj/8b c4QL5y2n6O95YbL5OGjYA1r5QwkPnuJBQVZbz67vUBkXa9clR0rsEoPZdDZnZSqtngDi Osag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=WZ04SQ+XQPG2aR1ktEJlCsYoeB5ADuCTzbOr84Oad24=; b=zaaiCj1BUGQxTeWk+wx9MO/XmYyl+dvovRz9SaI8s6E5tYm+Jg+YKTSDvfMSJTxsou p6qDoOmXM273mvSYdbLJx9DHumZNgw65AcRSKUTlzY9gS4prRWiHat9num+yYQnS1Nsb 51XOGdaF4ML3gdxiC1+MmCIkpu9hwbgDz9wfHu1xBPaiLlnogMVNIPRoi0bxvk4BLboB Xa4yBX+GTUKYGSuGxgYqUT200xTYpWoep8dzzOvwkJitF0mKmShARn/eNCS96BxR5caD 0DCuwRjMkB+iRPot9vDTwofqX5dfX2J8dd6IeyQrf6a2psJDJz3liCg39OUem8ASzpHK r3JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WEpz45GW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a17090322d200b001aafea6f85esi2498599plg.435.2023.06.09.01.42.41; Fri, 09 Jun 2023 01:42:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WEpz45GW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240760AbjFII11 (ORCPT + 99 others); Fri, 9 Jun 2023 04:27:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241654AbjFII0S (ORCPT ); Fri, 9 Jun 2023 04:26:18 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACE8930EC; Fri, 9 Jun 2023 01:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686299163; x=1717835163; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=qAYVBXdl5GPI2VnNJdr1EfODyAMusq9BtjJGbz/NqZE=; b=WEpz45GWGJvKb/5Qw+eTQipmYMCeK8Cvxsr/1ccAwwsmA+HzTbC/PBVd wJphektzHAdhHtbXdleEWsQze2yswAEP3dhiIzEPOtXTLNkJ2WPZf2zds o4q2EOHw4PKLwvY/7s3QesQu4UdZh7x3vpRFRp2nZ8cOTsiM9oTRO7fYT H7R1s/kixWUQr239d/hi9GGB6ZucNcAkZ7JnSdpJFMDfqOYFUgtC+Xfwp 1EXkiGxF3ROE6WPCL8l996zRFy1mdnaXuBxWnRYcIzMOd0opbO7NtpCA7 XGCBpvPhVfcGULINXVk5jKE5Kza+9wcA8gAY/UDT3FMtkGTJOTDD+Z+NA w==; X-IronPort-AV: E=McAfee;i="6600,9927,10735"; a="342222298" X-IronPort-AV: E=Sophos;i="6.00,228,1681196400"; d="scan'208";a="342222298" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2023 01:26:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10735"; a="713424278" X-IronPort-AV: E=Sophos;i="6.00,228,1681196400"; d="scan'208";a="713424278" Received: from inesxmail01.iind.intel.com ([10.223.154.20]) by fmsmga007.fm.intel.com with ESMTP; 09 Jun 2023 01:25:59 -0700 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 09A2918636; Fri, 9 Jun 2023 13:55:59 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 016C1B6; Fri, 9 Jun 2023 13:55:58 +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 v2 2/4] pinctrl: intel: refine irq_set_type hook Date: Fri, 9 Jun 2023 13:55:37 +0530 Message-Id: <20230609082539.24311-3-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230609082539.24311-1-raag.jadav@intel.com> References: <20230609082539.24311-1-raag.jadav@intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768213892381633191?= X-GMAIL-MSGID: =?utf-8?q?1768213892381633191?= Utilize a temporary variable for common shift operation inside ->irq_set_type() hook and improve readability. While at it, simplify if-else-if chain and save a few bytes. add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-16 (-16) Function old new delta intel_gpio_irq_type 317 301 -16 Total: Before=10469, After=10453, chg -0.15% Signed-off-by: Raag Jadav --- drivers/pinctrl/intel/pinctrl-intel.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index e8adf2580321..3f78066b1837 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -1128,8 +1128,8 @@ static int intel_gpio_irq_type(struct irq_data *d, unsigned int type) struct intel_pinctrl *pctrl = gpiochip_get_data(gc); unsigned int pin = intel_gpio_to_pin(pctrl, irqd_to_hwirq(d), NULL, NULL); unsigned long flags; + u32 value, rxevcfg; void __iomem *reg; - u32 value; reg = intel_get_padcfg(pctrl, pin, PADCFG0); if (!reg) @@ -1150,23 +1150,24 @@ static int intel_gpio_irq_type(struct irq_data *d, unsigned int type) intel_gpio_set_gpio_mode(reg); value = readl(reg); - value &= ~(PADCFG0_RXEVCFG_MASK | PADCFG0_RXINV); if ((type & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) { - value |= PADCFG0_RXEVCFG_EDGE_BOTH << PADCFG0_RXEVCFG_SHIFT; + rxevcfg = PADCFG0_RXEVCFG_EDGE_BOTH; } else if (type & IRQ_TYPE_EDGE_FALLING) { - value |= PADCFG0_RXEVCFG_EDGE << PADCFG0_RXEVCFG_SHIFT; - value |= PADCFG0_RXINV; + rxevcfg = PADCFG0_RXEVCFG_EDGE; } else if (type & IRQ_TYPE_EDGE_RISING) { - value |= PADCFG0_RXEVCFG_EDGE << PADCFG0_RXEVCFG_SHIFT; + rxevcfg = PADCFG0_RXEVCFG_EDGE; } else if (type & IRQ_TYPE_LEVEL_MASK) { - if (type & IRQ_TYPE_LEVEL_LOW) - value |= PADCFG0_RXINV; + rxevcfg = PADCFG0_RXEVCFG_LEVEL; } else { - value |= PADCFG0_RXEVCFG_DISABLED << PADCFG0_RXEVCFG_SHIFT; + rxevcfg = PADCFG0_RXEVCFG_DISABLED; } + if (type == IRQ_TYPE_EDGE_FALLING || type == IRQ_TYPE_LEVEL_LOW) + value |= PADCFG0_RXINV; + + value |= rxevcfg << PADCFG0_RXEVCFG_SHIFT; writel(value, reg); if (type & IRQ_TYPE_EDGE_BOTH) From patchwork Fri Jun 9 08:25:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 105434 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp803965vqr; Fri, 9 Jun 2023 01:54:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ65fGD4BDHh+p3q/VLuPcCE4dO703IFnFE+NSNI1wrjEIkHYtgwK847xXMNa9RCPJAuAJeR X-Received: by 2002:a05:620a:490b:b0:75b:23a0:e7e1 with SMTP id ed11-20020a05620a490b00b0075b23a0e7e1mr513013qkb.66.1686300856240; Fri, 09 Jun 2023 01:54:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686300856; cv=none; d=google.com; s=arc-20160816; b=o8ZMdCJfdBSP9WJkSmZ1FvsHilPZDVBu7zfNNNviKrWx3qEThGJGw23O05+Eq33ray JLKJwIx65gtsDaQjkncPBsIsj5gHeZgwDccWbqRUji8LEgGVYtMKPe6Y+Wc61CpE7XPp DwbzgD2TN7RQec/yNyuNmOOBXKS++/YJ+NsIyI04NXJZmshmZ76KzW61kzZrzcwsmu/R Ql7hQI2m5B4ltnCTMccx9et9LDfxVKfVjgZv0pdqpn66lWLnS1PKjoCp6vMDinWxQOsK JNOfy3l/E+qfPY1ypQZUFQITzYC+uxhNKGMOFfwPuVBuKCnf0WDCeJCA+8Ue68t4vjMW 5YTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=WACuH89GCGlK8aX28MU3u2sgyOxjXLvygqPV6PIir+U=; b=dYFmo7TYsVaj/1IhVfR4ayYe8aO0QG3aziYv0128g484IvrNKsc80ra3G+Au1EYOPs JvqVdZyfkgxICzB91fhXuXxxOTixLDA4hc2olvvEwXcxM70QmOFqdoGJ6kFNbHHaIS06 WQhfwkdFSt2zBve2Pal4rQcJIEmNnf61tnsCsLjmWy9S2oeh86qcO2z7N9YIcZuzEQEO kEEphUjgRX9K1S2oAtVQ8DrwGRL1BdyZHVKN8DIuqCYOrZXXwfe+4ugm9EGbvQNUCySZ JxhwRN+w3af99L6eEVuLj67n0FtLaqHCsig1C4Fs2uTPR2KDR5WE/YNUyuWwxeF7iqCV P+BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ROHCT2TM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d23-20020a17090ad99700b0024e01bbc60asi4120261pjv.117.2023.06.09.01.54.02; Fri, 09 Jun 2023 01:54:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ROHCT2TM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240892AbjFII1n (ORCPT + 99 others); Fri, 9 Jun 2023 04:27:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241658AbjFII0S (ORCPT ); Fri, 9 Jun 2023 04:26:18 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F4543A8B; Fri, 9 Jun 2023 01:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686299164; x=1717835164; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=z9xXo48x1ggxmMr9XY4R6V8kfPhOyr/XiwTtF620lK4=; b=ROHCT2TMPloVPtb6RLY/12QdWXLbASigsxFXCAKiiYw7FrufrVRcjxOB B/HT/9BKj8NY4qN2TF0Fe3g+U/990DjCCR3JPGgbuNZHiqbfccbmCJzmZ xMn2RyTZQii71Fp1AZR6zYkVLlNdZ3hCkFND2dGNOla92lDuFEhw/cTrN 9uogJRjwMQHAqweS2LIVZd48vKjSg5Y8kU33IqgF7qN4e9xEqJBlbApLn DOp8zqX1Z/YNOrZQoGlgatO1q/bwmoXgdeNxCqiNUq7mJEjcQxQwIaHmY SIVaN1ruqeqEham+7ixZJjkJ2SH3Em7dgkiYF4J+G0hPdi5z3JPa/YSAC Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10735"; a="342222303" X-IronPort-AV: E=Sophos;i="6.00,228,1681196400"; d="scan'208";a="342222303" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2023 01:26:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10735"; a="713424281" X-IronPort-AV: E=Sophos;i="6.00,228,1681196400"; d="scan'208";a="713424281" Received: from inesxmail01.iind.intel.com ([10.223.154.20]) by fmsmga007.fm.intel.com with ESMTP; 09 Jun 2023 01:25:59 -0700 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 0ABF119740; Fri, 9 Jun 2023 13:55:59 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 03724163; Fri, 9 Jun 2023 13:55:58 +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 v2 3/4] pinctrl: intel: simplify exit path of set_mux hook Date: Fri, 9 Jun 2023 13:55:38 +0530 Message-Id: <20230609082539.24311-4-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230609082539.24311-1-raag.jadav@intel.com> References: <20230609082539.24311-1-raag.jadav@intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768214293881437206?= X-GMAIL-MSGID: =?utf-8?q?1768214606541823671?= Simplify exit path of ->set_mux() hook and save a few bytes. add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-22 (-22) Function old new delta intel_pinmux_set_mux 242 220 -22 Total: Before=10453, After=10431, chg -0.21% Signed-off-by: Raag Jadav --- drivers/pinctrl/intel/pinctrl-intel.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 3f78066b1837..2338e84615cc 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -393,7 +393,7 @@ static int intel_pinmux_set_mux(struct pinctrl_dev *pctldev, struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); const struct intel_pingroup *grp = &pctrl->soc->groups[group]; unsigned long flags; - int i; + int i, ret = 0; raw_spin_lock_irqsave(&pctrl->lock, flags); @@ -403,8 +403,8 @@ static int intel_pinmux_set_mux(struct pinctrl_dev *pctldev, */ for (i = 0; i < grp->grp.npins; i++) { if (!intel_pad_usable(pctrl, grp->grp.pins[i])) { - raw_spin_unlock_irqrestore(&pctrl->lock, flags); - return -EBUSY; + ret = -EBUSY; + goto out_unlock; } } @@ -427,9 +427,10 @@ static int intel_pinmux_set_mux(struct pinctrl_dev *pctldev, writel(value, padcfg0); } +out_unlock: raw_spin_unlock_irqrestore(&pctrl->lock, flags); - return 0; + return ret; } static void __intel_gpio_set_direction(void __iomem *padcfg0, bool input) From patchwork Fri Jun 9 08:25:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 105430 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp801124vqr; Fri, 9 Jun 2023 01:46:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ74PK9OM/vSutMFdn8t0VPI0mWy+/0h122ZJLCpy5nlw8MrBreGx39uVTbYMsooDhFfX/pd X-Received: by 2002:a05:6870:b7a6:b0:192:a02e:7504 with SMTP id ed38-20020a056870b7a600b00192a02e7504mr599768oab.50.1686300376693; Fri, 09 Jun 2023 01:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686300376; cv=none; d=google.com; s=arc-20160816; b=xWdnQzMND5StOvWsleyKdlUrKtyU01T30Lm7wbAW2ek8iJuDXiKe3aSrZuv+oCp+aJ rzuMpbKL98DGNE25zFccWToO5LvAglsbk22NsGK70xOXHDaEVq/vZYtDI1/jDX0wz2bV unC+wpmvaDyKvzftvQfYzPbNPTrlKmgihFy4SDA6PPRuc9XOGsfxOeelJUNbfCyWxt9V RUavn9gSwmksVnNxoE2+wKn7oY8B26zu4PTD9HHzaP1UKRrHV5NyLR80mtPSa7jJmc1V M43ur2pNlgA7aRJnbcIJLxylZoKTlN7DxGH6LBHuKXXHmHtvWqbAPjVQS2hx7FOg/z3k lyPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=Eb+GtDQoTHeJcubcE5X9VsZkhvl0UvmnuLrLP8rT54U=; b=zevAIZH24WX4MhFLIe8tgQWLr7h7o1PW9Pb9QtEI6WaSsnSER6Yzp6Duer4YZsVePr e05GRO461FXwE19uVo1+LCbfbI+wLWisJ1eFdRs9upPyNtPAFKB7RpFfGictiMwKncC+ IWGMfYyCr6mJIKrhCWfvk64c4YoWU7cP/Dzk2uvfzp/I9XnMDw5l02emtYhj56cG2Qoq d/RApCXmQ2gfWGIpeR+KaFJMGBj6shucV3I39jx+RRiEwXtVo1e6lsmJ8dXbKExV6UUk Le3FenG/F2PnQ6ohhzpQJ0JqYQF+pdZoBkWWvhQ7i3SYowpgYyd8qkqCZxuWtLvlv8JL 7UTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AzRoxGvA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q15-20020a63750f000000b0053fb69a6397si2400312pgc.587.2023.06.09.01.46.02; Fri, 09 Jun 2023 01:46:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AzRoxGvA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241034AbjFII1j (ORCPT + 99 others); Fri, 9 Jun 2023 04:27:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241661AbjFII0S (ORCPT ); Fri, 9 Jun 2023 04:26:18 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B37C13AAC; Fri, 9 Jun 2023 01:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686299164; x=1717835164; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=Jca4VwCHycfBasare1YXUgyB4DjUVfYUbAfgEFuOdug=; b=AzRoxGvAQWIIA9vj9fLauuCcevWPwNIyHCiFwkRfN3tJ9Zs3t7oGs4v/ UPtkstMVhDOvzrmQG7+ndb8Kpc5INN0Op3kjbohOjd371/C0yM4rp7MUr /k/s5wBQXm01/mVKyvcFQCwZC5SDKC/NEtkQ87d0JokXqAqcoXoOyHHpQ gLMnoPhnle1QiLP1QnkUyuz4aTdAGVGw3X+PRxPA3VlSkRBvZkvok9n2Y GPPy+HmMi6Z6gvH+yJmTgblW/LUnDCYIaBniYn4URVANtROM5TfGmX/5X 4o1CL7AJ5GXHJr2Ss5HOYcjU7ZZvWDZVTTf8GKdgg1aqnPyCxVaDm469H A==; X-IronPort-AV: E=McAfee;i="6600,9927,10735"; a="342222305" X-IronPort-AV: E=Sophos;i="6.00,228,1681196400"; d="scan'208";a="342222305" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2023 01:26:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10735"; a="713424282" X-IronPort-AV: E=Sophos;i="6.00,228,1681196400"; d="scan'208";a="713424282" Received: from inesxmail01.iind.intel.com ([10.223.154.20]) by fmsmga007.fm.intel.com with ESMTP; 09 Jun 2023 01:25:59 -0700 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 0C0F119742; Fri, 9 Jun 2023 13:55:59 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 08E3F17C; Fri, 9 Jun 2023 13:55:59 +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 v2 4/4] pinctrl: intel: simplify exit path of gpio_request_enable hook Date: Fri, 9 Jun 2023 13:55:39 +0530 Message-Id: <20230609082539.24311-5-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230609082539.24311-1-raag.jadav@intel.com> References: <20230609082539.24311-1-raag.jadav@intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768214103734065768?= X-GMAIL-MSGID: =?utf-8?q?1768214103734065768?= Simplify exit path of ->gpio_request_enable() hook and save a few bytes. add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-36 (-36) Function old new delta intel_gpio_request_enable 186 150 -36 Total: Before=10431, After=10395, chg -0.35% Signed-off-by: Raag Jadav --- drivers/pinctrl/intel/pinctrl-intel.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 2338e84615cc..12b994fa2aad 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -486,20 +486,19 @@ static int intel_gpio_request_enable(struct pinctrl_dev *pctldev, struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); void __iomem *padcfg0; unsigned long flags; + int ret = 0; padcfg0 = intel_get_padcfg(pctrl, pin, PADCFG0); raw_spin_lock_irqsave(&pctrl->lock, flags); if (!intel_pad_owned_by_host(pctrl, pin)) { - raw_spin_unlock_irqrestore(&pctrl->lock, flags); - return -EBUSY; + ret = -EBUSY; + goto out_unlock; } - if (!intel_pad_is_unlocked(pctrl, pin)) { - raw_spin_unlock_irqrestore(&pctrl->lock, flags); - return 0; - } + if (!intel_pad_is_unlocked(pctrl, pin)) + goto out_unlock; /* * If pin is already configured in GPIO mode, we assume that @@ -507,16 +506,15 @@ static int intel_gpio_request_enable(struct pinctrl_dev *pctldev, * potential glitches on the pin. Otherwise, for the pin in * alternative mode, consumer has to supply respective flags. */ - if (intel_gpio_get_gpio_mode(padcfg0) == PADCFG0_PMODE_GPIO) { - raw_spin_unlock_irqrestore(&pctrl->lock, flags); - return 0; - } + if (intel_gpio_get_gpio_mode(padcfg0) == PADCFG0_PMODE_GPIO) + goto out_unlock; intel_gpio_set_gpio_mode(padcfg0); +out_unlock: raw_spin_unlock_irqrestore(&pctrl->lock, flags); - return 0; + return ret; } static int intel_gpio_set_direction(struct pinctrl_dev *pctldev,