Re: [PATCH v3 2/4] ASoC: SDCA: Populate IRQ data earlier

From: Charles Keepax

Date: Tue Jul 21 2026 - 06:36:37 EST


On Mon, Jul 20, 2026 at 03:31:05PM +0100, Charles Keepax wrote:
> On Sun, Jul 19, 2026 at 02:24:26PM +0100, Mark Brown wrote:
> > On Thu, Jul 16, 2026 at 03:26:37PM +0100, Charles Keepax wrote:
> > > Currently, the IRQ data (attached Entity/Control/etc) is populated
> > > as the IRQ is requested. However, this can cause issues as
> > > occasionally the setup process wants to access specifics of
> > > an IRQ before the IRQ is actually enabled. To facilitate this
> > > cache all the IRQ data during sdca_irq_populate_early() and make
> > > sdca_irq_populate() simply request the outstanding IRQs. This
> > > also has the advantage that sdca_irq_populate() can now just
> > > iterate through the IRQ array which is much smaller/faster than
> > > going through every Entity in the Function for Controls.
> >
> > > --- a/sound/soc/sdca/sdca_interrupts.c
> > > +++ b/sound/soc/sdca/sdca_interrupts.c
> > > @@ -375,7 +375,7 @@ int sdca_irq_data_populate(struct device *dev, struct regmap *regmap,
> > > if (!dev)
> > > return -ENODEV;
> > >
> > > - name = kasprintf(GFP_KERNEL, "%s %s", entity->label, control->label);
> > > + name = devm_kasprintf(dev, GFP_KERNEL, "%s %s", entity->label, control->label);
> > > if (!name)
> > > return -ENOMEM;
> > >
> >
> > Moving to devm_ makes me a bit nervous.
>
> Moving to devm should be good here. The expectation is that
> sdca_irq_populate_early() is called from device probe and this
> moves all the allocations into there. Even before this series
> we had devm_ allocations being done by sdca_fdl_alloc_state(),
> so the requirement to call sdca_irq_populate_early() from device
> probe already existed.
>
> With the split of the cleanup into two steps though, we could
> move everything onto manually allocations and clean them up there
> if we felt this was a little too hidden behind the API? Or
> document it more in the kernel doc I guess?

Ok looking at the patch Pierre pointed me at I think maybe it is
best to update this to not use devm. Will provide slightly more
flexibility for the calling drivers, its fine for the class
driver as is but people are doing quite custom stuff outside of
that.

I will do a respin of the series later today.

Thanks,
Charles