[PATCH 2/3] soundwire: change sdw_show_ping_status type to int
From: Bard Liao
Date: Tue Sep 15 2026 - 10:35:14 EST
So that the caller can get the ping results.
Signed-off-by: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
Reviewed-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/soundwire/bus.c | 16 +++++++++++-----
include/linux/soundwire/sdw.h | 2 +-
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index b49864ca683a..ee90f7d3233e 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -314,13 +314,16 @@ int sdw_transfer(struct sdw_bus *bus, struct sdw_msg *msg)
* sdw_show_ping_status() - Direct report of PING status, to be used by Peripheral drivers
* @bus: SDW bus
* @sync_delay: Delay before reading status
+ *
+ * returns 0 if there is no peripherals attached, 1 if there are peripherals attached
+ * or a negative error code.
*/
-void sdw_show_ping_status(struct sdw_bus *bus, bool sync_delay)
+int sdw_show_ping_status(struct sdw_bus *bus, bool sync_delay)
{
u32 status;
if (!bus->ops->read_ping_status)
- return;
+ return -ENOTSUPP;
/*
* wait for peripheral to sync if desired. 10-15ms should be more than
@@ -335,10 +338,13 @@ void sdw_show_ping_status(struct sdw_bus *bus, bool sync_delay)
mutex_unlock(&bus->msg_lock);
- if (!status)
+ if (!status) {
dev_warn(bus->dev, "%s: no peripherals attached\n", __func__);
- else
- dev_dbg(bus->dev, "PING status: %#x\n", status);
+ return 0;
+ }
+
+ dev_dbg(bus->dev, "PING status: %#x\n", status);
+ return 1;
}
EXPORT_SYMBOL(sdw_show_ping_status);
diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h
index 0cb7e4fef00e..1b03bfad2e6b 100644
--- a/include/linux/soundwire/sdw.h
+++ b/include/linux/soundwire/sdw.h
@@ -901,7 +901,7 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent,
struct fwnode_handle *fwnode);
void sdw_bus_master_delete(struct sdw_bus *bus);
-void sdw_show_ping_status(struct sdw_bus *bus, bool sync_delay);
+int sdw_show_ping_status(struct sdw_bus *bus, bool sync_delay);
/**
* struct sdw_port_config: Master or Slave Port configuration
--
2.43.0