Commit d879e944 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: Intel: atom: use pm_runtime_resume_and_get()

Use pm_runtime_resume_and_get() to replace the pm_runtime_get_sync() and
pm_runtime_put_sync() pattern.

No functional changes.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220426183807.102442-1-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 6cefb626
...@@ -136,11 +136,10 @@ static int sst_power_control(struct device *dev, bool state) ...@@ -136,11 +136,10 @@ static int sst_power_control(struct device *dev, bool state)
int usage_count = 0; int usage_count = 0;
if (state) { if (state) {
ret = pm_runtime_get_sync(dev); ret = pm_runtime_resume_and_get(dev);
usage_count = GET_USAGE_COUNT(dev); usage_count = GET_USAGE_COUNT(dev);
dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count); dev_dbg(ctx->dev, "Enable: pm usage count: %d\n", usage_count);
if (ret < 0) { if (ret < 0) {
pm_runtime_put_sync(dev);
dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret); dev_err(ctx->dev, "Runtime get failed with err: %d\n", ret);
return ret; return ret;
} }
...@@ -193,11 +192,9 @@ static int sst_cdev_open(struct device *dev, ...@@ -193,11 +192,9 @@ static int sst_cdev_open(struct device *dev,
struct stream_info *stream; struct stream_info *stream;
struct intel_sst_drv *ctx = dev_get_drvdata(dev); struct intel_sst_drv *ctx = dev_get_drvdata(dev);
retval = pm_runtime_get_sync(ctx->dev); retval = pm_runtime_resume_and_get(ctx->dev);
if (retval < 0) { if (retval < 0)
pm_runtime_put_sync(ctx->dev);
return retval; return retval;
}
str_id = sst_get_stream(ctx, str_params); str_id = sst_get_stream(ctx, str_params);
if (str_id > 0) { if (str_id > 0) {
...@@ -645,11 +642,9 @@ static int sst_send_byte_stream(struct device *dev, ...@@ -645,11 +642,9 @@ static int sst_send_byte_stream(struct device *dev,
if (NULL == bytes) if (NULL == bytes)
return -EINVAL; return -EINVAL;
ret_val = pm_runtime_get_sync(ctx->dev); ret_val = pm_runtime_resume_and_get(ctx->dev);
if (ret_val < 0) { if (ret_val < 0)
pm_runtime_put_sync(ctx->dev);
return ret_val; return ret_val;
}
ret_val = sst_send_byte_stream_mrfld(ctx, bytes); ret_val = sst_send_byte_stream_mrfld(ctx, bytes);
sst_pm_runtime_put(ctx); sst_pm_runtime_put(ctx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment