• Johan Hovold's avatar
    soundwire: fix enumeration completion · c40d6b32
    Johan Hovold authored
    The soundwire subsystem uses two completion structures that allow
    drivers to wait for soundwire device to become enumerated on the bus and
    initialised by their drivers, respectively.
    
    The code implementing the signalling is currently broken as it does not
    signal all current and future waiters and also uses the wrong
    reinitialisation function, which can potentially lead to memory
    corruption if there are still waiters on the queue.
    
    Not signalling future waiters specifically breaks sound card probe
    deferrals as codec drivers can not tell that the soundwire device is
    already attached when being reprobed. Some codec runtime PM
    implementations suffer from similar problems as waiting for enumeration
    during resume can also timeout despite the device already having been
    enumerated.
    
    Fixes: fb9469e5 ("soundwire: bus: fix race condition with enumeration_complete signaling")
    Fixes: a90def06 ("soundwire: bus: fix race condition with initialization_complete signaling")
    Cc: stable@vger.kernel.org      # 5.7
    Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Cc: Rander Wang <rander.wang@linux.intel.com>
    Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
    Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Link: https://lore.kernel.org/r/20230705123018.30903-2-johan+linaro@kernel.orgSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
    c40d6b32
bus.c 48.4 KB