Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp448044rwr; Thu, 27 Apr 2023 03:49:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7wkuE1I/HGM9s+0SGy1hNjUSc9bFpdpTacZGNSuEqRj4o2/UpUgRREr4ITMig7fsBVJzfW X-Received: by 2002:a17:90a:15:b0:249:64da:2f41 with SMTP id 21-20020a17090a001500b0024964da2f41mr1325619pja.4.1682592585097; Thu, 27 Apr 2023 03:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682592585; cv=none; d=google.com; s=arc-20160816; b=wm8KCf6KvkZ2N8MHTYmuHlvol4wj6PkAQjYhxuZVo+gJxZYcByWmM9A+rquz98onUR cUpfnZrXdmNBmhmMNZD3YMVSznRTBfYeYuhxnSAYT4lEKYjMStHQVh3XyXXdna8vI63c LTkY6a0dDB3hHL+6iaPAJ/hE2XlLPtdeSyGLYnugnLYHbuPxrIYAVkjD0oeNNhNOwZG/ rrddMtiEUhChLOnkYo7V/gWL2td7hPzdP8eqX3H+S98a+3seGaOkPPB1cRGY/5MU1dkr SwNh1xqpN1ezwgHUP6TiyMIviCLbUpx0YTDLu/JTvqUCDDJxLZijftyAczJumhlJq+A+ S8pA== 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:subject:cc:to:from:date :dkim-signature; bh=kMB0XRCHsuAI2geKD5SmnuVr5s6qo5dyKc/cVU06Qig=; b=dHxeu4mH3A6LbAWxGfKiAvI8EoZ4AFY7mISu5lv7kvPnrkdNdl74naqT1Mn257tGuc iPDGSQj/TAjgVr+b0vO38CscxNypN2l5ErH4LC4harmBA/qXLfFWp/ujacFdrhxEINx1 X0Cn3T088g07OBIQN8TK5eCRck6QdQLkVaMz831UvkOs1L9CtQI/0BrvdkYOT6vgDezC 7Nwu01rSY7J/sX0vzXxxUaOVKBgpBdkMPP0/hxfWfDlU7wQ13Iye7jeFMLb1tL9ARwMR 3VpVJLuoDgDJ4FPJjBnCK0fZT/Lhs7b30TTzGTHh//Ysh931ttGENq64VFTr/U/r1Yao blPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20220719 header.b=7WMB1Oel; 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 np17-20020a17090b4c5100b0024792a548dbsi22681815pjb.126.2023.04.27.03.49.33; Thu, 27 Apr 2023 03:49:45 -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=fail header.i=@kemnade.info header.s=20220719 header.b=7WMB1Oel; 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 S242817AbjD0Khw (ORCPT + 99 others); Thu, 27 Apr 2023 06:37:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243320AbjD0Kht (ORCPT ); Thu, 27 Apr 2023 06:37:49 -0400 Received: from mail.andi.de1.cc (mail.andi.de1.cc [IPv6:2a01:238:4321:8900:456f:ecd6:43e:202c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA92AFF; Thu, 27 Apr 2023 03:37:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20220719; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kMB0XRCHsuAI2geKD5SmnuVr5s6qo5dyKc/cVU06Qig=; b=7WMB1Oele0kgZL8h5FamuK5WvD +52PLwUQuRJanhXYRsv8J8Od/nFA7vRHGld6Jhdq0107Ri2t227KCxnDTU2Y3XuJBpPXKHQWWk2p8 56ajOd5D4aufPWJzcnRnqtDdiiRAquYvmWVvB0rMGNoxhj5QEi87BIZy5bfeGwXwrbrLYhPY3prCh wCKaoqLSOuYUX15ofOI4X30NlHScRDi0UI/TDTAKYNkwirjHQ2NUhvQ+rf7IFa1OL48knQKQ+1CzH dzrAvgx3ElhRR1D9xJuaNEmXMG6UsNBI2U/Dmn8BjVtH+SYtIRNbaaBeVaNAiWm7U2k1rsaCRPjqk LVchktyw==; Received: from p200300ccff1672001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:ff16:7200:1a3d:a2ff:febf:d33a] helo=aktux) by mail.andi.de1.cc with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1prz0I-00010G-Na; Thu, 27 Apr 2023 12:37:34 +0200 Date: Thu, 27 Apr 2023 12:37:33 +0200 From: Andreas Kemnade To: Christophe Leroy Cc: Andy Shevchenko , "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" Subject: Re: [PATCH] gpiolib: fix allocation of mixed dynamic/static GPIOs Message-ID: <20230427123733.15ad4aa3@aktux> In-Reply-To: <52453352-74bd-979f-03b6-322489800538@csgroup.eu> References: <20230426220338.430638-1-andreas@kemnade.info> <52453352-74bd-979f-03b6-322489800538@csgroup.eu> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.24; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.0 (-) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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, 27 Apr 2023 06:20:34 +0000 Christophe Leroy wrote: > Le 27/04/2023 =C3=A0 08:00, Andy Shevchenko a =C3=A9crit=C2=A0: > > On Thu, Apr 27, 2023 at 8:40=E2=80=AFAM Christophe Leroy > > wrote: =20 > >> > >> > >> > >> Le 27/04/2023 =C3=A0 00:03, Andreas Kemnade a =C3=A9crit : =20 > >>> [Vous ne recevez pas souvent de courriers de andreas@kemnade.info. D= =C3=A9couvrez pourquoi ceci est important =C3=A0 https://aka.ms/LearnAboutS= enderIdentification ] > >>> > >>> 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. =20 > >> > >> 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 ? = =20 > >=20 > > 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. =20 >=20 > Ah right, that needs to be fixed. >=20 > >=20 > > 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 >=20 > Yes you are right, that's gdev->base + gdev->ngpio that should be checked. >=20 and that not with simple continue or base might simply stay at DYNAMIC_BASE. I will send a v2 of this patch with refined logic. Regards, Andreas