From patchwork Mon Aug 29 16:15:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 12958148 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4ADFECAAD5 for ; Mon, 29 Aug 2022 16:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=jko9ViSE1nfx+LYLz8BpaZAvnDINJ+lYk1k+Rdl7vlw=; b=YQy56fTeYSnCp9 WlZQUgUJJ2xdimuvxMbyCXpNdrNnBKZ7HPp2OQzKN+5XCZkpc+xqay0G0bt63FJJGovYkocv3Z28R cO2QRVT/spTl4wOaaNMvAalGOU1DVIQg33tst/eKw39/wATAixLaqRSYzPG9GyIMk0h1aH7/SA4g3 dyUs7bu3X6K/m+0SuPMdXnTd5K3hfxUjS2hF1f6AcFmII403ovQX8nysBmrSX/ldiYpW2ENOQcTzF iBPSjwLJ9b/QHmpPLPkrg6YZgbvwxH/MPsNwTWHuhtTzDLmqplTOoSg18RQUk0EvK1T098Ts4ZO0G G163upbqVa7PJoMAaYcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oShUG-00BgqF-Ow; Mon, 29 Aug 2022 16:19:45 +0000 Received: from pegase2.c-s.fr ([93.17.235.10]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oShQN-00BeyS-96 for linux-arm-kernel@lists.infradead.org; Mon, 29 Aug 2022 16:15:45 +0000 Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4MGbBt35PJz9spN; Mon, 29 Aug 2022 18:15:34 +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 fo9r7bRubnDp; Mon, 29 Aug 2022 18:15:34 +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 4MGbBt1d9bz9smN; Mon, 29 Aug 2022 18:15:34 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1FEB18B770; Mon, 29 Aug 2022 18:15:34 +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 G8xiXSUm_EUb; Mon, 29 Aug 2022 18:15:34 +0200 (CEST) Received: from PO20335.IDSI0.si.c-s.fr (unknown [172.25.230.108]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E17AD8B76E; Mon, 29 Aug 2022 18:15:33 +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 27TGFO24988571 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 29 Aug 2022 18:15:24 +0200 Received: (from chleroy@localhost) by PO20335.IDSI0.si.c-s.fr (8.17.1/8.17.1/Submit) id 27TGFMP7988534; Mon, 29 Aug 2022 18:15:22 +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 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 Subject: [PATCH v1 0/8] gpio: Get rid of ARCH_NR_GPIOS (v1) Date: Mon, 29 Aug 2022 18:15:02 +0200 Message-Id: X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1661789703; l=1865; s=20211009; h=from:subject:message-id; bh=Vl/sfiqqYCKPx5L5pTixiJLacXAAcuoC8yRZdP3eXxA=; b=9IH3swSm3id8KIsons/Q3yxValzSB+wJ/4C4y5L9EbH7Udj/av3v2DSHbVZID5OuRevIwV/lp66p WFgDODeFB04IIwVGsiAsAp4v5VACL5hz6QzPeEZcV1ZfsYRuYz/x X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220829_091543_537960_85CE9035 X-CRM114-Status: GOOD ( 12.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since commit 14e85c0e69d5 ("gpio: remove gpio_descs global array") there is no limitation on the number of GPIOs that can be allocated in the system since the allocation is fully dynamic. ARCH_NR_GPIOS is today only used in order to provide downwards gpiobase allocation from that value, while static allocation is performed upwards from 0. However that has the disadvantage of limiting the number of GPIOs that can be registered in the system. To overcome this limitation without requiring each and every platform to provide its 'best-guess' maximum number, rework the allocation to allocate from 256 upwards, allowing approx 2 millions of GPIOs. In the meantime, add a warning for drivers how are still doing static allocation, so that in the future the static allocation gets removed completely and dynamic allocation can start at base 0. Christophe Leroy (8): gpio: aggregator: Stop using ARCH_NR_GPIOS gpio: davinci: Stop using ARCH_NR_GPIOS gpiolib: Warn on drivers still using static gpiobase allocation gpiolib: Get rid of ARCH_NR_GPIOS Documentation: gpio: Remove text about ARCH_NR_GPIOS x86: Remove CONFIG_ARCH_NR_GPIO arm: Remove CONFIG_ARCH_NR_GPIO arm64: Remove CONFIG_ARCH_NR_GPIO Documentation/driver-api/gpio/legacy.rst | 5 --- arch/arm/Kconfig | 21 --------- arch/arm/include/asm/gpio.h | 1 - arch/arm64/Kconfig | 12 ------ arch/x86/Kconfig | 5 --- drivers/gpio/gpio-aggregator.c | 8 ++-- drivers/gpio/gpio-davinci.c | 3 -- drivers/gpio/gpio-sta2x11.c | 5 +-- drivers/gpio/gpiolib.c | 13 +++--- include/asm-generic/gpio.h | 55 +++++++++--------------- 10 files changed, 36 insertions(+), 92 deletions(-) Reviewed-by: Andy Shevchenko Reviewed-by: Andy Shevchenko