[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241003102806.084367ba@kmaincent-XPS-13-7390>
Date: Thu, 3 Oct 2024 10:28:06 +0200
From: Kory Maincent <kory.maincent@...tlin.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Oleksij Rempel <o.rempel@...gutronix.de>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Jonathan Corbet
<corbet@....net>, Donald Hunter <donald.hunter@...il.com>, Thomas Petazzoni
<thomas.petazzoni@...tlin.com>, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, linux-doc@...r.kernel.org, Kyle Swenson
<kyle.swenson@....tech>, Dent Project <dentproject@...uxfoundation.org>,
kernel@...gutronix.de
Subject: Re: [PATCH net-next 11/12] net: pse-pd: Add support for event
reporting using devm_regulator_irq_helper
On Thu, 3 Oct 2024 01:52:20 +0200
Andrew Lunn <andrew@...n.ch> wrote:
> > +int devm_pse_irq_helper(struct pse_controller_dev *pcdev, int irq,
> > + int irq_flags, int supported_errs,
> > + const struct pse_irq_desc *d)
> > +{
> > + struct regulator_dev **rdevs;
> > + void *irq_helper;
> > + int i;
> > +
> > + rdevs = devm_kcalloc(pcdev->dev, pcdev->nr_lines,
> > + sizeof(struct regulator_dev *), GFP_KERNEL);
> > + if (!rdevs)
> > + return -ENOMEM;
> > +
> > + for (i = 0; i < pcdev->nr_lines; i++)
> > + rdevs[i] = pcdev->pi[i].rdev;
> > +
> > + /* Register notifiers - can fail if IRQ is not given */
> > + irq_helper = devm_regulator_irq_helper(pcdev->dev, d, irq,
> > + 0, supported_errs, NULL,
> > + &rdevs[0],
> > pcdev->nr_lines);
>
> Should irq_flags be passed through? I'm guessing one usage of it will
> be IRQF_SHARED when there is one interrupt shared by a number of
> controllers.
Oh yes, you are right! Thanks for spotting it!
> > From: Kory Maincent (Dent Project) <kory.maincent@...tlin.com>
> >
> > Add support for devm_pse_irq_helper(), a wrapper for
> > devm_regulator_irq_helper(). This aims to report events such as
> > over-current or over-temperature conditions similarly to how the regulator
> > API handles them. Additionally, this patch introduces several define
> > wrappers to keep regulator naming conventions out of PSE drivers.
>
> I'm missing something here, i think.
>
> https://docs.kernel.org/power/regulator/consumer.html#regulator-events
>
> Suggests these are internal events, using a notification chain. How
> does user space get to know about such events?
When events appears, _notifier_call_chain() is called which can generate netlink
messages alongside the internal events:
https://elixir.bootlin.com/linux/v6.11.1/source/drivers/regulator/core.c#L4898
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
Powered by blists - more mailing lists