From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Bard Liao <yung-chuan.liao@linux.intel.com>,
Jaroslav Kysela <perex@perex.cz>,
Liam Girdwood <lgirdwood@gmail.com>,
Maciej Strozek <mstrozek@opensource.cirrus.com>,
Mark Brown <broonie@kernel.org>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>,
Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org
Subject: Re: [PATCH] ASoC: soc-dai: don't use dev_{set/get}_drvdata() on DAI
Date: Thu, 5 Mar 2026 13:14:29 +0000 [thread overview]
Message-ID: <aamBtfjzkM7onEfp@opensource.cirrus.com> (raw)
In-Reply-To: <87bjh33uoz.wl-kuninori.morimoto.gx@renesas.com>
On Thu, Mar 05, 2026 at 01:56:44AM +0000, Kuninori Morimoto wrote:
> We have 2 type of driver data set functions.
>
> (A) snd_soc_component_set_drvdata()
> (B) snd_soc_dai_set_drvdata()
>
> Both are using dev_set_drvdata() with own dev
>
> (A) static inline void snd_soc_component_set_drvdata(...)
> {
> dev_set_drvdata(component->dev, data);
> } ^^^^^^^^^^^^^^
>
> (B) static inline void snd_soc_dai_set_drvdata(...)
> {
> dev_set_drvdata(dai->dev, data);
> } ^^^^^^^^
>
> But, these are same dev.
>
> struct snd_soc_dai *snd_soc_register_dai(...)
> {
> (A) struct device *dev = component->dev;
> ...
> (B) dai->dev = dev;
> ...
> }
>
> This means, if (A) and (B) were called in the same time, private data
> will be overwritten.
>
> But, in the same time, commit 5f86d41d0410 ("ASoC: soc-dai: Add private
> data to snd_soc_dai") added dai->priv for private data, and sdca_asoc.c
> is only user of it.
>
> We can re-use this dai->priv for snd_soc_dai_set_drvdata() (B) instead,
> and avoid the issue.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
Hm... the patch looks pretty reasonable to me but does seem to
cause issues on my system. I will try to find some time to
investigate further:
Mar 05 13:06:17.645064 ck-upx-mtl kernel: i915 0000:00:02.0: [drm] *ERROR* DC state mismatch (0x0 -> 0x2)
Mar 05 13:06:17.647247 ck-upx-mtl kernel: BUG: kernel NULL pointer dereference, address: 0000000000000000
Mar 05 13:06:17.647257 ck-upx-mtl kernel: #PF: supervisor read access in kernel mode
Mar 05 13:06:17.647265 ck-upx-mtl kernel: #PF: error_code(0x0000) - not-present page
Mar 05 13:06:17.647270 ck-upx-mtl kernel: PGD 0 P4D 0
Mar 05 13:06:17.647276 ck-upx-mtl kernel: Oops: Oops: 0000 [#1] SMP NOPTI
Mar 05 13:06:17.647281 ck-upx-mtl kernel: CPU: 0 UID: 0 PID: 98 Comm: (udev-worker) Tainted: G E 7.0.0-rc2-mykernel #1 PREEMPT(lazy) Mar 05 13:06:17.647286 ck-upx-mtl kernel: Tainted: [E]=UNSIGNED_MODULE
Mar 05 13:06:17.647291 ck-upx-mtl kernel: Hardware name: AAEON UPX-MTL01/UPX-MTL01, BIOS UXMTAM13 02/13/2025
Mar 05 13:06:17.647295 ck-upx-mtl kernel: RIP: 0010:intel_dmc_update_dc6_allowed_count+0x17/0xb0 [i915]
I wonder if maybe something is mixing these functions and
expecting them to set the same thing?
Thanks,
Charles
next prev parent reply other threads:[~2026-03-05 13:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 1:56 [PATCH] ASoC: soc-dai: don't use dev_{set/get}_drvdata() on DAI Kuninori Morimoto
2026-03-05 13:14 ` Charles Keepax [this message]
2026-03-05 13:34 ` Charles Keepax
2026-03-05 23:59 ` Kuninori Morimoto
2026-03-06 19:44 ` Mark Brown
2026-03-09 2:04 ` Kuninori Morimoto
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=aamBtfjzkM7onEfp@opensource.cirrus.com \
--to=ckeepax@opensource.cirrus.com \
--cc=broonie@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-sound@vger.kernel.org \
--cc=mstrozek@opensource.cirrus.com \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.dev \
--cc=tiwai@suse.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.