From 82887c0beb1ee6b33eed8318d8e8d41c5b3eddae Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 11 Jul 2018 15:48:18 +0200 Subject: 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 --- include/sound/hda_i915.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/sound/hda_i915.h') diff --git a/include/sound/hda_i915.h b/include/sound/hda_i915.h index f69ea84e7b65..648263791559 100644 --- a/include/sound/hda_i915.h +++ b/include/sound/hda_i915.h @@ -17,7 +17,8 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, bool *audio_enabled, char *buffer, int max_bytes); int snd_hdac_i915_init(struct hdac_bus *bus); int snd_hdac_i915_exit(struct hdac_bus *bus); -int snd_hdac_i915_register_notifier(const struct drm_audio_component_audio_ops *); +int snd_hdac_i915_register_notifier(struct hdac_bus *bus, + const struct drm_audio_component_audio_ops *ops); #else static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) { @@ -49,7 +50,8 @@ static inline int snd_hdac_i915_exit(struct hdac_bus *bus) { return 0; } -static inline int snd_hdac_i915_register_notifier(const struct drm_audio_component_audio_ops *ops) +static inline int snd_hdac_i915_register_notifier(struct hdac_bus *bus, + const struct drm_audio_component_audio_ops *ops) { return -ENODEV; } -- cgit v1.2.3-59-g8ed1b