Re: [PATCH] soundwire: only handle alert events when the peripheral is attached
From: Pierre-Louis Bossart
Date: Wed May 20 2026 - 13:38:06 EST
On 5/20/26 04:57, Bard Liao wrote:
> It doesn't make sense to handle an alert event when the peripheral is
> not attached. The slave->status could be SDW_SLAVE_ATTACHED or
> SDW_SLAVE_ALERT when it is attached on the bus.
How would you get an ALERT if the peripheral is not attached in the first place?
The status is only reported in a PING frame after enumeration.
Not following what this new test is needed for...
> Signed-off-by: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx>
> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx>
> ---
> drivers/soundwire/bus.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
> index fe5316d93fef..0490777fa406 100644
> --- a/drivers/soundwire/bus.c
> +++ b/drivers/soundwire/bus.c
> @@ -1958,6 +1958,10 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
> break;
>
> case SDW_SLAVE_ALERT:
> + if (slave->status != SDW_SLAVE_ATTACHED &&
> + slave->status != SDW_SLAVE_ALERT)
> + continue;
> +
> ret = sdw_handle_slave_alerts(slave);
> if (ret < 0)
> dev_err(&slave->dev,