Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1990815rwd; Thu, 15 Jun 2023 19:52:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7n1eSqCxAIcu86M6wEnkZctOvyE+Fa30bRNBOuVztK+nXfbm0hUvk6jvl4c8s3dar7nq5i X-Received: by 2002:a05:6214:230c:b0:62b:68bf:7c74 with SMTP id gc12-20020a056214230c00b0062b68bf7c74mr1080214qvb.8.1686883934984; Thu, 15 Jun 2023 19:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686883934; cv=none; d=google.com; s=arc-20160816; b=Pdjvwn9VKA7N1z9wEG8pZ+VZZ/P6grkEPyloVa3nyS9Y4BOvYrI5B6HtPOzHAG9xQl 85/KvsN+HKX63xrNgfXqQYOjpnvBoPdyeFl9C+2zx8jZ4fftr4rvaCbOsIlEJOiW2ewj 9qadBTzBxbpK/GchuNrEZL2SMh4emaE3wi2bJd2neMsJ5+3gKiQ4VDcV0fL8ohPFEFQv Y9MECYI6HtH34GsV0xQ4N4y7Il+kYhTIb/BSUXQWKhzr9YSZVNrp0ANslwUMJMksZEUa tIB7CCYXTdxQ0JJ7cLT+nXjoKr2QED7b9Ke0f92msJyAp6D8gdkHIBq1piIdiNf3vI5d TUDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:thread-index:content-language :content-transfer-encoding:mime-version:message-id:date:subject :in-reply-to:references:cc:to:from; bh=nDxy/rmbhy2zeA1WCvmb1AXzYrDlKf73z2v0gglR9lQ=; b=gj9zzxHksP3TJqDEUZItjr7x9SbBikcknNIXWHbe7wvaOLgYMEssBBgxeiZJjmPXe1 /N9HojBtwnCHfW/1nsxCceU7OHmDHVDZJOtdWZsTfGHH4R+DjXw9nhijVxx3Jem3+I6H f6yaWTsMxBT/z4aW++oUOZVcEMRvNh1pG6Q3pe6iGTL00kqm9SSJYOcTiueRa0be2mMy dKvrMf6QJxHiPQx6Sub47xEZ6/vaW95+vJrsQZzaGmnWNMYGufKW86zWnClbjOPqrYH1 Yh5PvFkOEdOSFlE0Ursle4l73ZNJYXxov9tQDCT8ixZIdS7+UshjNDGtByP7EVzO9y4p WyYA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p30-20020a635b1e000000b005455d1ad59esi11312841pgb.314.2023.06.15.19.52.00; Thu, 15 Jun 2023 19:52:14 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233557AbjFPCM3 convert rfc822-to-8bit (ORCPT + 99 others); Thu, 15 Jun 2023 22:12:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229588AbjFPCM2 (ORCPT ); Thu, 15 Jun 2023 22:12:28 -0400 Received: from smtpbguseast1.qq.com (smtpbguseast1.qq.com [54.204.34.129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAC372965; Thu, 15 Jun 2023 19:12:24 -0700 (PDT) X-QQ-mid: Yeas50t1686881504t089t25183 Received: from 3DB253DBDE8942B29385B9DFB0B7E889 (jiawenwu@trustnetic.com [183.159.171.58]) X-QQ-SSF: 00400000000000F0FPF000000000000 From: =?utf-8?b?Smlhd2VuIFd1?= X-BIZMAIL-ID: 6584627287116177339 To: "'Andy Shevchenko'" , "'Michael Walle'" Cc: , , , , References: <20230607081803.778223-1-jiawenwu@trustnetic.com> <15e2fc098a1e63317368f4812290ca35@walle.cc> <010401d99f6f$26d41600$747c4200$@trustnetic.com> In-Reply-To: Subject: RE: [PATCH v2] gpiolib: Fix GPIO chip IRQ initialization restriction Date: Fri, 16 Jun 2023 10:11:43 +0800 Message-ID: <012b01d99ff7$e51075e0$af3161a0$@trustnetic.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Mailer: Microsoft Outlook 16.0 Content-Language: zh-cn Thread-Index: AQJryWnquP8Y9u98p8GNjzLx69HVGQGrRNiSAZtbv08BxPTBjAH/YNofAf5b6aOuIA5BEA== X-QQ-SENDSIZE: 520 Feedback-ID: Yeas:trustnetic.com:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FROM_EXCESS_BASE64, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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 Thursday, June 15, 2023 9:56 PM, Andy Shevchenko wrote: > On Thu, Jun 15, 2023 at 1:45 PM Michael Walle wrote: > > > BTW, I wonder if it has problems when unregistering gpio-regmap. > > > Call Trace of irq_domain_remove() always exits in my test: > > > https://lore.kernel.org/all/011c01d98d3d$99e6c6e0$cdb454a0$@trustnetic.com/ > > > > > > Of course, it could be because there was something wrong with my > > > test code. But I want to be clear about this. > > > > Mh, you've said you don't use the devm_ variant of > > regmap_add_irq_chip(), > > correct? Do you call regmap_del_irq_chip() yourself? Yes, devm_regmap_del_irq_chip() also led to a call trace. I thought it might be the order of release, so I called it myself without devm_. > > It seems that gpiolib is already removing the domain itself. Mh. > > I guess if the the domain is set via gpiochip_irqchip_add_domain() > > gpiolib must not call irq_domain_remove() because the domain resource > > is handled externally (i.e. gpiolib doesn't allocate the domain > > itself) in our case. > > > > Nice finding! Looks like it has been broken since the beginning > > when I've introduced the gpiochip_irqchip_add_domain(). Will you > > do another fixes patch for that? I used to be rough at fixing in my test, I tried to set gc->irq.domain = NULL after calling irq_domain_remove() in gpiochip_irqchip_remove(). But there seemed to be some other issue that was causing my device to not work, so I didn't go further. I wonder what risks such fix introduces. Sorry I may not be able to do the fix patch for a while. I'm working on other patches, this test will disrupt my work. > > I'm not sure where to store > > that information though. Maybe a new bool "no_domain_free" > > in struct gpio_irq_chip? > > While reading this I also thought about flag, but please use positive > notation, e.g. "irq_domain_is_ext".