From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Mark Brown <broonie@kernel.org>
Cc: lgirdwood@gmail.com, yung-chuan.liao@linux.intel.com,
pierre-louis.bossart@linux.dev, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org, patches@opensource.cirrus.com
Subject: Re: [PATCH v3 2/4] ASoC: SDCA: Populate IRQ data earlier
Date: Mon, 20 Jul 2026 15:31:05 +0100 [thread overview]
Message-ID: <al4xKTNo9+Zm96IM@opensource.cirrus.com> (raw)
In-Reply-To: <5eb4f715-4bbc-4dd7-94b2-6968b1dcd273@sirena.org.uk>
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?
> > @@ -448,21 +448,34 @@ int sdca_irq_populate_early(struct device *dev, struct regmap *regmap,
>
> > + case SDCA_CTL_TYPE_S(GE, DETECTED_MODE):
> > + ret = sdca_jack_alloc_state(interrupt);
> > if (ret)
> > return ret;
> >
> > + interrupt->handler = detected_mode_handler;
> > + break;
>
> > struct sdca_interrupt_info *info)
> >
>
> I'm a bit surprised there's no corresponding change in the cleanup path,
> we're moving the allocation to the device driver not the card but the
> card may be bound and unbound from the device. Perhaps I'm missing
> something?
There is a sneaky:
- kfree(interrupt->name);
At the bottom of the patch.
Thanks,
Charles
next prev parent reply other threads:[~2026-07-20 14:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-16 14:26 [PATCH v3 0/4] Fix races on creation of SDCA jack detection Charles Keepax
2026-07-16 14:26 ` [PATCH v3 1/4] ASoC: Add a component fixup_controls callback Charles Keepax
2026-07-16 14:26 ` [PATCH v3 2/4] ASoC: SDCA: Populate IRQ data earlier Charles Keepax
2026-07-17 20:42 ` Pierre-Louis Bossart
2026-07-20 14:37 ` Charles Keepax
2026-07-20 14:44 ` Pierre-Louis Bossart
2026-07-20 15:02 ` Charles Keepax
2026-07-19 13:24 ` Mark Brown
2026-07-20 14:31 ` Charles Keepax [this message]
2026-07-21 10:30 ` Charles Keepax
2026-07-16 14:26 ` [PATCH v3 3/4] ASoC: SDCA: Add sdca_irq_cleanup_late() Charles Keepax
2026-07-16 14:26 ` [PATCH v3 4/4] ASoC: SDCA: Switch to fixup_controls callback for IRQ registration Charles Keepax
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=al4xKTNo9+Zm96IM@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=patches@opensource.cirrus.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=yung-chuan.liao@linux.intel.com \
/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