ASoC: Intel: Skylake: Don't unload module when in use
authorVinod Koul <vinod.koul@intel.com>
Fri, 24 Mar 2017 17:40:28 +0000 (23:10 +0530)
committerMark Brown <broonie@kernel.org>
Wed, 29 Mar 2017 11:53:27 +0000 (12:53 +0100)
A module may have multiple instances in DSP, so unload only when usage
count is zero.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/skylake/skl-sst.c

index 39d4aaac73bf0d672f5bec260aef79ea57d349bd..539529729e3f9520c87ee19ab945b3833cb97a57 100644 (file)
@@ -417,6 +417,11 @@ static int skl_unload_module(struct sst_dsp *ctx, u16 mod_id)
                dev_err(ctx->dev, "Module bad usage cnt!:%d\n", usage_cnt);
                return -EIO;
        }
+
+       /* if module is used by others return, no need to unload */
+       if (usage_cnt > 0)
+               return 0;
+
        ret = skl_ipc_unload_modules(&skl->ipc,
                        SKL_NUM_MODULES, &mod_id);
        if (ret < 0) {