Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796033496; b=o5dgEGXH4mONFuB0tIAIO/0a245cGmrPohQU9ugDlJdvTLRPFt9qWH5P4JbQ0Cu/oPeL pi/6VkFkXr9lt0oVk5nKOSrNIRkFlFCNyyXdh/6TBR7dSrnwSYAmY1Pjm2inF4bnwoXmj gdcHY9fMzpzlls79fOslUqOV39NfadM9gLgw7WrkxxjVHDrc6zwI2XbEYqefefVZ1QOo9 SbXalocIuXkOfdNgj3SJrSpoGTnY04RQmhlrWQcqq63nLuHOwPS/Wi8PNex9JQihz0Oeh z2eRTKwdebhQyLFqT5s3cvE8zK66kdR0SugaBaM9IHQ4VqHrqeNI1XVxYG87rJQnvyg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796033496; h=Received:DKIM-Signature:Mime-Version:Content-Type:Date:Message-Id: Subject:Cc:From:To:X-Mailer:References:In-Reply-To; bh=vQNDhwRZnt+xP/llk3CJUiyi+0gs1e6Wl6P2mNKzgiw=; b=fB9KQWG3yKBbKlmsP8w/1qMCiEy5GvxeFWcCrOdYIElq7W5vFqWrwTeLOIUvAksc49q5 YhZZlTkLaYsA67ZAXkyg5TVXo63P/NVNpav16ZcEihv2szPUrLexuN2nYKaJn/4LrsUhM XFwEpSOn24ovz1sCaCssjZRrlsL5jJB9VpPWhy0XwEUvH2wZOJzpFScUOJ1P00N9VAcJ9 JEcP/mh9aEdsZRHSepnvGR4hYQHyxtVBt8vkDzCsVKu9Ctu1TrHMU+9w52QtanUD9osA0 qXNuyU0jEO19I7qE5dU3HLmiRyqEWaSqFZDoV00VorW1V/UJMKgPmahlXBjwVW6c5ow== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=H0IWJW21; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with UTF8SMTPS id 7DB49606A31C for ; Mon, 30 Nov 2026 10:11:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=H0IWJW21 Received: by smtp.kernel.org (Postfix) with UTF8SMTPSA id AA4EF1F00896; Mon, 30 Nov 2026 10:11:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796033496; bh=vQNDhwRZnt+xP/llk3CJUiyi+0gs1e6Wl6P2mNKzgiw=; h=Date:Subject:Cc:From:To:References:In-Reply-To; b=H0IWJW21pseHbQGoeTqzutMZefDntzvHz4qxs9pVbz+viZwerr+j1Bgy5cYpSTzG1 Dldhcs6FTuFOxdw+PR6Onkv4PCG8WrAffKt0MGJsapfGFLL5Ruev1C6itQ2aLb48z2 YkeOhAfJeTl88QqFccZlYGrsokeDBc/nGHk2pbscQsNaXPqce5Kx/dZzHauDGTMTu8 QsdXz4mVOWX7ai94FGC9gvn/QJm45oJz1bYljIGut19eg5pWdM75PsSAEVmAzHUUC5 OuUx7RDcPLTsegExfTZXeXxdFXlCES1WEM3OMgFlNvFJyYmd3n4Bl63Ca04CyWEZjy nrVi89T/UzLBw== X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Type: multipart/signed; boundary=3e880f54ac31f98a4cccbd8d91560845270ec5b1517c2b4b5c0cc82cc06b; micalg=pgp-sha384; protocol="application/pgp-signature" Date: Mon, 30 Nov 2026 11:11:31 +0100 Message-Id: Subject: Re: [RFT PATCH 04/13] gpio: axiado-sgpio: create the IRQ domain from the gpio-regmap callback Cc: , From: "Michael Walle" To: "Petar Stepanovic" , "William Breathitt Gray" , "Linus Walleij" , "Bartosz Golaszewski" , "SriNavmani A" , "Prasad Bolisetty" , "Tzu-Hao Wei" , "Karthikeyan Mitran" , "Mathieu Dubois-Briand" , "Lee Jones" , "Andy Shevchenko" , "Long Zhao" , "Joseph Telaak" X-Mailer: aerc 0.20.0 References: <20261126153600.299724-1-mwalle@kernel.org> <20261126153600.299724-5-mwalle@kernel.org> In-Reply-To: --3e880f54ac31f98a4cccbd8d91560845270ec5b1517c2b4b5c0cc82cc06b Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 On Mon Nov 30, 2026 at 10:39 AM CET, Petar Stepanovic wrote: > > On 11/26/2026 4:35 PM, Michael Walle wrote: >> CAUTION: This email originated from outside of the organization. Do not = click links or open attachments unless you recognize the sender and know th= e content is safe. >> >> >> Use the new .create_irq_domain() to actually create the domain. This >> way, there is no window where a NULL pointer could be dereferenced in >> the irq callbacks. >> >> Switch the irq host_data to the gpio_regmap pointer because it will >> already be needed in the irq domain callbacks. Otherwise, the >> .create_irq_domain() callback would have to set the sgpio->gpio pointer >> which looks odd. >> > > Tested on the Axiado AX3005 SoC using an SGPIO hardware loopback setup. > > GPIO read/write operations and rising/falling edge interrupts work as exp= ected. No regressions observed. > > Tested-by: Petar Stepanovic Hi, thanks for the test! In the meantime there was a new version: https://lore.kernel.org/r/20261127145232.814492-1-mwalle@kernel.org/ Could you give that one a test, too? FWIW, I'll address Andy's comment and replace the open coded domain instantiation with irq_domain_create_linear(). Basically this one on top of the v2: ---snip--- --- a/drivers/gpio/gpio-axiado-sgpio.c +++ b/drivers/gpio/gpio-axiado-sgpio.c @@ -476,17 +476,13 @@ static struct irq_domain *axiado_sgpio_create_irq_dom= ain(struct gpio_regmap *gpi { struct axiado_sgpio *sgpio =3D gpio_regmap_get_drvdata(gpio); struct device *dev =3D regmap_get_device(sgpio->regmap); - struct platform_device *pdev =3D to_platform_device(dev); - unsigned int ngpio =3D sgpio->nsignals * 2; - struct irq_domain_info d_info =3D { }; - d_info.fwnode =3D dev_fwnode(&pdev->dev); - d_info.size =3D ngpio; - d_info.hwirq_max =3D ngpio; - d_info.ops =3D &axiado_sgpio_domain_ops; - d_info.host_data =3D gpio; - - sgpio->domain =3D irq_domain_instantiate(&d_info); + sgpio->domain =3D irq_domain_create_linear(dev_fwnode(dev), + sgpio->nsignals * 2, + &axiado_sgpio_domain_ops, + gpio); + if (!sgpio->domain) + return ERR_PTR(-ENOMEM); return sgpio->domain; } ---snip--- -michael --3e880f54ac31f98a4cccbd8d91560845270ec5b1517c2b4b5c0cc82cc06b Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iKgEABMJADAWIQTIVZIcOo5wfU/AngkSJzzuPgIf+AUCaw1L1BIcbXdhbGxlQGtl cm5lbC5vcmcACgkQEic87j4CH/iYFQGAipqNgnmU5Cvj85k4smacDVtJ3rzoAvSu uxDeGO80ZVBWVs4Dh7NBCSunZQvogPf7AX9Fnl1Sinpsln05tBO5y35CTAxk4J4d y+WO2xVNVfABPxanDUGFoCK3WAOB97Pp/n0= =b6Lm -----END PGP SIGNATURE----- --3e880f54ac31f98a4cccbd8d91560845270ec5b1517c2b4b5c0cc82cc06b--