From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 480B6606A335 for ; Thu, 3 Dec 2026 10:16:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=evCWXVb5; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=V3WbanqI DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=Jt/DEbkvL0a0Q1ckIjbFkaK6/X3Zto1fIqrD7J7uaAg=; b=evCWXVb5v1lADhU/6HLhE8C1Sp +FordwAfac9Lto+4m1bNyrb56iwDE+LWFoQv6t4Z0UCwGsG+f+RyPEEweLQI2MBymJcA4mspKLicV ZlO+10yPuyA3Jm+odh10/LvKmPPih7ZJOzOaWj71IHCABTIXmOv0gtmvnQQan7HvTsu9cBWNeFk6P nO8SxWMiRHkSlW94fGl7q0i5SctyAcalDGjFWGRtx1ti/318oePplx7o+iM1qdLv+RGCh2bNTdyur 5tcNj5siKlrWqYlLLgBgFhiikXfRYMTUWPStit4plji4Ym3wjQpfF2+84ZZeYv/6+GXps60Ektlbo zKcqDDWA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ3r9-0000000E8ZU-0hBU; Thu, 03 Dec 2026 10:16:03 +0000 Received: from mgamail.intel.com ([198.175.65.17]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xZ3r6-0000000E8Z2-445e for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2026 10:16:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796292961; x=1827828961; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Jt/DEbkvL0a0Q1ckIjbFkaK6/X3Zto1fIqrD7J7uaAg=; b=V3WbanqIlTGDQFVHCUMF7ZFFQkDxbPmIsHn2QuZ+VFgbPf46MwoqWonz 11R6YpaeJxIC8+woAU7rmAPZG4kv3EHpGCqDlrZvDnc5dBeecwvwy/zOh FRvpEIkGnZ8tz+E4xz6IUHYPq4EKPT6O3olYTrBIhVdU4NXnWgJnU/lIy FHjLml4qwB/MrADnWJT9W8LU8PNzbT5xWhFEyoD25SW7/zMZVrQ+jM5A2 6O0Q4mK53rZqxQD9TSsMyrG/pkKzJ2a+tJ7yybYLhvgRQ9c5DFMqNNyfb KCbmIfZQYHTdcFl446nVjmJo+pTD61iRubsFcUPUkoPNZBNun2Mc5I0Uq g==; X-CSE-ConnectionGUID: wVUbJ+JwTPyZVx8Kd/Giqg== X-CSE-MsgGUID: DgwD8L7ySN2fte5shE6WwA== X-IronPort-AV: E=McAfee;i="6800,10657,11984"; a="5253821" X-IronPort-AV: E=Sophos;i="6.27,248,1787036400"; d="scan'208";a="5253821" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 02:15:59 -0800 X-CSE-ConnectionGUID: tpu+ilVkS5GQpr/t/Q132g== X-CSE-MsgGUID: v+Qqd9b+Rkel9A4KfQcUHA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,248,1787036400"; d="scan'208";a="13981277" Received: from inaky-mobl1.amr.corp.intel.com (HELO localhost) ([10.245.244.115]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 02:15:10 -0800 Date: Thu, 3 Dec 2026 12:15:07 +0200 From: Andy Shevchenko To: Michael Walle Cc: William Breathitt Gray , Linus Walleij , Bartosz Golaszewski , Petar Stepanovic , SriNavmani A , Prasad Bolisetty , Tzu-Hao Wei , Karthikeyan Mitran , Mathieu Dubois-Briand , Lee Jones , Long Zhao , Joseph Telaak , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [RFT PATCH v2 06/14] gpio: regmap: add helpers to add a regmap-irq chip Message-ID: References: <20261127145232.814492-1-mwalle@kernel.org> <20261127145232.814492-7-mwalle@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261203_021601_070759_57EF077B X-CRM114-Status: GOOD ( 32.48 ) X-Spam-Score: -4.4 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Mon, Nov 30, 2026 at 11:35:58AM +0100, Michael Walle wrote: > On Fri Nov 27, 2026 at 7:43 PM CET, Andy Shevchenko wrote: > > On Fri, Nov 27, 2026 at 03:52:23PM +0100, Michael Walle wrote: > >> The most common use-case is to use regmap-irq together with gpio-regmap. > >> To make life easier for that and to avoid code duplication, add helpers > >> to create and attach a regmap-irq domain. These helpers are intended to > >> be called by the new .create_irq_domain() callback. > >> > >> gpio_regmap_add_irq_chip() locks the GPIO line while its interrupt is > >> requested. This assumes that the hwirq numbers match the GPIO offsets. > >> If a driver doesn't follow that, there is one without the locking called > >> gpio_regmap_add_irq_chip_nolock(). > > > > Hmm... Can't we simply have a boolean flag instead in GPIO regmap configuration > > and just distinguish it inside the common helper? > > Not sure about that, it has nothing to do with the gpio regmap > itself and would even be ignored if these helpers are not used. So > I'd like to keep it out of the config. > > We could use a boolean argument for the gpio_regmap_add_irq_chip(), > but then you can't use a function pointer. Thinking further, there > might be some driver data just setting this callback. Who knows. > Thus, I've gone that route. OK. Let's see how it will evolve. ... > >> +/** > >> + * gpio_regmap_add_irq_chip_nolock() - Add a regmap-irq chip without line locking > >> + * @gpio: gpio_regmap device > >> + * @irq: the parent interrupt > >> + * @irq_flags: the IRQF_ flags to use for @irq > >> + * @chip: the regmap-irq chip description > >> + * > >> + * Same as gpio_regmap_add_irq_chip() but doesn't lock the GPIO lines. > >> + * Can be used if the hwirq numbers of the regmap-irq chip don't match > >> + * the GPIO offsets. > >> + * > >> + * Return: irq_domain or an ERR_PTR() error value. > > > > Okay, this might justify returning error pointer, but irq_domain_create_*() > > shadows that with NULL, which questions the usefulness of it (the error code). > > I'm fine with either approach but still tend towards using > > irq_domain_create_*() helpers instead their open coded variants. > > I'll go with the irq_domain_create_ helper, but I'm unsure if we > want to drop the ERR_PTR here and instead just return NULL. I'd keep > the ERR_PTR here just in case someone will do more than just call > the domain creation helper. That's why I have no strong opinion, but since the helpers provided by IRQ domain core I believe that the error codes (since they are shadowed in this case) are considered internal granulation and users in general do not need to care about them. > > On the other hand there is no much win, especially if you replace > > > > info = {}; > > > > info.XXX = ...; > > > > ... = irq_domain_instantiate(&info); > > > > with direct assignment as it's done inside irq_domain_create_*(), > > > >> + */ -- With Best Regards, Andy Shevchenko