OSDN Git Service

ALSA: hda/i915: Associate audio component with devres
authorTakashi Iwai <tiwai@suse.de>
Wed, 11 Jul 2018 13:48:18 +0000 (15:48 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 17 Jul 2018 20:25:47 +0000 (22:25 +0200)
commit82887c0beb1ee6b33eed8318d8e8d41c5b3eddae
tree884159632784699ff4360d09b32ac51847418edb
parentae891abe7c2ccf75b69ca8330225e37ecc06924e
ALSA: hda/i915: Associate audio component with devres

The HD-audio i915 binding code contains a single pointer, hdac_acomp,
for allowing the access to audio component from the master bind/unbind
callbacks.  This was needed because the callbacks pass only the device
pointer and we can't guarantee the object type assigned to the drvdata
(which is free for each controller driver implementation).
And this implementation will be a problem if we support multiple
components for different DRM drivers, not only i915.

As a solution, allocate the audio component object via devres and
associate it with the given device, so that the component callbacks
can refer to it via devres_find().

The removal of the object is still done half-manually via
devres_destroy() to make the code consistent (although it may work
without the explicit call).

Also, the snd_hda_i915_register_notifier() had the reference to
hdac_acomp as well.  In this patch, the corresponding code is removed
by passing hdac_bus object to the function, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/sound/hda_i915.h
sound/hda/hdac_i915.c
sound/pci/hda/patch_hdmi.c
sound/soc/codecs/hdac_hdmi.c