On Tue, 06 Oct 2020 13:30:40 +0200, Kai Vehmanen wrote: > > 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 Another option would be to move the completion into the common acomp helper from i915-specific one. That is, - Add bind_complete field into struct drm_audio_component, initialize it at snd_hdac_acomp_init() - Call complete_all(&acomp->bind_complete) at the end of hdac_component_master_bind() - Remove / replace i915's own completion with the hdac's one. The i915_init_ops can be dropped. thanks, Takashi