[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190725234032.21152-18-pierre-louis.bossart@linux.intel.com>
Date: Thu, 25 Jul 2019 18:40:09 -0500
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: alsa-devel@...a-project.org
Cc: linux-kernel@...r.kernel.org, tiwai@...e.de, broonie@...nel.org,
vkoul@...nel.org, gregkh@...uxfoundation.org, jank@...ence.com,
srinivas.kandagatla@...aro.org, slawomir.blauciak@...el.com,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Sanyog Kale <sanyog.r.kale@...el.com>
Subject: [RFC PATCH 17/40] soundwire: bus: use runtime_pm_get_sync/pm when enabled
Not all platforms support runtime_pm for now, let's use runtime_pm
only when enabled.
Suggested-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
---
drivers/soundwire/bus.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c
index 5ad4109dc72f..0a45dc5713df 100644
--- a/drivers/soundwire/bus.c
+++ b/drivers/soundwire/bus.c
@@ -332,12 +332,16 @@ int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
if (ret < 0)
return ret;
- ret = pm_runtime_get_sync(slave->bus->dev);
- if (ret < 0)
- return ret;
+ if (pm_runtime_enabled(slave->bus->dev)) {
+ ret = pm_runtime_get_sync(slave->bus->dev);
+ if (ret < 0)
+ return ret;
+ }
ret = sdw_transfer(slave->bus, &msg);
- pm_runtime_put(slave->bus->dev);
+
+ if (pm_runtime_enabled(slave->bus->dev))
+ pm_runtime_put(slave->bus->dev);
return ret;
}
@@ -359,13 +363,16 @@ int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
slave->dev_num, SDW_MSG_FLAG_WRITE, val);
if (ret < 0)
return ret;
-
- ret = pm_runtime_get_sync(slave->bus->dev);
- if (ret < 0)
- return ret;
+ if (pm_runtime_enabled(slave->bus->dev)) {
+ ret = pm_runtime_get_sync(slave->bus->dev);
+ if (ret < 0)
+ return ret;
+ }
ret = sdw_transfer(slave->bus, &msg);
- pm_runtime_put(slave->bus->dev);
+
+ if (pm_runtime_enabled(slave->bus->dev))
+ pm_runtime_put(slave->bus->dev);
return ret;
}
--
2.20.1
Powered by blists - more mailing lists