From patchwork Thu Jun 8 07:00:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raag Jadav X-Patchwork-Id: 104843 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp95111vqr; Thu, 8 Jun 2023 00:12:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ564rOOC4oreUqXAkqP17fW8zl+WlHqfzAViasDhtwphO9xmw6z6eiQyasJxLinhB33xXo8 X-Received: by 2002:a05:6808:105:b0:399:b0ee:de1 with SMTP id b5-20020a056808010500b00399b0ee0de1mr4630966oie.49.1686208321919; Thu, 08 Jun 2023 00:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686208321; cv=none; d=google.com; s=arc-20160816; b=WLPWS631bfOZH1WlSaBQk1SmyxWLtfFplGkV+u/4AtJZHgVFn6ToaXsQ3W6cNEhPI+ ht1KMHfheh62SDubL5iAlBsN7OaEAA+bkfeCsHfey2f+EJlcHoR2UPEU9PmDP7YvMHWG im8DRAwbhTSRUttgZS0LOr1kWgWFn8ZGFdWW28a95Pslg9MTwHNykDRtlRS4rnX6umVg 42l+B7Js6GNSLzF2IAoMr5/DPJdYHuVuiy3gzMeaOmkB43Kh/QxG9QHow96LgDAzH/tN fX82MOlYw7lCO/Y3+8wngyzoq4WeL6UrpepEgju8EX1wSCJ+kuzjNioJ5nVSA0y4bWV/ Zxzw== 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=kF3XGcB/FfZQJp5zzspoU8NU85xMC/EPbrq7RMPt+hU=; b=jp75JV1Zi5FByOE5uKl7+9NSRnNiKuD/W2z786kmDQE0VbLMoQTy8Orny8VNEPrN/c CIlwJKKRqXJHMXbEpZf0+jI0uzfG4pLViieGzJYb+8cgkQR3AltRxcuFTcTaXoGHNCTk tVzS902FwSj1m4EYD1ofyOWvFBLbXx2SM1relNC8hySGaunbZxOEE1R3VXl8pAeV69EJ pAR7Kny/B7wo47PxqnFgJ2MJ+7cgiROI5xW+IOs8n8majdbtlBpJVDfq2zNqNsXc/1nq LV4KcquHUirmO7wVJtlvjNTwmwn/sHma5B/ucb8C8zZw+1EwUh0HsIccadojlJEAvtX+ ZLFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ugz7mPKs; 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 k11-20020a637b4b000000b00542b2e4c966si555892pgn.483.2023.06.08.00.11.40; Thu, 08 Jun 2023 00:12:01 -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=Ugz7mPKs; 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 S235248AbjFHHCK (ORCPT + 99 others); Thu, 8 Jun 2023 03:02:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235207AbjFHHCD (ORCPT ); Thu, 8 Jun 2023 03:02:03 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBF3D1BF7; Thu, 8 Jun 2023 00:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686207710; x=1717743710; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=07mx7Ug6tXfeMPMgNwQtvYzD0FW2NuxcTQr5+0xwwes=; b=Ugz7mPKsjRcATjOu5nrRuYIsNxRtcfMTCVqfeHXyN3esoPlpPrVVQhy6 RSiE3CimiSYDXpp/cyyU1SxmqaccYPj3poJHa0CoG/aogPajfHwLOcX9Y 0quJASqc8hPom/07Qaps5+YPoDEDltxskvp0FnDQy7PaON7Eeaa3rGfKq RyN17vEVT0YEK/tuKDwE5HGSLa5L48eXnJp23GdN2jN8IfIf650aohc2I 4QAvQiXsZYIOIxdI8TdJs92m2etlurhsAh+KvGWB6oEqVG1AtElqVombV XFLhmxd3lPYKA+FtSCDOpUruXaPwKV3qy+efihn0Qyu6idTSBsAZGscMp g==; X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="359696346" X-IronPort-AV: E=Sophos;i="6.00,226,1681196400"; d="scan'208";a="359696346" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2023 00:01:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10734"; a="709867968" X-IronPort-AV: E=Sophos;i="6.00,226,1681196400"; d="scan'208";a="709867968" Received: from inesxmail01.iind.intel.com ([10.223.154.20]) by orsmga002.jf.intel.com with ESMTP; 08 Jun 2023 00:01:07 -0700 Received: from inlubt0316.iind.intel.com (inlubt0316.iind.intel.com [10.191.20.213]) by inesxmail01.iind.intel.com (Postfix) with ESMTP id 1518A1AA18; Thu, 8 Jun 2023 12:31:07 +0530 (IST) Received: by inlubt0316.iind.intel.com (Postfix, from userid 12101951) id 11534176; Thu, 8 Jun 2023 12:31:07 +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 v1 3/4] pinctrl: intel: simplify exit path of set_mux hook Date: Thu, 8 Jun 2023 12:30:16 +0530 Message-Id: <20230608070017.28072-4-raag.jadav@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230608070017.28072-1-raag.jadav@intel.com> References: <20230608070017.28072-1-raag.jadav@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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?1768117577224098080?= X-GMAIL-MSGID: =?utf-8?q?1768117577224098080?= 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 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 3f78066b1837..1b5745202058 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -393,7 +393,10 @@ 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; + + /* In case we never really enter any of the below loops */ + ret = 0; raw_spin_lock_irqsave(&pctrl->lock, flags); @@ -403,8 +406,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 +430,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)