summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@intel.com>2015-02-25 21:37:52 +0530
committerMark Brown <broonie@kernel.org>2015-02-26 10:59:37 +0900
commit5bb400ce4a9b100a2dd3f5db17c4c76877cecade (patch)
treea66be22b9c64c92a34cdb6b87ff5e7df55813e01 /sound
parent3f2dcbeaeb2badb951a68e7d525ff4e55d0b0678 (diff)
downloadop-kernel-dev-5bb400ce4a9b100a2dd3f5db17c4c76877cecade.zip
op-kernel-dev-5bb400ce4a9b100a2dd3f5db17c4c76877cecade.tar.gz
ASoC: Intel: wrap runtime_pm usage count under CONFIG_PM
The struct dev_pm_ops defines usage_count only when CONFIG_PM is defined. So we should use this variable only in cases where this falg is true. So we define a local variable and read the value under this flag. In non PM cases, we set this to 1. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/intel/sst/sst_drv_interface.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sound/soc/intel/sst/sst_drv_interface.c b/sound/soc/intel/sst/sst_drv_interface.c
index 549af7d..f0e4b99b 100644
--- a/sound/soc/intel/sst/sst_drv_interface.c
+++ b/sound/soc/intel/sst/sst_drv_interface.c
@@ -139,17 +139,23 @@ static int sst_power_control(struct device *dev, bool state)
{
struct intel_sst_drv *ctx = dev_get_drvdata(dev);
int ret = 0;
+ int usage_count = 0;
+
+#ifdef CONFIG_PM
+ usage_count = atomic_read(&dev->power.usage_count);
+#else
+ usage_count = 1;
+#endif
if (state == true) {
ret = pm_runtime_get_sync(dev);
- dev_dbg(ctx->dev, "Enable: pm usage count: %d\n",
- atomic_read(&dev->power.usage_count));
+
+ dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count);
if (ret < 0) {
dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
return ret;
}
- if ((ctx->sst_state == SST_RESET) &&
- (atomic_read(&dev->power.usage_count) == 1)) {
+ if ((ctx->sst_state == SST_RESET) && (usage_count == 1)) {
ret = sst_load_fw(ctx);
if (ret) {
dev_err(dev, "FW download fail %d\n", ret);
@@ -158,8 +164,7 @@ static int sst_power_control(struct device *dev, bool state)
}
}
} else {
- dev_dbg(ctx->dev, "Disable: pm usage count: %d\n",
- atomic_read(&dev->power.usage_count));
+ dev_dbg(ctx->dev, "Disable: pm usage count: %d\n", usage_count);
return sst_pm_runtime_put(ctx);
}
return ret;
OpenPOWER on IntegriCloud