From patchwork Wed Jan 25 21:26:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 48380 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp498019wrn; Wed, 25 Jan 2023 13:40:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXsrfigNxccYH8AvHzyMvt5scGZzjk0usOeX8T2Fd9pYrbO3fjdFwKaU/SFVy9AzafqiUKwM X-Received: by 2002:a17:903:2448:b0:192:7845:e0cc with SMTP id l8-20020a170903244800b001927845e0ccmr77035465pls.68.1674682856696; Wed, 25 Jan 2023 13:40:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674682856; cv=none; d=google.com; s=arc-20160816; b=b0vwU2W8iy90dCjZlVXvXYeEX9lOH/L1UqJXlNLbU87cahJEfILa2a0UAysgTH5Xza lWrbjSzz7M9ADD9Q4W6EhztQx/BgPweOBzGmvSiCIM4jAOqVJu7hqyIA51rTxpEfYJrw UWqSDANWulTJvgW9PMdO/voe+y5snu/PKp/3fb4LEDD38KCt1lBEgJELp34IaQWnNsur 0UWIrpF5biajyUWyMVyjwXRbIdIS+cfdJYafWtTJSnh8fBrRmn6K0cO00mUMZUCSQEvD oCB+F1Nyx97FcynobDHOc4pnvamC/FwEBt1TEpFWNUwJtUbcKvmLudQsSTCKbjo4PdPV vOjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sOoHsm7MS2bdA393wRj32TqJ4i4jAbnYJ0SnvWhXtHw=; b=cbykQctIwOn6NixbY9n3/b2FvPk/Lw6pCbfApQiegD55k7WS++pWdx/4ctvuKh00GB bWS0QfW/vwO+ICxeyzBxXExWXs6/M5bpbOX1UKpvGtgxskLKA5rm0mzd7AVyts5jfJrN T2hll06U/cg9ZBnDht1gCJTBMBtBRXRe6FFhdcKt3T34SPTllmTqLkkh5P+3rPghOMOI BxpMFcSUC5R9OGcevdYq81U7+2NAAx8yNXsgpIl1r904CacXbWhZS7nKpvKTBnaB79YM AdqD4z3LUsTqOk2XX1I4gLosvAMzAQNnY5KAxwre+05uGgkvPBlAYNWS2ousNekqtlk/ eEww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=K6qYgMot; 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=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a17090301d000b0019612704019si6821073plh.124.2023.01.25.13.40.13; Wed, 25 Jan 2023 13:40:56 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=K6qYgMot; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236937AbjAYV2Y (ORCPT + 99 others); Wed, 25 Jan 2023 16:28:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236936AbjAYV2K (ORCPT ); Wed, 25 Jan 2023 16:28:10 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD31446D48 for ; Wed, 25 Jan 2023 13:26:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674682003; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=sOoHsm7MS2bdA393wRj32TqJ4i4jAbnYJ0SnvWhXtHw=; b=K6qYgMotXzCME9RbypNzgKrdr2U4aZ72eVpplR95r6yZEGukNbqnOpUPXDF3lL3xAFIoK4 iQzSVqx4HclanFluvq42Q8KVO6VCzVQii6gR8vQTqJoZdk2j/v0I/v7GwX6DxF+a3Aw4Dk GjwQCSIHdcIC1OajrlgjgAmJyfRI4Bc= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-349-ICXFdIdrNEq5tIfTjsUkZA-1; Wed, 25 Jan 2023 16:26:42 -0500 X-MC-Unique: ICXFdIdrNEq5tIfTjsUkZA-1 Received: by mail-qk1-f199.google.com with SMTP id s7-20020a05620a0bc700b006e08208eb31so25582qki.3 for ; Wed, 25 Jan 2023 13:26:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sOoHsm7MS2bdA393wRj32TqJ4i4jAbnYJ0SnvWhXtHw=; b=Vd1Ke2804R3oly77GB2cx/wyWNzGJFnSSEeqM4BniEGn9H7ymYq63nHRebmhiDYPNc FosJRT9V2+ogGyB1RlUdfQ+eatvCIGzhfAFNUKX/o/74O1bNCeXvjKleiMXsV+dJGgG7 lnCcNl4PYAUfMSR16fPIvhAR3i8HSxDQQZFLV+CI7V7h8hjIvuecYrhdFt1s+xDvlMKU lssiV2oS9yMN71VuY2TSTQEVw02X2L8AEkjm8fAefjd5VdaAm9g99gzg1WOIsJrfSKZw OmfXfx37YZwtNge4C9+ex2UtEliBSvMu1I5Y/Fz+PPVs1gD6qXCdZarK9R0TSGPUIghm G3kQ== X-Gm-Message-State: AFqh2kpdu9k6w1qYRujdwn2BMTJtSCdClfyT8driEGr11Nlu4w64jcMS JcOlBmPM0oLHI+8szJ6EjCXY5fiTKOD9R1FQh82sGAyotAz3azDO2WnoSAdaJ9S7apIgrw7A8sT U8YqLaiFQKA8DBmU/JJK/EvSR X-Received: by 2002:a0c:aa07:0:b0:531:9e7a:6778 with SMTP id d7-20020a0caa07000000b005319e7a6778mr72020816qvb.1.1674682001460; Wed, 25 Jan 2023 13:26:41 -0800 (PST) X-Received: by 2002:a0c:aa07:0:b0:531:9e7a:6778 with SMTP id d7-20020a0caa07000000b005319e7a6778mr72020792qvb.1.1674682001182; Wed, 25 Jan 2023 13:26:41 -0800 (PST) Received: from localhost.localdomain.com (024-205-208-113.res.spectrum.com. [24.205.208.113]) by smtp.gmail.com with ESMTPSA id z17-20020ae9c111000000b00706284b74b5sm4173350qki.52.2023.01.25.13.26.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Jan 2023 13:26:40 -0800 (PST) From: Tom Rix To: linus.walleij@linaro.org, brgl@bgdev.pl, thierry.reding@gmail.com, jonathanh@nvidia.com Cc: linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Tom Rix Subject: [PATCH] gpio: tegra186: remove unneeded loop in tegra186_gpio_init_route_mapping() Date: Wed, 25 Jan 2023 13:26:31 -0800 Message-Id: <20230125212631.749094-1-trix@redhat.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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?1756032250946205965?= X-GMAIL-MSGID: =?utf-8?q?1756032250946205965?= Reviewing the j loop over num_irqs_per_bank, in the code previous to the fixes: commit, every j was used. now only when j == 0. If only j == 0 is used, there is no need for the loop. Fixes: 210386804745 ("gpio: tegra186: Support multiple interrupts per bank") Signed-off-by: Tom Rix Acked-by: Thierry Reding --- drivers/gpio/gpio-tegra186.c | 40 ++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c index 9941f35af823..14c872b6ad05 100644 --- a/drivers/gpio/gpio-tegra186.c +++ b/drivers/gpio/gpio-tegra186.c @@ -677,7 +677,7 @@ static const struct of_device_id tegra186_pmc_of_match[] = { static void tegra186_gpio_init_route_mapping(struct tegra_gpio *gpio) { struct device *dev = gpio->gpio.parent; - unsigned int i, j; + unsigned int i; u32 value; for (i = 0; i < gpio->soc->num_ports; i++) { @@ -699,27 +699,23 @@ static void tegra186_gpio_init_route_mapping(struct tegra_gpio *gpio) * On Tegra194 and later, each pin can be routed to one or more * interrupts. */ - for (j = 0; j < gpio->num_irqs_per_bank; j++) { - dev_dbg(dev, "programming default interrupt routing for port %s\n", - port->name); - - offset = TEGRA186_GPIO_INT_ROUTE_MAPPING(p, j); - - /* - * By default we only want to route GPIO pins to IRQ 0. This works - * only under the assumption that we're running as the host kernel - * and hence all GPIO pins are owned by Linux. - * - * For cases where Linux is the guest OS, the hypervisor will have - * to configure the interrupt routing and pass only the valid - * interrupts via device tree. - */ - if (j == 0) { - value = readl(base + offset); - value = BIT(port->pins) - 1; - writel(value, base + offset); - } - } + dev_dbg(dev, "programming default interrupt routing for port %s\n", + port->name); + + offset = TEGRA186_GPIO_INT_ROUTE_MAPPING(p, 0); + + /* + * By default we only want to route GPIO pins to IRQ 0. This works + * only under the assumption that we're running as the host kernel + * and hence all GPIO pins are owned by Linux. + * + * For cases where Linux is the guest OS, the hypervisor will have + * to configure the interrupt routing and pass only the valid + * interrupts via device tree. + */ + value = readl(base + offset); + value = BIT(port->pins) - 1; + writel(value, base + offset); } } }