[PATCH v3] soundwire: bus: demote UNATTACHED slave warnings to dev_dbg

Cole Leavitt posted 1 patch 1 month, 1 week ago
drivers/soundwire/bus.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH v3] soundwire: bus: demote UNATTACHED slave warnings to dev_dbg
Posted by Cole Leavitt 1 month, 1 week ago
The dev_warn() messages in sdw_handle_slave_status() for UNATTACHED
transitions were added in commit d1b328557058 ("soundwire: bus: add
dev_warn() messages to track UNATTACHED devices") to debug attachment
failures with dynamic debug enabled.

These warnings fire during normal operation -- for example when a codec
driver triggers a system reset after firmware download, or during
initial multi-device enumeration due to the PING frame race documented
in cadence_master.c -- producing misleading noise on every boot.

The original debugging use case is fully served by dev_dbg(), which
remains visible when dynamic debug is enabled.  Demote both state
check warnings to dev_dbg().

Fixes: d1b328557058 ("soundwire: bus: add dev_warn() messages to track UNATTACHED devices")
Signed-off-by: Cole Leavitt <cole@unwrap.rs>
---
Changes in v3:
 - Add Fixes tag and version changelog

Changes in v2:
 - Drop unattach_pending flag approach entirely per reviewer feedback
   (Pierre-Louis, Richard, Charles)
 - Simply demote dev_warn() to dev_dbg() unconditionally
 - Single patch instead of 2-patch series

 drivers/soundwire/bus.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index fb68738dfb9b..45234cc07f35 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -1899,8 +1899,8 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
 
 		if (status[i] == SDW_SLAVE_UNATTACHED &&
 		    slave->status != SDW_SLAVE_UNATTACHED) {
-			dev_warn(&slave->dev, "Slave %d state check1: UNATTACHED, status was %d\n",
-				 i, slave->status);
+			dev_dbg(&slave->dev, "Slave %d state check1: UNATTACHED, status was %d\n",
+				i, slave->status);
 			sdw_modify_slave_status(slave, SDW_SLAVE_UNATTACHED);
 
 			/* Ensure driver knows that peripheral unattached */
@@ -1951,8 +1951,8 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
 			if (slave->status == SDW_SLAVE_UNATTACHED)
 				break;
 
-			dev_warn(&slave->dev, "Slave %d state check2: UNATTACHED, status was %d\n",
-				 i, slave->status);
+			dev_dbg(&slave->dev, "Slave %d state check2: UNATTACHED, status was %d\n",
+				i, slave->status);
 
 			sdw_modify_slave_status(slave, SDW_SLAVE_UNATTACHED);
 			break;
-- 
2.52.0
Re: [PATCH v3] soundwire: bus: demote UNATTACHED slave warnings to dev_dbg
Posted by Pierre-Louis Bossart 1 month, 1 week ago
On 2/18/26 15:00, Cole Leavitt wrote:
> The dev_warn() messages in sdw_handle_slave_status() for UNATTACHED
> transitions were added in commit d1b328557058 ("soundwire: bus: add
> dev_warn() messages to track UNATTACHED devices") to debug attachment
> failures with dynamic debug enabled.
> 
> These warnings fire during normal operation -- for example when a codec
> driver triggers a system reset after firmware download, or during
> initial multi-device enumeration due to the PING frame race documented
> in cadence_master.c -- producing misleading noise on every boot.

That second sentence doesn't seem right.
The problem documented in cadence_master.c was that devices may report as ATTACHED at the same time, but the detector only sees one device.
As a result only one of the two devices would be assigned a non-zero device number.
But the second device does not lose sync and never becomes UNATTACHED.

> The original debugging use case is fully served by dev_dbg(), which
> remains visible when dynamic debug is enabled.  Demote both state
> check warnings to dev_dbg().
> 
> Fixes: d1b328557058 ("soundwire: bus: add dev_warn() messages to track UNATTACHED devices")
> Signed-off-by: Cole Leavitt <cole@unwrap.rs>
> ---
> Changes in v3:
>  - Add Fixes tag and version changelog
> 
> Changes in v2:
>  - Drop unattach_pending flag approach entirely per reviewer feedback
>    (Pierre-Louis, Richard, Charles)
>  - Simply demote dev_warn() to dev_dbg() unconditionally
>  - Single patch instead of 2-patch series
> 
>  drivers/soundwire/bus.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
> index fb68738dfb9b..45234cc07f35 100644
> --- a/drivers/soundwire/bus.c
> +++ b/drivers/soundwire/bus.c
> @@ -1899,8 +1899,8 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
>  
>  		if (status[i] == SDW_SLAVE_UNATTACHED &&
>  		    slave->status != SDW_SLAVE_UNATTACHED) {
> -			dev_warn(&slave->dev, "Slave %d state check1: UNATTACHED, status was %d\n",
> -				 i, slave->status);
> +			dev_dbg(&slave->dev, "Slave %d state check1: UNATTACHED, status was %d\n",
> +				i, slave->status);
>  			sdw_modify_slave_status(slave, SDW_SLAVE_UNATTACHED);
>  
>  			/* Ensure driver knows that peripheral unattached */
> @@ -1951,8 +1951,8 @@ int sdw_handle_slave_status(struct sdw_bus *bus,
>  			if (slave->status == SDW_SLAVE_UNATTACHED)
>  				break;
>  
> -			dev_warn(&slave->dev, "Slave %d state check2: UNATTACHED, status was %d\n",
> -				 i, slave->status);
> +			dev_dbg(&slave->dev, "Slave %d state check2: UNATTACHED, status was %d\n",
> +				i, slave->status);
>  
>  			sdw_modify_slave_status(slave, SDW_SLAVE_UNATTACHED);
>  			break;