[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220126011715.28204-4-yung-chuan.liao@linux.intel.com>
Date: Wed, 26 Jan 2022 09:16:59 +0800
From: Bard Liao <yung-chuan.liao@...ux.intel.com>
To: alsa-devel@...a-project.org, vkoul@...nel.org
Cc: vinod.koul@...aro.org, linux-kernel@...r.kernel.org,
gregkh@...uxfoundation.org, srinivas.kandagatla@...aro.org,
pierre-louis.bossart@...ux.intel.com, sanyog.r.kale@...el.com,
bard.liao@...el.com
Subject: [PATCH 03/19] soundwire: stream: simplify check on port range
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
Pass the index directly to sdw_is_valid_port_range(), this will be
useful for further simplifications.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
Reviewed-by: Rander Wang <rander.wang@...el.com>
Signed-off-by: Bard Liao <yung-chuan.liao@...ux.intel.com>
---
drivers/soundwire/stream.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index a75d3576bfcf..3ac2e5a66700 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -1177,12 +1177,10 @@ static int sdw_config_stream(struct device *dev,
return 0;
}
-static int sdw_is_valid_port_range(struct device *dev,
- struct sdw_port_runtime *p_rt)
+static int sdw_is_valid_port_range(struct device *dev, int num)
{
- if (!SDW_VALID_PORT_RANGE(p_rt->num)) {
- dev_err(dev,
- "SoundWire: Invalid port number :%d\n", p_rt->num);
+ if (!SDW_VALID_PORT_RANGE(num)) {
+ dev_err(dev, "SoundWire: Invalid port number :%d\n", num);
return -EINVAL;
}
@@ -1249,7 +1247,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, p_rt);
+ ret = sdw_is_valid_port_range(&slave->dev, port_config[i].num);
if (ret < 0) {
kfree(p_rt);
return ret;
--
2.17.1
Powered by blists - more mailing lists