Skip to contentSkip to conversation

soundwire: bus: suppress probe deferral errors

PATCH In review Johan Hovold 2 participants 6 messages Jul 12, 2024 – Jul 15, 2024 SoundWire

lore
Share & tools
lore
#0 lore raw

v3 cover soundwire: bus: suppress probe deferral errors

The soundwire bus code is incorrectly logging probe deferrals as errors.

This series addresses that, cleans up the soundwire bus logging and drops the unused soudwire driver name field.

Vinod, I booted linux-next yesterday and realised that these bogus error messages are still spamming the logs when booting x1e80100 and making it harder to see the valid warnings (which there were too many of). Would be nice to have this fixed in 6.11:

[   18.815950] wsa884x-codec sdw:4:0:0217:0204:00:0: Probe of wsa884x-codec failed: -517
[   18.825093] wsa884x-codec sdw:1:0:0217:0204:00:0: Probe of wsa884x-codec failed: -517
[   18.832335] wsa884x-codec sdw:4:0:0217:0204:00:1: Probe of wsa884x-codec failed: -517
[   18.840870] wsa884x-codec sdw:1:0:0217:0204:00:1: Probe of wsa884x-codec failed: -517
[   18.848463] wsa884x-codec sdw:1:0:0217:0204:00:0: Probe of wsa884x-codec failed: -517

Johan

