mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bard Liao <yung-chuan.liao@linux.intel.com>
To: linux-sound@vger.kernel.org, vkoul@kernel.org,
	broonie@kernel.org, tiwai@suse.de
Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org,
	pierre-louis.bossart@linux.dev, peter.ujfalusi@linux.intel.com,
	bard.liao@intel.com
Subject: [PATCH 2/3] soundwire: change sdw_show_ping_status type to int
Date: Tue, 15 Sep 2026 21:13:26 +0800	[thread overview]
Message-ID: <20260915131327.1783551-3-yung-chuan.liao@linux.intel.com> (raw)
In-Reply-To: <20260915131327.1783551-1-yung-chuan.liao@linux.intel.com>

So that the caller can get the ping results.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 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


  parent reply	other threads:[~2026-09-15 13:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 13:13 [PATCH 0/3] ASoC/soundwire: remove ghost peripherals from the mach table Bard Liao
2026-09-15 13:13 ` [PATCH 1/3] soundwire: allow drivers to check whether the peripheral is present Bard Liao
2026-09-15 17:32   ` Cezary Rojewski
2026-09-15 18:31     ` Pierre-Louis Bossart
2026-09-16  2:50       ` Liao, Bard
2026-09-15 13:13 ` Bard Liao [this message]
2026-09-15 13:13 ` [PATCH 3/3] ASoC: SOF: Intel: wait and verifies the presence of SoundWire peripherals Bard Liao
2026-09-15 19:08 ` [PATCH 0/3] ASoC/soundwire: remove ghost peripherals from the mach table Pierre-Louis Bossart
2026-09-16  4:08   ` Liao, Bard
2026-10-07  2:25     ` Liao, Bard
2026-10-07 16:37       ` Pierre-Louis Bossart
2026-10-08  3:14         ` Liao, Bard
2026-10-08 17:09           ` Pierre-Louis Bossart
2026-10-12 14:46             ` Liao, Bard
2026-10-18  8:25               ` Pierre-Louis Bossart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260915131327.1783551-3-yung-chuan.liao@linux.intel.com \
    --to=yung-chuan.liao@linux.intel.com \
    --cc=bard.liao@intel.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@linaro.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®