[RFC 2/4] ALSA: hda: convert audio_component member of hdac_bus to void pointer

Peter Ujfalusi peter.ujfalusi at linux.intel.com
Wed Jun 25 14:02:20 UTC 2025


The hdac_bus->audio_component is used as a pointer to a
'struct drm_audio_component' or to 'struct i915_audio_component' while it's
type is 'struct drm_audio_component'.

Convert it to void* to avoid this abuse.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi at linux.intel.com>
---
 include/sound/hdaudio.h    | 2 +-
 sound/hda/hdac_component.c | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h
index 25668eee65cf..4e4317d06ac5 100644
--- a/include/sound/hdaudio.h
+++ b/include/sound/hdaudio.h
@@ -366,7 +366,7 @@ struct hdac_bus {
 	struct mutex lock;
 
 	/* DRM component interface */
-	struct drm_audio_component *audio_component;
+	void *audio_component;
 	long display_power_status;
 	unsigned long display_power_active;
 
diff --git a/sound/hda/hdac_component.c b/sound/hda/hdac_component.c
index 9c82a2864a2f..4842ae0df063 100644
--- a/sound/hda/hdac_component.c
+++ b/sound/hda/hdac_component.c
@@ -252,10 +252,12 @@ static const struct component_master_ops hdac_component_master_ops = {
 int snd_hdac_acomp_register_notifier(struct hdac_bus *bus,
 				    const struct drm_audio_component_audio_ops *aops)
 {
-	if (!bus->audio_component)
+	struct drm_audio_component *acomp = bus->audio_component;
+
+	if (!acomp)
 		return -ENODEV;
 
-	bus->audio_component->audio_ops = aops;
+	acomp->audio_ops = aops;
 	return 0;
 }
 EXPORT_SYMBOL_GPL(snd_hdac_acomp_register_notifier);
-- 
2.50.0



More information about the Intel-gfx-trybot mailing list