aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinod Koul <vinod.koul@intel.com>2015-02-25 11:07:52 -0500
committerMark Brown <broonie@kernel.org>2015-02-25 20:59:37 -0500
commit5bb400ce4a9b100a2dd3f5db17c4c76877cecade (patch)
treea66be22b9c64c92a34cdb6b87ff5e7df55813e01
parent3f2dcbeaeb2badb951a68e7d525ff4e55d0b0678 (diff)
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>
-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 549af7d7f6d0..f0e4b99b3aeb 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)
139{ 139{
140 struct intel_sst_drv *ctx = dev_get_drvdata(dev); 140 struct intel_sst_drv *ctx = dev_get_drvdata(dev);
141 int ret = 0; 141 int ret = 0;
142 int usage_count = 0;
143
144#ifdef CONFIG_PM
145 usage_count = atomic_read(&dev->power.usage_count);
146#else
147 usage_count = 1;
148#endif
142 149
143 if (state == true) { 150 if (state == true) {
144 ret = pm_runtime_get_sync(dev); 151 ret = pm_runtime_get_sync(dev);
145 dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", 152
146 atomic_read(&dev->power.usage_count)); 153 dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count);
147 if (ret < 0) { 154 if (ret < 0) {
148 dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret); 155 dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
149 return ret; 156 return ret;
150 } 157 }
151 if ((ctx->sst_state == SST_RESET) && 158 if ((ctx->sst_state == SST_RESET) && (usage_count == 1)) {
152 (atomic_read(&dev->power.usage_count) == 1)) {
153 ret = sst_load_fw(ctx); 159 ret = sst_load_fw(ctx);
154 if (ret) { 160 if (ret) {
155 dev_err(dev, "FW download fail %d\n", ret); 161 dev_err(dev, "FW download fail %d\n", ret);
@@ -158,8 +164,7 @@ static int sst_power_control(struct device *dev, bool state)
158 } 164 }
159 } 165 }
160 } else { 166 } else {
161 dev_dbg(ctx->dev, "Disable: pm usage count: %d\n", 167 dev_dbg(ctx->dev, "Disable: pm usage count: %d\n", usage_count);
162 atomic_read(&dev->power.usage_count));
163 return sst_pm_runtime_put(ctx); 168 return sst_pm_runtime_put(ctx);
164 } 169 }
165 return ret; 170 return ret;