[RFC PATCH 0/2] ALSA: hda - acomp probe fix for i915

Kai Vehmanen kai.vehmanen at linux.intel.com
Tue Oct 6 13:30:40 CEST 2020


Hi,

this simple bugfix started to feel a bit like getting stuck in quicksand,
so I'm looking for some early input via this RFC series.

Basicly hdac_i915.c should not use global state to track communication
with i915 driver. But how to get handle of "hdac_bus*? I considered
a few options:

  1) add hdac_bus as a member of drm_audio_component.h
	-> seems wrong as this is really an audio side implementation)

  2) embed copy of drm_audio_component to 'struct hdac_bus', so
     I could use container_of() on the device handle to get
     to the bus 
	-> wasted space to keep a copy at hdac_bus level
	   (note: snd-hda-codec-hdmi do this by embedding a copy
	    of ops to "struct hdmi_spec")

  3) add another devres entry to store the hdac_bus directly
     in acomp_init and a new helper function to query it

I now implemented option 3 in this RFC series as it seemed cleanest
and most local to hdac_component.c, where the problem stems from. It's still
somewhat messy, and I'm wondering if I'm overlooking some obvious alternative.
We could dig this deeper into i915 specific code, but OTOH, hdac_bus is
an argument snd_hdac_acomp_init(), so it's common for all.

Kai Vehmanen (2):
  ALSA: hda - keep track of HDA core bus instance in acomp
  ALSA: hda/i915 - fix list corruption with concurrent probes

 include/sound/hda_component.h |  5 +++++
 include/sound/hdaudio.h       |  2 ++
 sound/hda/hdac_component.c    | 34 ++++++++++++++++++++++++++++++++++
 sound/hda/hdac_i915.c         | 16 +++++++++-------
 4 files changed, 50 insertions(+), 7 deletions(-)

-- 
2.28.0


More information about the Alsa-devel mailing list