Devicetree
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: "Alvin Šipraga" <alvin@pqrs.dk>
Cc: Guenter Roeck <linux@roeck-us.net>, Lee Jones <lee@kernel.org>,
	Linus Walleij <linusw@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Peter Rosin <peda@axentia.se>,
	David Jander <david@protonic.nl>,
	kernel@pengutronix.de, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH v15 4/6] pinctrl: add NXP MC33978/MC34978 pinctrl driver
Date: Sat, 11 Jul 2026 07:21:14 +0200	[thread overview]
Message-ID: <alHSylCU0RISGVn-@pengutronix.de> (raw)
In-Reply-To: <alEKklx_X4cP3Ire@pqrs.dk>

Hi Alvin,

On Fri, Jul 10, 2026 at 05:22:30PM +0200, Alvin Šipraga wrote:
> Hi Oleksij,
> 
> On Fri, Jul 10, 2026 at 12:13:53PM +0200, Oleksij Rempel wrote:
> > +/*
> > + * Defensive wrappers for hierarchical IRQ proxying.
> > + *
> > + * gpiolib's hierarchical allocation exposes a lifecycle gap: the child
> > + * descriptor is registered before irq_domain_alloc_irqs_parent() fully
> > + * instantiates the parent chip.
> > + *
> > + * During consumer probe (e.g., gpiod_to_irq()), irq_create_fwspec_mapping()
> > + * allocates the hierarchy. As part of this, irq_domain_set_info() initializes
> > + * the top-level irq_desc and calls __irq_set_handler(). If the irq_desc
> > + * requires locking, __irq_get_desc_lock() will invoke the child's
> > + * .irq_bus_lock before the parent allocation is complete.
> > + *
> > + * Upstream generic helpers (e.g., irq_chip_mask_parent) blindly dereference
> > + * data->parent_data->chip, causing an immediate NULL pointer panic during
> > + * this gap. These wrappers check for a valid parent chip to safely drop
> > + * premature locking or masking events while the legacy subsystem hierarchy
> > + * is still assembling itself.
> > + */
> 
> I encountered the same problem while working on a pinctrl/GPIO driver
> this week. While searching lore to see if I'm doing it wrong, I found
> this series. Such wrappers fix the problem for me too (although in my
> case, it's not a slow bus, so it crashes in .irq_mask instead of
> .irq_bus_lock).
> 
> But I see that in a previous version, you were reordering things in
> gpiochip_hierarchy_irq_domain_alloc(). Why did you abandon this
> approach?
> 
> Just wondering if we can find a more generic solution which doesn't
> require such drivers to add this defensive boilerplate. Another option
> might be to move such checks into the generic helpers.

My previous attempts to address it in the core were simply too fragile
and caused other regressions.

To be honest, I have already run out of budget for this task. A lot of
that time was spent just learning how to deal with the new upstreaming
reality. With sashiko.dev, it is much harder to upstream any moderate to
large amount of code now. You either have to use public sashiko and spam
everyone until all issues are addressed, or learn to set up and use your
own sashiko instance.

Because of that, these driver-level wrappers are the most practical way
forward for me right now.

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2026-07-11  5:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 10:13 [PATCH v15 0/6] mfd: Add support for NXP MC33978/MC34978 MSDI Oleksij Rempel
2026-07-10 10:13 ` [PATCH v15 1/6] dt-bindings: pinctrl: add " Oleksij Rempel
2026-07-10 10:19   ` sashiko-bot
2026-07-10 10:13 ` [PATCH v15 2/6] platform: misc: add NXP MC33978/MC34978 core driver Oleksij Rempel
2026-07-10 10:24   ` sashiko-bot
2026-07-10 10:13 ` [PATCH v15 3/6] mfd: mc33978: Add NXP MC33978/MC34978 MSDI support Oleksij Rempel
2026-07-10 10:25   ` sashiko-bot
2026-07-10 10:13 ` [PATCH v15 4/6] pinctrl: add NXP MC33978/MC34978 pinctrl driver Oleksij Rempel
2026-07-10 10:27   ` sashiko-bot
2026-07-10 15:22   ` Alvin Šipraga
2026-07-11  5:21     ` Oleksij Rempel [this message]
2026-07-10 10:13 ` [PATCH v15 5/6] hwmon: add NXP MC33978/MC34978 driver Oleksij Rempel
2026-07-10 10:23   ` sashiko-bot
2026-07-10 10:13 ` [PATCH v15 6/6] mux: add NXP MC33978/MC34978 AMUX driver Oleksij Rempel
2026-07-10 10:25   ` sashiko-bot
2026-07-10 12:53   ` Alvin Šipraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alHSylCU0RISGVn-@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=alvin@pqrs.dk \
    --cc=conor+dt@kernel.org \
    --cc=david@protonic.nl \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=peda@axentia.se \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox