Re: [PATCH v2 1/2] soundwire: Add a helper function to indicate a device will detach

From: Vinod Koul

Date: Sat Oct 03 2026 - 03:59:37 EST


On 31-08-26, 15:01, Charles Keepax wrote:
> SoundWire devices will sometimes need to reset themselves,
> typical times might include when taking over the device to ensure
> a consistent state or after downloading a firmware update to boot
> into the new version. Often such a reset will also result in the
> device detaching from the SoundWire bus, in this case the driver
> has to be careful. Naively calling sdw_slave_wait_for_init()
> after doing the reset could immediately succeed if the bus hasn't
> seen the detach yet, causing the driver to proceed attempting
> to communicate with the device whilst it is detached.
>
> Add a helper function that a driver can call to indicate it is
> about to initiate an action that will cause the device to detach
> from the bus. This will reinit the completions in the peripheral
> for device attach, ensuring that the next sdw_slave_wait_for_init()
> will not complete before the detach has been seen by the core.

Acked-by: Vinod Koul <vkoul@xxxxxxxxxx>


--
~Vinod