{
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);
}
}
} 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;