Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3710075rwd; Mon, 29 May 2023 15:40:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Xd3oXMHMh7386TPy4h7Bh8PXsl2p9zHD2gA1LfMXmJK6fePZYdEDrt7cdF1T2buMlIUEH X-Received: by 2002:a05:6a00:1389:b0:645:1081:98ec with SMTP id t9-20020a056a00138900b00645108198ecmr138925pfg.13.1685400040895; Mon, 29 May 2023 15:40:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685400040; cv=none; d=google.com; s=arc-20160816; b=kggtZssnx9wkeT5mUgJLRq0suZooivInHH5VkxsVjl8+ov7s5fCm0WyssHKzG6y1CI aZf1nzNPu2iv6V3QK9Uw5DT4Gkf3iXBmukuvDFrSL4Q297cfMPR1Pi/6OI6ZiXLwnGFm QRbL0Kdbe3IElVl9c3TIxsI7f8gpxHjh+WOB3aKNuGunA0htHNSAjNp9Lhgj9is+ar/b st3jrZxo+IkNqR6y6B9dqd81tQfP9huusJ79I4UmtBpvLK6A6pKDApyy0J276UGTZRra ktEdn98XLqHaR/EBxYczJtKe9DRk61LIHjhp5PEF0NR7q9EGySDFBX1QNJ7hwBS6xp8m d0Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:date:from; bh=t6C85alhOP2JEVGM4O1TdFFuqiMt0xIeJUiCf5GLMP4=; b=zX228UH+ma6jMHnS+6HHEPKL/P1pUq/AKBYSa+a3AJ+P9YtqyJiq9XbElSUHisTTG+ 0Ohy3oxcIVGtfIulV9Bsg0VUstcCXT57/P954G4gbixATQev6crXpXoMcX5AkpI1hF2b 2nqugst7VT3gL3/mYW6N/f4f+qIRhfVkETznWiq/MR0KM7z/q5OqIkh08/wd6xwnYpuO rt7Fk78rE7OsqLRItveNJXb2l7JGuf848IRevK82YPG8o9LUhehLAXxogGdcoZ1nMCbM FQsQ2tAgZKycJqtGO5L0svQXCWKeT9psRbuWiUjLNdtgnQe2ajqYNwKbs86ScxSz358v hStg== 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; dmarc=fail (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 o26-20020aa7979a000000b006434a04f2fcsi411151pfp.297.2023.05.29.15.40.26; Mon, 29 May 2023 15:40:40 -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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229903AbjE2WYh (ORCPT + 99 others); Mon, 29 May 2023 18:24:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbjE2WYg (ORCPT ); Mon, 29 May 2023 18:24:36 -0400 Received: from fgw21-7.mail.saunalahti.fi (fgw21-7.mail.saunalahti.fi [62.142.5.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 548FA92 for ; Mon, 29 May 2023 15:24:35 -0700 (PDT) Received: from localhost (88-113-26-95.elisa-laajakaista.fi [88.113.26.95]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id 94902ba4-fe6f-11ed-abf4-005056bdd08f; Tue, 30 May 2023 01:24:31 +0300 (EEST) From: andy.shevchenko@gmail.com Date: Tue, 30 May 2023 01:24:30 +0300 To: simon.guinot@sequanux.org Cc: Linus Walleij , xingtong_wu@163.com, brgl@bgdev.pl, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, henning.schild@siemens.com, xingtong.wu@siemens.com Subject: Re: [PATCH v2 1/1] gpio-f7188x: fix base values conflicts with other gpio pins Message-ID: References: <20230529025011.2806-1-xingtong_wu@163.com> <20230529025011.2806-2-xingtong_wu@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, May 29, 2023 at 03:54:36PM +0200, simon.guinot@sequanux.org kirjoitti: > On Mon, May 29, 2023 at 03:03:28PM +0200, Linus Walleij wrote: > > On Mon, May 29, 2023 at 2:27 PM wrote: > > > > > It would be nice if a pin number found in the device datasheet could > > > still be converted into a Linux GPIO number by adding the base of the > > > first bank. > > > > We actively discourage this kind of mapping because of reasons stated > > in drivers/gpio/TODO: we want dynamic number allocation to be the > > norm. > > Sure but it would be nice to have a dynamic base applied to a controller > (and not to each chip of this controller), and to respect the interval > between the chips (as stated in the controllers datasheets). What you want is against the architecture. To fix this, you might change the architecture of the driver to have one chip for the controller, but it's quite questionable change. Also how can you guarantee ordering of the enumeration? You probably need to *disable* SMP on the boot time. This will still be fragile as long as GPIO chip can be unbound at run time. Order can be changed. So, the patch is good and the correct way to go. P.S. The root cause is that hardware engineers and documentation writers do not consider their hardware in the multi-tasking, multi-user general purpose operating system, such as Linux. I believe the ideal fix is to fix the documentation (datasheet). -- With Best Regards, Andy Shevchenko