• Takashi Iwai's avatar
    ALSA: hda/i915: Associate audio component with devres · 82887c0b
    Takashi Iwai authored
    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: default avatarTakashi Iwai <tiwai@suse.de>
    82887c0b
hdac_i915.c 12.2 KB