Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8492356rwp; Wed, 19 Jul 2023 10:31:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlEfmCL3SYQvxRp3F2LdcnCwp3nBhycP2z7WBouQFuWKopM6ZyTv0RyATJsxnQ1GlZtQ9uUK X-Received: by 2002:a05:6a00:2402:b0:679:c1c9:1d34 with SMTP id z2-20020a056a00240200b00679c1c91d34mr18236879pfh.18.1689787866309; Wed, 19 Jul 2023 10:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689787866; cv=none; d=google.com; s=arc-20160816; b=Jzg+zwgtVVbWqN+0CdzxUrMM4a4Vd6zYIFSb0PVsNTsnNwcbajWnG9tobkfQfMdti9 VMVFOJGSeq7pOVfZcqfDMgES4oLt7UZ5kKi3bTK0bGIzZuI/RfUHKf2+8baDY33njTVu 37vuC1FOgTXyGkoBsb5Qn6j26TRTx/AKtseEuKS4JfD1TixiqPiQqoVeGNNt2FO0EOxI +HJHY4y5FOtuuoSoD19tAhk4KDOvEVzNfcDgvgDBk6Hq5Q04xwyn/rEmizor8Jxps6GP CyAn8ftWDKv9RZ9OQd0uNzEMR9LOtRAUd0ZnWgyP8czr47uR5BhH5KJpswrzYkgseubv 31bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=HaIPacWdZ0NT+KFGrfwYp/+v3KLxoL0EV5iokRJ6ajg=; fh=cA0Ln4kADB9MaxBObWf36lXo0Mdqh7yUk2YEczCWWws=; b=zcw96hHvFxFMpFiOJ6khhiUbM+6CTiaUXXzcTo0ApR2ei+Zb59ZnXai84JmirAzl0f LxCry4DhTnRxCJBI6Pe2eDStTeSi/p1472Fjv1f8de5Ts1VHgDX2vziNz7eFOVbUMEcs KNQFNxxR2AxqCb8YdLnn5Fsbz7tzT25I9e0vl6lKWNfLsiheLJeu/0QNae34UeN3S8C6 UAlb+3J89bPVTrK0FgY83M90zWfFKswzKV/2HfCOD3ewbCD7tNzia+YaOEdYl/BKhCWV zCOCsSgyqhLE9bvBRlsqfgB7JGqlLIv8HfOw9WSzIiCegcsoNOtYeoUkW+NrRagnCPxf 7XGw== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 37-20020a630d65000000b0055b28f930a3si3828893pgn.546.2023.07.19.10.30.54; Wed, 19 Jul 2023 10:31:06 -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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbjGSQsK (ORCPT + 99 others); Wed, 19 Jul 2023 12:48:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjGSQsJ (ORCPT ); Wed, 19 Jul 2023 12:48:09 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B66891; Wed, 19 Jul 2023 09:48:08 -0700 (PDT) X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="346825108" X-IronPort-AV: E=Sophos;i="6.01,216,1684825200"; d="scan'208";a="346825108" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2023 09:48:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.01,202,1684825200"; d="scan'208";a="867547426" Received: from smile.fi.intel.com ([10.237.72.54]) by fmsmga001.fm.intel.com with ESMTP; 19 Jul 2023 09:48:05 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1qMALK-001MwS-2U; Wed, 19 Jul 2023 19:48:02 +0300 Date: Wed, 19 Jul 2023 19:48:02 +0300 From: Andy Shevchenko To: Samuel Holland Cc: Linus Walleij , Bartosz Golaszewski , Emil Renner Berthing , Rob Herring , Frank Rowand , Palmer Dabbelt , Paul Walmsley , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v2 2/4] gpio: sifive: Look up IRQs only once during probe Message-ID: References: <20230719163446.1398961-1-samuel.holland@sifive.com> <20230719163446.1398961-3-samuel.holland@sifive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230719163446.1398961-3-samuel.holland@sifive.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Wed, Jul 19, 2023 at 09:34:43AM -0700, Samuel Holland wrote: > of_irq_count(), or eqivalently platform_irq_count(), simply looks up > successively-numbered IRQs until that fails. Since this driver needs to > look up each IRQ anyway to get its virq number, use that existing loop > to count the IRQs at the same time. ... > - ngpio = of_irq_count(node); > - if (ngpio > SIFIVE_GPIO_MAX) { > - dev_err(dev, "Too many GPIO interrupts (max=%d)\n", > - SIFIVE_GPIO_MAX); > - return -ENXIO; Do we still need this check? > - } ... > + for (ngpio = 0; ngpio < SIFIVE_GPIO_MAX; ngpio++) { > + ret = platform_get_irq_optional(pdev, ngpio); > if (ret < 0) > - return ret; > - chip->irq_number[i] = ret; > + break; > + chip->irq_number[ngpio] = ret; > } If so, here we need something like ret = platform_get_irq_optional(pdev, ngpio); if (ret > 0) { dev_err(dev, "Too many GPIO interrupts (max=%d)\n", SIFIVE_GPIO_MAX); return -ENXIO; } Otherwise you need to mention this relaxation in the commit message. -- With Best Regards, Andy Shevchenko