Changes in v3
- amend the update status error message with "at probe" to make it more descriptive (it's already unique)
- drop the patch dropping a probe debug message

Changes in v2
- drop probe error message completely
- drop soundwire driver name field
- cleanup probe warning messages
- drop probe debug message

Johan Hovold (3):
soundwire: bus: suppress probe deferral errors
soundwire: bus: drop unused driver name field
soundwire: bus: clean up probe warnings

 drivers/soundwire/bus_type.c  | 19 ++++---------------
 include/linux/soundwire/sdw.h |  2 --
 2 files changed, 4 insertions(+), 17 deletions(-)
Signature · 1 line
2.44.2
#1 lore raw

PATCH v3 1/3 soundwire: bus: suppress probe deferral errors

Soundwire driver probe errors are currently being logged both by the bus code and driver core:

	wsa884x-codec sdw:4:0:0217:0204:00:0: Probe of wsa884x-codec failed: -12
	wsa884x-codec sdw:4:0:0217:0204:00:0: probe with driver wsa884x-codec failed with error -12

Drop the redundant bus error message, which is also incorrectly being logged on probe deferral:

	wsa884x-codec sdw:4:0:0217:0204:00:0: Probe of wsa884x-codec failed: -517

Note that no soundwire driver uses the driver struct name field, which will be removed by a follow-on change.

---
 drivers/soundwire/bus_type.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/soundwire/bus_type.c +0 -6
index c32faace618f..85fa5970d98a 100644
@@ -83,7 +83,6 @@ static int sdw_drv_probe(struct device *dev)
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct sdw_driver *drv = drv_to_sdw_driver(dev->driver);
 	const struct sdw_device_id *id;
-	const char *name;
 	int ret;
 
 	/*
@@ -108,11 +107,6 @@ static int sdw_drv_probe(struct device *dev)
 
 	ret = drv->probe(slave, id);
 	if (ret) {
-		name = drv->name;
-		if (!name)
-			name = drv->driver.name;
-
-		dev_err(dev, "Probe of %s failed: %d\n", name, ret);
 		dev_pm_domain_detach(dev, false);
 		return ret;
 	}
Signature · 1 line
2.44.2
Reviewed-by on v3 1/3
#2 lore raw
Quoted 9 lines · Johan Hovold

Soundwire driver probe errors are currently being logged both by the bus code and driver core:

	wsa884x-codec sdw:4:0:0217:0204:00:0: Probe of wsa884x-codec failed: -12
	wsa884x-codec sdw:4:0:0217:0204:00:0: probe with driver wsa884x-codec failed with error -12

Drop the redundant bus error message, which is also incorrectly being logged on probe deferral:

Quoted 6 lines
	wsa884x-codec sdw:4:0:0217:0204:00:0: Probe of wsa884x-codec failed: -517

Note that no soundwire driver uses the driver struct name field, which will be removed by a follow-on change.

Quoted 28 lines
---
 drivers/soundwire/bus_type.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/soundwire/bus_type.c +0 -6
index c32faace618f..85fa5970d98a 100644
@@ -83,7 +83,6 @@ static int sdw_drv_probe(struct device *dev)
 	struct sdw_slave *slave = dev_to_sdw_dev(dev);
 	struct sdw_driver *drv = drv_to_sdw_driver(dev->driver);
 	const struct sdw_device_id *id;
-	const char *name;
 	int ret;
 
 	/*
@@ -108,11 +107,6 @@ static int sdw_drv_probe(struct device *dev)
 
 	ret = drv->probe(slave, id);
 	if (ret) {
-		name = drv->name;
-		if (!name)
-			name = drv->driver.name;
-
-		dev_err(dev, "Probe of %s failed: %d\n", name, ret);
 		dev_pm_domain_detach(dev, false);
 		return ret;
 	}
#3 lore raw

PATCH v3 2/3 soundwire: bus: drop unused driver name field

In reply to Johan Hovold

The soundwire driver name field is not currently used by any driver (and even appears to never have been used) so drop it.

---
 drivers/soundwire/bus_type.c  | 9 ++-------
 include/linux/soundwire/sdw.h | 2 --
 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/soundwire/bus_type.c +2 -7
index 85fa5970d98a..3979be0f8b65 100644
@@ -198,16 +198,11 @@ static void sdw_drv_shutdown(struct device *dev)
  */
 int __sdw_register_driver(struct sdw_driver *drv, struct module *owner)
 {
-	const char *name;
-
 	drv->driver.bus = &sdw_bus_type;
 
 	if (!drv->probe) {
-		name = drv->name;
-		if (!name)
-			name = drv->driver.name;
-
-		pr_err("driver %s didn't provide SDW probe routine\n", name);
+		pr_err("driver %s didn't provide SDW probe routine\n",
+				drv->driver.name);
 		return -EINVAL;
 	}
 
include/linux/soundwire/sdw.h +0 -2
index 13e96d8b7423..5e133dfec8f2 100644
@@ -704,8 +704,6 @@ struct sdw_master_device {
 	container_of(d, struct sdw_master_device, dev)
 
 struct sdw_driver {
-	const char *name;
-
 	int (*probe)(struct sdw_slave *sdw,
 			const struct sdw_device_id *id);
 	int (*remove)(struct sdw_slave *sdw);
Signature · 1 line
2.44.2
Reviewed-by on v3 2/3
#4 lore raw

Re: [PATCH v3 2/3] soundwire: bus: drop unused driver name field

Quoted 4 lines · Johan Hovold

The soundwire driver name field is not currently used by any driver (and even appears to never have been used) so drop it.

Quoted 41 lines
---
 drivers/soundwire/bus_type.c  | 9 ++-------
 include/linux/soundwire/sdw.h | 2 --
 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/soundwire/bus_type.c +2 -7
index 85fa5970d98a..3979be0f8b65 100644
@@ -198,16 +198,11 @@ static void sdw_drv_shutdown(struct device *dev)
  */
 int __sdw_register_driver(struct sdw_driver *drv, struct module *owner)
 {
-	const char *name;
-
 	drv->driver.bus = &sdw_bus_type;
 
 	if (!drv->probe) {
-		name = drv->name;
-		if (!name)
-			name = drv->driver.name;
-
-		pr_err("driver %s didn't provide SDW probe routine\n", name);
+		pr_err("driver %s didn't provide SDW probe routine\n",
+				drv->driver.name);
 		return -EINVAL;
 	}
 
include/linux/soundwire/sdw.h +0 -2
index 13e96d8b7423..5e133dfec8f2 100644
@@ -704,8 +704,6 @@ struct sdw_master_device {
 	container_of(d, struct sdw_master_device, dev)
 
 struct sdw_driver {
-	const char *name;
-
 	int (*probe)(struct sdw_slave *sdw,
 			const struct sdw_device_id *id);
 	int (*remove)(struct sdw_slave *sdw);
#5 lore raw

PATCH v3 3/3 soundwire: bus: clean up probe warnings

In reply to Johan Hovold

Clean up the probe warning messages by using a common succinct and greppable format (e.g. without __func__ and with a space after ':').

---
 drivers/soundwire/bus_type.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soundwire/bus_type.c +2 -2
index 3979be0f8b65..3930b245008d 100644
@@ -123,7 +123,7 @@ static int sdw_drv_probe(struct device *dev)
 	/* init the dynamic sysfs attributes we need */
 	ret = sdw_slave_sysfs_dpn_init(slave);
 	if (ret < 0)
-		dev_warn(dev, "Slave sysfs init failed:%d\n", ret);
+		dev_warn(dev, "failed to initialise sysfs: %d\n", ret);
 
 	/*
 	 * Check for valid clk_stop_timeout, use DisCo worst case value of
@@ -147,7 +147,7 @@ static int sdw_drv_probe(struct device *dev)
 	if (drv->ops && drv->ops->update_status) {
 		ret = drv->ops->update_status(slave, slave->status);
 		if (ret < 0)
-			dev_warn(dev, "%s: update_status failed with status %d\n", __func__, ret);
+			dev_warn(dev, "failed to update status at probe: %d\n", ret);
 	}
 
 	mutex_unlock(&slave->sdw_dev_lock);
Signature · 1 line
2.44.2