Blob Blame History Raw
From 4bbd6d55a6789e99e74df96cb87a4ed29bbf7f7f Mon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Date: Wed, 26 Jan 2022 09:17:03 +0800
Subject: [PATCH] soundwire: stream: add 'slave' prefix for port range checks
Git-commit: 4bbd6d55a6789e99e74df96cb87a4ed29bbf7f7f
Patch-mainline: v5.18-rc1
References: jsc#PED-850

We can only check for Slave port ranges, the ports are not defined at
the Master level. Also move the function to the 'slave port' block.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220126011715.28204-8-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/soundwire/stream.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index e3cb55de0d12..c326298a0fe2 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -1208,16 +1208,6 @@ static int sdw_config_stream(struct device *dev,
 	return 0;
 }
 
-static int sdw_is_valid_port_range(struct device *dev, int num)
-{
-	if (!SDW_VALID_PORT_RANGE(num)) {
-		dev_err(dev, "SoundWire: Invalid port number :%d\n", num);
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
 static int sdw_master_port_alloc(struct sdw_master_runtime *m_rt,
 				 unsigned int num_ports)
 {
@@ -1269,6 +1259,16 @@ static int sdw_slave_port_alloc(struct sdw_slave *slave,
 	return 0;
 }
 
+static int sdw_slave_port_is_valid_range(struct device *dev, int num)
+{
+	if (!SDW_VALID_PORT_RANGE(num)) {
+		dev_err(dev, "SoundWire: Invalid port number :%d\n", num);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 static int sdw_slave_port_config(struct sdw_slave *slave,
 				 struct sdw_slave_runtime *s_rt,
 				 struct sdw_port_config *port_config)
@@ -1283,7 +1283,7 @@ static int sdw_slave_port_config(struct sdw_slave *slave,
 		 * TODO: Check valid port range as defined by DisCo/
 		 * slave
 		 */
-		ret = sdw_is_valid_port_range(&slave->dev, port_config[i].num);
+		ret = sdw_slave_port_is_valid_range(&slave->dev, port_config[i].num);
 		if (ret < 0)
 			return ret;
 
-- 
2.35.3