From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA9423BB9F4 for ; Wed, 1 Jul 2026 10:01:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.218.49 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782900110; cv=pass; b=lI7ouaM08W0oQL+sPgJHOYSwfFQvQZCIboVfwJHBOGUEn9TNtR1zs0CictZTyIKi4sHMJvZlX4+z2VTLmnN0FhCljAICOdY/Q38gXd3eRDE8zfyef2GMOpSi9FwdnosEzqeArrPvBtGGPlnmsXFi5YvRcZ5bGMvHv4QiUX3fbYc= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782900110; c=relaxed/simple; bh=NqRmgIDfn8JlBVxfbI6Meg6G6wYP2KKDJWJAgquFHVo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=VcVTZUTl8H/gTlEc/kDfqBLywLa9ew2ViMmSah2QMwgibF2x6kHboXDoyMzXcYxYsUFNt0227sJ5f5aLQ03/ZYObca1ycPJV92802xbbmG6yjVBIuyjfUJhr7nGTuUt62FkHiZ5l5O6BtLsZZEFoWuZ7UUMKubj30+lh07CM/tc= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=luhcVtIx; arc=pass smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="luhcVtIx" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-c1274bedebfso26204366b.2 for ; Wed, 01 Jul 2026 03:01:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1782900107; cv=none; d=google.com; s=arc-20260327; b=namyONwyC8oYtg4QFIcaFi+ISVARy7aVAyGXHt1TbsfrQRD7JC5KKekaMLm4Y3MTE3 F/O5oBbpR67YBBYj9FT9Hc+sDMcvXByp8k2pi0sNHHATlrMA2JzySXDvL9y060vnGhSe 8/FjHvFXbHnadMzPeiJaIzQxN0D/lvSpgsdTMbu/Ukhu1GXeXmwkSUbWQCVj2RkiqhHG Qf6NEFBobQsVJLuZXglFd2DB9VQhr5ZQ97tW9IYixMqmudxXn8rzrSzxL567hAoTNwMU jrCOQHNj30CyzB48PD8CsqHnX/tXHPsHuduyIOegCxIrSqZl3jQtC0MJWDOPY6G7T8yC CDRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NqRmgIDfn8JlBVxfbI6Meg6G6wYP2KKDJWJAgquFHVo=; fh=GK969gniMHU3oHgz1wsEuia/s9vCY2aIoCfccq0EsWQ=; b=FIM+cdqPjaEXX7OOA0EzxpVc2+l/V3w8YKnjocXCTf02peBYsxESnPkTwGnH+v9luu S0+u8WfpPdtS+z+IcZamxRj8ddi1vp2VvejFCAFfVVD7U8hKBZDh1prUSm9/7R0mTyqI pi2o9M0PesvISH8t4ESuL1EDTJp/iYUJMnYucCO95qG/CySpDYk/9zG93aLRM3k+70Fw pFwAp8QLgsH2kh9hhuh3UFvx63gcbOS4HCrcg5L+f3qnG7M1ZTg+zgWIiGOKU9B2iorV K2wyN6N8Vta5XN9r9XGJMq9bLmD5fr3l709S2XNogaxP3nKrN2v6C9SPGNPnh6Q5oYl9 JksA==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782900107; x=1783504907; darn=vger.kernel.org; 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=NqRmgIDfn8JlBVxfbI6Meg6G6wYP2KKDJWJAgquFHVo=; b=luhcVtIxtXDBoC5Se65QYH/Vd6YU0Id1WuYpLuLNfpZBMWEoL4kMwRi8j3syUsn3Dg 1MjgATDpW0X07i2O+IgMiiXB0f9WEcwUre31vcqBwBHDl0Ts7RJw9R94iqFBMm6Hn/6b Lp2GJtsAlD5gj2Aj7AvdfMKVRiKn/inwjX/Ct1uu7Ln7wYIdRMegDBUeNKKDX0CHjh9e tJCBZ9zW7ll94ele9mlSXTJclf73jepdYY1u5aSs6syX5NKskqZI9VTTpViEB957vvmW LrLbPtPnP+MqbNOfWAZyRV6mA+LTKZPnfvflF5XWRCAa/24ru0ROYFIoHTSbsSFxZ+f/ 8wxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782900107; x=1783504907; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NqRmgIDfn8JlBVxfbI6Meg6G6wYP2KKDJWJAgquFHVo=; b=LsPgXp0WglqsVlgfbxdhFxBwrJf2f3rJaDovSdeM7pA8GEq2+LehJs/SfkqcKnJDqH sG3TqGA+BDQre99Y9+Igq0vA5N8zd6s2l39E7pxOlNivh3upftpO+N49iq6fk0TFExg+ 5ovArEdePMdmgX2tRcHnWV/uA6ugojTz5j6ttAFyChOtBBxkB/QTllAcdamYFuU7CpGr BxzAanyLc5Xh6LMmmhCkdXn50R0voZAtnuLmgxrgnYA91K9rWZq7iJ6uUQtD432QL7ZZ QUA4R9uRSAMzFgrC56GgsuwYpEqwV4xPjgX9gWkHEa/CFx/M3W2/sa+TjBd6lAmZXHev YEog== X-Forwarded-Encrypted: i=1; AHgh+RpE0yvAVSGmzuGe3543TGLgVg63DgC/lRGYNm/BEgym7zrogrSL5RucJHhBJlym4iZ7ZZhPdvp7Ku80iBI=@vger.kernel.org X-Gm-Message-State: AOJu0YzG02V8IWKMDSYnejKZzaWVYVqPFyCPSyzzYV4elTa5ptAShLZG gHKZP6HbJKFApU34F0cfIV1EvCssBJm1f399RG5O5HlD2g7ZfhBiLM40bRJ8EhigM28jmYwVoyl b0F2eRhkJYVq9hU94Ecn8dOLifsyCFKw= X-Gm-Gg: AfdE7cn+qWRtOCfY/LuYLBtA+4DaL9GSeuF6vGYG2qp+kahXRn+UyFwzz+kVTehpEuf Co7l1dkMUdJ+JonE1FlSrDQ5FmE5fIj30VqE6PpUl+olYp/Kr9NbRk+nQrZpnymW/luGzCHp6P0 z/tWcB8hE5GiGoVF222zQMPlzxHYvnLgRCNMjQ0JC7Suvf52E5BK63sjg1caQZj9Z4HRN8uv77Z 4u/aSPKZyGNyFmXxfMSuWkvZZqjT/YSkBPqYJ94qqYNNvKLpM54BBTZimRcTveIgFS3huCCvbS9 qrETWBweod+hYCPLJPCu9V/lhHJS9XBDizOiawNkfdEa7IWykF5RXbwTboFg5oFZ48Yw5ms6XvF T4XCeTXfqAlw08cfxpjt9CvZtwIX4/nYBBdMRVikbuNfBxINQjC0ZCbyl9g== X-Received: by 2002:a17:906:b792:b0:c12:7eeb:d2d5 with SMTP id a640c23a62f3a-c12aa1affdamr33696466b.33.1782900106941; Wed, 01 Jul 2026 03:01:46 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260512033317.1602537-1-eleanor.lin@realtek.com> <20260512033317.1602537-3-eleanor.lin@realtek.com> In-Reply-To: From: Andy Shevchenko Date: Wed, 1 Jul 2026 13:01:10 +0300 X-Gm-Features: AVVi8CfOApAIask00J9b0BLe88oz7fAW8fQFHDlsxs93vuIf3dHnb0iovhmAtW4 Message-ID: Subject: Re: [PATCH v3 2/7] gpio: regmap: add gpio_regmap_get_gpiochip() accessor To: Michael Walle Cc: Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "afaerber@suse.com" , "wbg@kernel.org" , "mathieu.dubois-briand@bootlin.com" , "lars@metafoo.de" , "Michael.Hennerich@analog.com" , "jic23@kernel.org" , "nuno.sa@analog.com" , "andy@kernel.org" , "dlechner@baylibre.com" , =?UTF-8?B?VFlfQ2hhbmdb5by15a2Q6YC4XQ==?= , "linux-gpio@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-realtek-soc@lists.infradead.org" , "linux-iio@vger.kernel.org" , =?UTF-8?B?Q1lfSHVhbmdb6buD6Ymm5pmPXQ==?= , =?UTF-8?B?U3RhbmxleSBDaGFuZ1vmmIzogrLlvrdd?= , =?UTF-8?B?SmFtZXMgVGFpIFvmiLTlv5fls7Bd?= , =?UTF-8?B?WXUtQ2h1biBMaW4gW+ael+elkOWQm10=?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jul 1, 2026 at 11:44=E2=80=AFAM Michael Walle w= rote: > On Fri Jun 19, 2026 at 11:08 PM CEST, Linus Walleij wrote: > > On Mon, Jun 8, 2026 at 4:41=E2=80=AFPM Michael Walle wrote: > > > >> >>> Without an accessor like gpio_regmap_get_gpiochip(), we cannot ret= rieve the > >> >>> gpio_chip instantiated inside gpio-regmap.c to fulfill these requi= rements in our > >> >>> map() function. > >> > >> Why is gpiochip_irq_reqres() called in the first place? Isn't that > >> only called if the irq handling is set up via gc->irq.chip and not > >> via gpiochip_irqchip_add_domain() like in gpio-regmap? > > > > Not really, the gpiochip_irq_reqres() is called to mark that a > > GPIO line is used for IRQ, so the gpiolib cannot turn this > > GPIO into an output line, gpiod_direction_out() will fail > > on lines used for IRQ. So it's a failsafe. > > > > You can live without it of course, but then you don't get > > this failsafe. > > Thanks for the explanation! So did I make a mistake years ago by > adding the gpiochip_irqchip_add_domain(), see commit 6a45b0e2589f > ("gpiolib: Introduce gpiochip_irqchip_add_domain()") > > As Yu-Chun found, gpiochip_irq_reqres() expect the irq chip data > to be a gpio_chip, which isn't the case (in general) for an > externally allocated domain, is it? So the whole issue comes from the fact that the IRQ chip is not marked as immutable. For immutable IRQ chips (which all GPIO provides should have) there is no such issue to begin with, id est there is no gpiochip_irq_reqres() callback assigned (and respective _relres). -- With Best Regards, Andy Shevchenko