Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp184414rwr; Wed, 26 Apr 2023 23:05:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4jATOGcNBoSsACtSG+dd9TM7BPqZoDQGOQVaiKX3HWHV92T8zQrmARKgCYrnI7SnbVeeDv X-Received: by 2002:a05:6a20:1610:b0:f6:15f3:ca21 with SMTP id l16-20020a056a20161000b000f615f3ca21mr555488pzj.3.1682575500259; Wed, 26 Apr 2023 23:05:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682575500; cv=none; d=google.com; s=arc-20160816; b=iJGZQdtKKlpb466ZZpkc58i+WWoeAcqeJWOMTHuxbTniWGJDY/8PoTwb0G1JmMOVgv SHtCg0tyTU1toNW+33KFdHMoPz92LTQPRzEtpvi4x77JcU9IXaIo4h9WsO9yyBzkTSz3 X/maJNfrD+5jzgtazlrcIdENPCSprrDtpha1fwTFMgRmf6LyDH/TcR5/D0+q5m76i+fW Ulxci2TZMPrn23qWm6oKGhhcoqy4HFZOHVPoanchiIk8KgBM+RwvgHuHnp8sSjv9R4sN +bJ5TC0avDN6vLrn69FgFRk+RKrG2MRiJ1IhEKsRt5ano+uwDiKkzxleHC+6HY/h6eov sXpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=4X5dFumnuHTw1olZC5sCQAZYfvwwEiFQPwRXUqoQ6Jc=; b=gFXK9yUmwCrfSblQeGZdF0KVjMQQxh7DjAH8fDqYyraJJ71Kl3xQ2zP8fTQGKaM72z wuI4d9iOzudwNMzh/H1XIgyihSf8AxCR6nXFLCM8KOtQPEJoEFF1DK2K2FHzGYur2MWY mtBPog2Sp5hm7KyZ0h7XTQBkU4GisT6ir0kwiSkYPIpBGBFOgytct8jOmhaI3ll2YeT2 Ru8JqMmNdiaEIw5wxXHhoPTCB8BrKbdazRY8Ti53D4c5PprEPepWOHgBJ+f0g1hIMGZU /o4R3qu1zPjagSPQkDk0eiYR0/1mG156BIubYpDpX1oyhKcL20x8pr/NVFzAWvwaVocn CigA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=piONlzZP; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 138-20020a630190000000b005285dff608esi7433028pgb.325.2023.04.26.23.04.48; Wed, 26 Apr 2023 23:05:00 -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=@gmail.com header.s=20221208 header.b=piONlzZP; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242916AbjD0GB1 (ORCPT + 99 others); Thu, 27 Apr 2023 02:01:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242818AbjD0GBZ (ORCPT ); Thu, 27 Apr 2023 02:01:25 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3602A2D41; Wed, 26 Apr 2023 23:01:24 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id af79cd13be357-751319e0dbfso126107185a.0; Wed, 26 Apr 2023 23:01:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682575283; x=1685167283; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=4X5dFumnuHTw1olZC5sCQAZYfvwwEiFQPwRXUqoQ6Jc=; b=piONlzZPG/OEbmOBUlucGOmODP2uxxVnXCyKxE1qKvmZY1KZ4yvotlI+7FypmkCoLZ YrOjl80i0yuGDocKNxNpwijfljTgF5kGOC54g2AlkzvICzpbBcqm90jqGhAR7N2S853Z pFUw/hVchW1LNng4cg4VaJSOfx2hVwT0PgnW8XOY+EyBJkzL1gq/ZafNeHGCgw1+0m0i GdWC3zESCG9BUXx8jCruUGanpNrWkLvFXdrsRbDM1FUaCh85GjgAyMy/Y98iN12tBZYi 6AHs6EdrEtGxxGh4xzXGCpaXihQKaRnpVQMjlPdNBRA0kJRerLyYv4Q+ZHAns2vCqTVa vSAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682575283; x=1685167283; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4X5dFumnuHTw1olZC5sCQAZYfvwwEiFQPwRXUqoQ6Jc=; b=aSB6Z145zYU4jh6yH73qzOOuXe/oS1pjBVfNeXiMzB0yy08D78J0Id5w9W+a+wWlLo Q19IFpXNuqU5BuAbhdN4qsXhf1esPRdDUDBxNJoUrEYG/elP41PXaPircOFHZOeOKyWu c8QOv1DW+EB57DABfGp60dUi1Qw5CvU1vCmdWoEMgqyp0W9bSySVEeh3zIUgCnrn0//0 74jd5tPxzdjJdIrfzWVHSICF9WQn00b2CcKuDo06dNnAopGpBONdAhtcWyuuthlkdXyv s/PI4v2EBzY61B/1tfrUWgDycGXZY6LRLpKQjuebMurMLjL44T2RlcL+XB6uGk7Q6XAa 1Zkg== X-Gm-Message-State: AC+VfDw2kIvL50f306CMoV2SNY8rkCRX4PQIBpUz7jDzvyQ/42n/WR5b YtZZoWZzwxX8cNSrnNddjqzGF4Dz45LnPtruC9o2Anal66mXOA== X-Received: by 2002:a05:6214:300a:b0:5e5:c0c2:c64e with SMTP id ke10-20020a056214300a00b005e5c0c2c64emr7831928qvb.3.1682575283232; Wed, 26 Apr 2023 23:01:23 -0700 (PDT) MIME-Version: 1.0 References: <20230426220338.430638-1-andreas@kemnade.info> In-Reply-To: From: Andy Shevchenko Date: Thu, 27 Apr 2023 09:00:47 +0300 Message-ID: Subject: Re: [PATCH] gpiolib: fix allocation of mixed dynamic/static GPIOs To: Christophe Leroy Cc: Andreas Kemnade , "linus.walleij@linaro.org" , "brgl@bgdev.pl" , "linux-gpio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , ": Tony Lindgren" , Aaro Koskinen , "linux-omap@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 On Thu, Apr 27, 2023 at 8:40=E2=80=AFAM Christophe Leroy wrote: > > > > Le 27/04/2023 =C3=A0 00:03, Andreas Kemnade a =C3=A9crit : > > [Vous ne recevez pas souvent de courriers de andreas@kemnade.info. D=C3= =A9couvrez pourquoi ceci est important =C3=A0 https://aka.ms/LearnAboutSend= erIdentification ] > > > > If static allocation and dynamic allocation GPIOs are present, > > dynamic allocation pollutes the numberspace for static allocation, > > causing static allocation to fail. > > Enfore dynamic allocation above GPIO_DYNAMIC_BASE. > > Hum .... > > Commit 7b61212f2a07 ("gpiolib: Get rid of ARCH_NR_GPIOS") was supposed > to enforce dynamic allocation above GPIO_DYNAMIC_BASE already. > > Can you describe what is going wrong exactly with the above commit ? Above commit only works to the first dynamic allocation, if you need more than one with static ones present it mistakenly will give you a base _below_ DYNAMIC_BASE. However, this change is just PoC I proposed, the conditional and action should be slightly different to cover a corner case, when statically allocated chip overlaps the DYNAMIC_BASE, i.e. gdev->base < DYNAMIC_BASE, while gdev->base + gdev->ngpio >=3D DYNAMIC_BASE. --=20 With Best Regards, Andy Shevchenko