* [PATCH] soundwire: return earlier if no slave is attached
@ 2021-01-26 8:54 ` Bard Liao
0 siblings, 0 replies; 4+ messages in thread
From: Bard Liao @ 2021-01-26 8:54 UTC (permalink / raw
To: alsa-devel, vkoul
Cc: pierre-louis.bossart, vinod.koul, gregkh, linux-kernel,
ranjani.sridharan, hui.wang, srinivas.kandagatla, jank,
sanyog.r.kale, rander.wang, bard.liao
From: Chao Song <chao.song@linux.intel.com>
If there is no slave attached to soundwire bus, we
can return earlier from sdw_bus_prep_clk_stop() and
sdw_bus_exit_clk_stop(), this saves a redundant value
check.
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
drivers/soundwire/bus.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 82df088c9333..d9deafdcf495 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -951,17 +951,17 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus)
simple_clk_stop = false;
}
- if (is_slave && !simple_clk_stop) {
+ /* Skip remaining clock stop preparation if no Slave is attached */
+ if (!is_slave)
+ return ret;
+
+ if (!simple_clk_stop) {
ret = sdw_bus_wait_for_clk_prep_deprep(bus,
SDW_BROADCAST_DEV_NUM);
if (ret < 0)
return ret;
}
- /* Don't need to inform slaves if there is no slave attached */
- if (!is_slave)
- return ret;
-
/* Inform slaves that prep is done */
list_for_each_entry(slave, &bus->slaves, node) {
if (!slave->dev_num)
@@ -1075,16 +1075,13 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus)
"clk stop deprep failed:%d", ret);
}
- if (is_slave && !simple_clk_stop)
+ /* Skip remaining clock stop de-preparation if no Slave is attached */
+ if (!is_slave)
+ return 0;
+
+ if (!simple_clk_stop)
sdw_bus_wait_for_clk_prep_deprep(bus, SDW_BROADCAST_DEV_NUM);
- /*
- * Don't need to call slave callback function if there is no slave
- * attached
- */
- if (!is_slave)
- return 0;
-
list_for_each_entry(slave, &bus->slaves, node) {
if (!slave->dev_num)
continue;
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] soundwire: return earlier if no slave is attached
@ 2021-01-26 8:54 ` Bard Liao
0 siblings, 0 replies; 4+ messages in thread
From: Bard Liao @ 2021-01-26 8:54 UTC (permalink / raw
To: alsa-devel, vkoul
Cc: vinod.koul, linux-kernel, gregkh, jank, srinivas.kandagatla,
rander.wang, ranjani.sridharan, hui.wang, pierre-louis.bossart,
sanyog.r.kale, bard.liao
From: Chao Song <chao.song@linux.intel.com>
If there is no slave attached to soundwire bus, we
can return earlier from sdw_bus_prep_clk_stop() and
sdw_bus_exit_clk_stop(), this saves a redundant value
check.
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
drivers/soundwire/bus.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 82df088c9333..d9deafdcf495 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -951,17 +951,17 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus)
simple_clk_stop = false;
}
- if (is_slave && !simple_clk_stop) {
+ /* Skip remaining clock stop preparation if no Slave is attached */
+ if (!is_slave)
+ return ret;
+
+ if (!simple_clk_stop) {
ret = sdw_bus_wait_for_clk_prep_deprep(bus,
SDW_BROADCAST_DEV_NUM);
if (ret < 0)
return ret;
}
- /* Don't need to inform slaves if there is no slave attached */
- if (!is_slave)
- return ret;
-
/* Inform slaves that prep is done */
list_for_each_entry(slave, &bus->slaves, node) {
if (!slave->dev_num)
@@ -1075,16 +1075,13 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus)
"clk stop deprep failed:%d", ret);
}
- if (is_slave && !simple_clk_stop)
+ /* Skip remaining clock stop de-preparation if no Slave is attached */
+ if (!is_slave)
+ return 0;
+
+ if (!simple_clk_stop)
sdw_bus_wait_for_clk_prep_deprep(bus, SDW_BROADCAST_DEV_NUM);
- /*
- * Don't need to call slave callback function if there is no slave
- * attached
- */
- if (!is_slave)
- return 0;
-
list_for_each_entry(slave, &bus->slaves, node) {
if (!slave->dev_num)
continue;
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] soundwire: return earlier if no slave is attached
2021-01-26 8:54 ` Bard Liao
@ 2021-02-01 10:41 ` Vinod Koul
-1 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2021-02-01 10:41 UTC (permalink / raw
To: Bard Liao
Cc: pierre-louis.bossart, alsa-devel, gregkh, linux-kernel,
ranjani.sridharan, hui.wang, srinivas.kandagatla, jank,
sanyog.r.kale, rander.wang, bard.liao
On 26-01-21, 16:54, Bard Liao wrote:
> From: Chao Song <chao.song@linux.intel.com>
>
> If there is no slave attached to soundwire bus, we
> can return earlier from sdw_bus_prep_clk_stop() and
> sdw_bus_exit_clk_stop(), this saves a redundant value
> check.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] soundwire: return earlier if no slave is attached
@ 2021-02-01 10:41 ` Vinod Koul
0 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2021-02-01 10:41 UTC (permalink / raw
To: Bard Liao
Cc: alsa-devel, linux-kernel, gregkh, jank, srinivas.kandagatla,
rander.wang, ranjani.sridharan, hui.wang, pierre-louis.bossart,
sanyog.r.kale, bard.liao
On 26-01-21, 16:54, Bard Liao wrote:
> From: Chao Song <chao.song@linux.intel.com>
>
> If there is no slave attached to soundwire bus, we
> can return earlier from sdw_bus_prep_clk_stop() and
> sdw_bus_exit_clk_stop(), this saves a redundant value
> check.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-02-01 10:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-26 8:54 [PATCH] soundwire: return earlier if no slave is attached Bard Liao
2021-01-26 8:54 ` Bard Liao
2021-02-01 10:41 ` Vinod Koul
2021-02-01 10:41 ` Vinod Koul
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.