From patchwork Thu Mar 23 13:32:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeeja KP X-Patchwork-Id: 9641087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 73D2C601E9 for ; Thu, 23 Mar 2017 13:21:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64BF0284C2 for ; Thu, 23 Mar 2017 13:21:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59899284F7; Thu, 23 Mar 2017 13:21:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A674D284C2 for ; Thu, 23 Mar 2017 13:21:25 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C59FE26725C; Thu, 23 Mar 2017 14:20:11 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 14B7926725C; Thu, 23 Mar 2017 14:20:05 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by alsa0.perex.cz (Postfix) with ESMTP id 03D5826721A for ; Thu, 23 Mar 2017 14:19:57 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP; 23 Mar 2017 06:19:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.36,210,1486454400"; d="scan'208"; a="1126196417" Received: from kpjeeja-desk.iind.intel.com ([10.223.96.110]) by fmsmga001.fm.intel.com with ESMTP; 23 Mar 2017 06:19:55 -0700 From: jeeja.kp@intel.com To: alsa-devel@alsa-project.org Date: Thu, 23 Mar 2017 19:02:00 +0530 Message-Id: <1490275926-2270-6-git-send-email-jeeja.kp@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1490275926-2270-1-git-send-email-jeeja.kp@intel.com> References: <1490275926-2270-1-git-send-email-jeeja.kp@intel.com> Cc: tiwai@suse.de, patches.audio@intel.com, broonie@kernel.org, liam.r.girdwood@intel.com, Jeeja KP , Vinod Koul Subject: [alsa-devel] [PATCH 05/11] ASoC: Intel: Skylake: Don't unload module when in use X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vinod Koul A module may have multiple instances in DSP, so unload only when usage count is zero. Signed-off-by: Vinod Koul Signed-off-by: Jeeja KP --- sound/soc/intel/skylake/skl-sst.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c index 39d4aaa..5395297 100644 --- a/sound/soc/intel/skylake/skl-sst.c +++ b/sound/soc/intel/skylake/skl-sst.c @@ -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) {