Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2184220rwe; Sun, 28 Aug 2022 05:48:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR4U/YKmWA3teoICmc0+S6bFGptOzPwFhxPO9FUvS9SJLcigX0wYLMRjIq6bjxem+Qu4w9A3 X-Received: by 2002:a17:902:d48a:b0:16f:51a:252a with SMTP id c10-20020a170902d48a00b0016f051a252amr11901982plg.71.1661690916542; Sun, 28 Aug 2022 05:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661690916; cv=none; d=google.com; s=arc-20160816; b=qUptrc521l60PFJ0/oG95S/uO7lhL3todhrUGwaKHwbHoNmh27dnt1taXwAz7iusqR WsBetBoOjVcH3HL3L4/H569d/jEGPezfZBmuH9NJuRXfxZiMnmlL0m4Lz5f8nqPn/1ky 3nD1UyYYbttnd8N1VbFA/FcqvCzWqYVy+NEwOBJqIAgTzqHJIZ6tINEW1WQVMrVwhfzX JNYapf3fdRwYHHyOk7UZpvBmJLjeEphc7QV4b277rwUw+mtxPP8+dgf/25gAXezm0bnq bK/67k+oEIJy/iU3to/RCyTAjB8xDAZsuosv19UMg0h4waBVa31lJliF8Jbl9CDsy7NI ui+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=OdQ+Q9qV3LedSJkQfbn2p7WBBrnXUtBV8MUOTrhaEAY=; b=Pde3nBtRhjZmU1A5oYj9jwWn61iRIklVDu2Pm7IrrDsiSC5bsPOXBKsSseA8zfETSj xAnJm4zISAw8A+JH0Nv+KHCb9OZKUGkN3pqITECBeEKb8vpKmahdwWX8xdkNAOJBynZl jHCpG7MuMyAnVNBfmDIyd27muw2+yBzCZfUmJVva+PqLXx4Z9MIRG6ct/fnnSe9x0PKx hA88dWhxIHXgLxWSxzwXtL6NTdv/yN9ingzY2tllAkGsuaZjSq9PmQlud5bfVyQ2G/eZ 8utymhRd6DQbAN3G4WS12zofaE/Kcbqn+xgufuUHilvbD0mrSw3r/4mcGYpBzMeNc/vE dkDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eeBB52Ce; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gj16-20020a17090b109000b001fd8abd1cdcsi3593466pjb.82.2022.08.28.05.48.25; Sun, 28 Aug 2022 05:48:36 -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=@linaro.org header.s=google header.b=eeBB52Ce; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229563AbiH1LgO (ORCPT + 99 others); Sun, 28 Aug 2022 07:36:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbiH1LgM (ORCPT ); Sun, 28 Aug 2022 07:36:12 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FA684331B for ; Sun, 28 Aug 2022 04:36:10 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id se27so2962928ejb.8 for ; Sun, 28 Aug 2022 04:36:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=OdQ+Q9qV3LedSJkQfbn2p7WBBrnXUtBV8MUOTrhaEAY=; b=eeBB52Ce3r5kR9Dcp27QVPv61AMhihFpTZYjm3DkOv1VJWc6dejpSJHpOYakb68HeB akvqHdPr6RxF7jBUDq/hyyx8Ub1PLDhFD6VA41pYOF5zCY08yz6bbSY4QqUY2VXPDykb xFjRr29B2z700CCN8O0GJOAN29YA33B1RF54Vhm8aAY9vFQyOy+wSKiEAeTyaOH3wLg7 9l7lsS2WzkLlehfx9n6wRdq4L+5Wo5wLhI8erWLJYJZfl0hatDEgJGjjFdCBmAiP4VBc 7Bw+VqNTkYXGlAKQEd8bkrAKeig8lYdFPvJbEW/TdPfkpxjnjqqmlWSXuOEDhGhWR4Eq zA9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=OdQ+Q9qV3LedSJkQfbn2p7WBBrnXUtBV8MUOTrhaEAY=; b=u3IJij/dc9m9sfFaNWXiJpdpxzvybnpoknY/skEOYyOtpUFqXdOMTFeCrhkOTuqZH+ bVeVByVf843qCnVhR42R/+yeSqL5vCkbRoPmfhq6YWIJsWvddepDcI2ocihkbjHIrSoR NfMXeDJzVp/pL2bumKLkeCwKJ38t7AZWS+vAIqd3fC87h3cOVJ6icLxt7lnBvtoKo3OX w06fgOz7wgoVdp+jMeDOyJPVAlFy3n+T1yig9+gHeHd2Yybg9jgrfDKprucDB3MgdZm5 PwFVsgB2eupUon3+9qiTdK0kPsYxnK4SYTejjVDeKrvc7FavONXArb/QwkhaU56kbN07 Uorw== X-Gm-Message-State: ACgBeo0zARgd0ERu7OkhhPG+yGlBFllkAAS4qIb2RgeEYL3kM5o0+wtq rCi4nT2PX8QM4MAxrrDJxUtzcPD5jt1lkN3xDskJFA== X-Received: by 2002:a17:906:cc5a:b0:741:5240:d91a with SMTP id mm26-20020a170906cc5a00b007415240d91amr3390854ejb.500.1661686568986; Sun, 28 Aug 2022 04:36:08 -0700 (PDT) MIME-Version: 1.0 References: <87f2ff4c-3426-201c-df86-2d06d3587a20@csgroup.eu> <515364a9-33a1-fafa-fdce-dc7dbd5bb7fb@csgroup.eu> In-Reply-To: <515364a9-33a1-fafa-fdce-dc7dbd5bb7fb@csgroup.eu> From: Linus Walleij Date: Sun, 28 Aug 2022 13:35:57 +0200 Message-ID: Subject: Re: [PATCH] gpio: Allow user to customise maximum number of GPIOs To: Christophe Leroy Cc: Arnd Bergmann , Alexandre Courbot , Alexandre Courbot , Bartosz Golaszewski , Jonathan Corbet , Russell King , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H. Peter Anvin" , "open list:GPIO SUBSYSTEM" , "open list:DOCUMENTATION" , open list , "moderated list:ARM PORT" , "open list:GENERIC INCLUDE/ASM HEADER FILES" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Sun, Aug 28, 2022 at 11:06 AM Christophe Leroy wrote: > And I guess there might be other drivers like that (I found that one > because of its comment mentionning ARCH_NR_GPIOS. Yes there are a bunch of GPIO controllers with fixed base. These only exist because there is boardfile code that uses these fixed GPIO numbers. > Another solution could be to leave first GPIOs for static allocation, > and allocate dynamic ones from 256 or from 512 ? > > Maybe in two steps: > - First step: Allocate dynamic from 256 upwards and add a pr_warn() for > all static allocations. OK that is reasonable. I thought that maybe we could assume the fixed bases to probe first and thus reserve the GPIO bases they want before we get to the dynamically allocated drivers. This could be a good first step. > - Second step later: Allocate dynamic from 0 and forbid static allocation. What needs to happen for doing that 100% safe is to get rid of all board files, mostly in arch/arm/mach* but also elsewhere, or to augment all boardfiles to use descriptor tables instead. But you're right, try the two step approach first. Yours, Linus Walleij