Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2099541rwe; Fri, 2 Sep 2022 08:29:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR4viIJ8wdCDOxeWKggNGMEeJ7V4cSTs4E2LnpMTkVZ6OjOMvC8YWJltlkCzgcsQvwzKv9ju X-Received: by 2002:a17:907:6090:b0:734:be0c:e2e7 with SMTP id ht16-20020a170907609000b00734be0ce2e7mr27973202ejc.408.1662132553856; Fri, 02 Sep 2022 08:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662132553; cv=none; d=google.com; s=arc-20160816; b=vt1d51o0fDjP9YjxRhrN8TPDfjCHw/d2kiZ8Uxs3UJHEeVTFlhyJUMpgFfacj+P/ZG qskWBSDlm0E7NbrdL2fuwi3oep6MpNqLIN1d8rXAlW1MMuphpENwZY60TOM8fJ0a+sbO o2cgkSpHkgmzyznyhYZXyd+24f9LHESmT9QqweeLohQxk0E0mm09dTHqt1rjRdLYeN8R glNTd0tcBCBU3s5+MTEjRVB3kvB6tbIo6JTDIo7s7KO5LVC56+lfNMMvcGGSkdPY6fxV khNFkQ6V6R20nzeBlNPhzklxyJKsgQWSOfSjU2P590UlhmahWVWGunXhs5ttyoKiARxB 5e8A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=X12abLORn97M4eaLMSVBIbAg3wAviw190jy3HFu7dy8=; b=Qm2wwfsm9g/lxN49AHpT7KsLY4Tx/d8c2CAWdix7kLG/lQf3RFGurX59B1BpjkC8Yu lW1XoN8mnJbXUzVFUyYs19P6kJMgWIctWnnya95mXXy4OCZIiwux7y6tsT3Wjax2JuKk j61LBiwfnwtKjSz/62gRf193W+LP3eE5d96DUAJOovwhpQANOT8bmhjkCpDCVoxqnQeU c9CIAKMfvxmi1axXZ9LYYFJVTfqXCEQyLORzkn45L6zE/dcq/NSA2z1QASyMeiKj9Qkl I9RpOQNHoPNYSppWXGE1zhu/qJev3dKizC0XSVMgj//2s7g5xdEWZhXU89HCPGDN+FgC nZsA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i21-20020a170906091500b007419a23eb1dsi1822487ejd.171.2022.09.02.08.28.48; Fri, 02 Sep 2022 08:29:13 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236858AbiIBO4j (ORCPT + 99 others); Fri, 2 Sep 2022 10:56:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236077AbiIBOze (ORCPT ); Fri, 2 Sep 2022 10:55:34 -0400 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08C67474C3; Fri, 2 Sep 2022 07:20:28 -0700 (PDT) Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4MJyHX0zHDz9sl9; Fri, 2 Sep 2022 14:42:48 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hzoaqTT0Wt8f; Fri, 2 Sep 2022 14:42:48 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4MJyHS0LG7z9slc; Fri, 2 Sep 2022 14:42:44 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E83AB8B799; Fri, 2 Sep 2022 14:42:43 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Uvqvxmj-dpQb; Fri, 2 Sep 2022 14:42:43 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [192.168.232.39]) by messagerie.si.c-s.fr (Postfix) with ESMTP id CD1168B78C; Fri, 2 Sep 2022 14:42:42 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (localhost [127.0.0.1]) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.16.1) with ESMTPS id 282CgXQX2141503 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 2 Sep 2022 14:42:33 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 282CgXPR2141491; Fri, 2 Sep 2022 14:42:33 +0200 X-Authentication-Warning: PO20335.IDSI0.si.c-s.fr: chleroy set sender to christophe.leroy@csgroup.eu using -f From: Christophe Leroy To: Linus Walleij , Bartosz Golaszewski , Geert Uytterhoeven , Keerthy , Russell King , Arnd Bergmann , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Catalin Marinas , Will Deacon , Davide Ciminaghi Cc: Christophe Leroy , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, x86@kernel.org, Andy Shevchenko Subject: [PATCH v2 2/9] gpio: aggregator: Stop using ARCH_NR_GPIOS Date: Fri, 2 Sep 2022 14:42:02 +0200 Message-Id: <80c5cc7d6e4ece80bc04624d0ffb0baaf4c60fd1.1662116601.git.christophe.leroy@csgroup.eu> X-Mailer: git-send-email 2.37.1 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1662122526; l=1933; s=20211009; h=from:subject:message-id; bh=SvXFfJQUTO5F5t8Z8RW4iYV2wYbc1i6KFaZMIt1jCf8=; b=7GOMICCCRbK3VzGpu98z1JNJ/vUBCu03igIs5nPyEHfSFh10WagCzkLboqRfpUgNt432RwACW709 DcKm0/GWBIJEcf3X8czamy4jfI3pKnonHQXa++/rYOmCdZFhSsrV X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,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 ARCH_NR_GPIOS is used locally in aggr_parse() as the maximum number of GPIOs to be aggregated together by the driver since commit ec75039d5550 ("gpio: aggregator: Use bitmap_parselist() for parsing GPIO offsets"). Don't rely on the total possible number of GPIOs in the system but define a local arbitrary macro for that, set to 512 which should be large enough as it is also the default value for ARCH_NR_GPIOS. Signed-off-by: Christophe Leroy Reviewed-by: Geert Uytterhoeven Reviewed-by: Andy Shevchenko --- v2: Moved AGGREGATOR_MAX_GPIOS before code --- drivers/gpio/gpio-aggregator.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c index 0cb2664085cf..6d17d262ad91 100644 --- a/drivers/gpio/gpio-aggregator.c +++ b/drivers/gpio/gpio-aggregator.c @@ -23,6 +23,7 @@ #include #include +#define AGGREGATOR_MAX_GPIOS 512 /* * GPIO Aggregator sysfs interface @@ -64,7 +65,7 @@ static int aggr_parse(struct gpio_aggregator *aggr) unsigned int i, n = 0; int error = 0; - bitmap = bitmap_alloc(ARCH_NR_GPIOS, GFP_KERNEL); + bitmap = bitmap_alloc(AGGREGATOR_MAX_GPIOS, GFP_KERNEL); if (!bitmap) return -ENOMEM; @@ -84,13 +85,13 @@ static int aggr_parse(struct gpio_aggregator *aggr) } /* GPIO chip + offset(s) */ - error = bitmap_parselist(offsets, bitmap, ARCH_NR_GPIOS); + error = bitmap_parselist(offsets, bitmap, AGGREGATOR_MAX_GPIOS); if (error) { pr_err("Cannot parse %s: %d\n", offsets, error); goto free_bitmap; } - for_each_set_bit(i, bitmap, ARCH_NR_GPIOS) { + for_each_set_bit(i, bitmap, AGGREGATOR_MAX_GPIOS) { error = aggr_add_gpio(aggr, name, i, &n); if (error) goto free_bitmap; -- 2.37.1