Re: [PATCH] soundwire: fix pm_runtime_get_sync return code checks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 4/5/19 2:26 AM, Jan Kotas wrote:
When PM is disabled it returns -EACCES, which is currently
threated as an error, and prevents accessing the slave's
registers.

This patch ignores the -EACCES return value from
pm_runtime_get_sync() to let the SoundWire work in systems
without runtime PM.

Signed-off-by: Jan Kotas <jank@xxxxxxxxxxx>
---
  drivers/soundwire/bus.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 1cbfedfc2..6567ff439 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -328,7 +328,7 @@ int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
  		return ret;
ret = pm_runtime_get_sync(slave->bus->dev);
-	if (ret < 0)
+	if (ret < 0 && ret != -EACCES)

There was a patch submitted on 3/28 by Srinivas Kandagatla who suggested an alternate solution for exactly the same code.

+	if (pm_runtime_enabled(slave->bus->dev)) {
+		ret = pm_runtime_get_sync(slave->bus->dev);
+		if (ret < 0)
+			return ret;

I am far from an expert on pm_runtime but Srinivas' solution looks more elegant to me.
-Pierre

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux