All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: wrap runtime_pm usage count under CONFIG_PM
@ 2015-02-25 16:07 Vinod Koul
  2015-02-26  1:59 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Vinod Koul @ 2015-02-25 16:07 UTC (permalink / raw)
  To: alsa-devel; +Cc: Vinod Koul, broonie, lgirdwood

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>
---
 sound/soc/intel/sst/sst_drv_interface.c |   17 +++++++++++------
 1 file 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)
 {
 	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;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: Intel: wrap runtime_pm usage count under CONFIG_PM
  2015-02-25 16:07 [PATCH] ASoC: Intel: wrap runtime_pm usage count under CONFIG_PM Vinod Koul
@ 2015-02-26  1:59 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-02-26  1:59 UTC (permalink / raw)
  To: Vinod Koul; +Cc: alsa-devel, lgirdwood


[-- Attachment #1.1: Type: text/plain, Size: 331 bytes --]

On Wed, Feb 25, 2015 at 09:37:52PM +0530, Vinod Koul wrote:
> 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.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-26  2:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 16:07 [PATCH] ASoC: Intel: wrap runtime_pm usage count under CONFIG_PM Vinod Koul
2015-02-26  1:59 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.