From patchwork Thu Oct 30 10:51:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 5196951 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3DBAEC11AC for ; Thu, 30 Oct 2014 11:38:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 74FCF201FE for ; Thu, 30 Oct 2014 11:38:51 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 4DFCF20138 for ; Thu, 30 Oct 2014 11:38:50 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5D627265529; Thu, 30 Oct 2014 12:38:49 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 42E2326571D; Thu, 30 Oct 2014 12:35: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 EAE82265467; Thu, 30 Oct 2014 12:35:06 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id 8C7CA265307 for ; Thu, 30 Oct 2014 12:32:37 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 30 Oct 2014 04:32:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="408441296" Received: from vkoul-udesk3.iind.intel.com (HELO localhost.localdomain) ([10.223.96.11]) by FMSMGA003.fm.intel.com with ESMTP; 30 Oct 2014 04:24:26 -0700 From: Vinod Koul To: alsa-devel@alsa-project.org Date: Thu, 30 Oct 2014 16:21:46 +0530 Message-Id: <1414666312-4657-4-git-send-email-vinod.koul@intel.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1414666312-4657-1-git-send-email-vinod.koul@intel.com> References: <1414666312-4657-1-git-send-email-vinod.koul@intel.com> Cc: Vinod Koul , broonie@kernel.org, subhransu.s.prusty@intel.com, lgirdwood@gmail.com Subject: [alsa-devel] [PATCH 3/9] ASoC: Intel: move the lock and wq initialization to routine 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: Subhransu S. Prusty This will be used by APCI code as well, so moving to common routine helps Signed-off-by: Subhransu S. Prusty Signed-off-by: Vinod Koul --- sound/soc/intel/sst/sst.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/sound/soc/intel/sst/sst.c b/sound/soc/intel/sst/sst.c index 253b917..7c9c65a 100644 --- a/sound/soc/intel/sst/sst.c +++ b/sound/soc/intel/sst/sst.c @@ -222,6 +222,14 @@ static int sst_workqueue_init(struct intel_sst_drv *ctx) return 0; } +static void sst_init_locks(struct intel_sst_drv *ctx) +{ + mutex_init(&ctx->sst_lock); + spin_lock_init(&ctx->rx_msg_lock); + spin_lock_init(&ctx->ipc_spin_lock); + spin_lock_init(&ctx->block_lock); +} + /* * intel_sst_probe - PCI probe function * @@ -259,7 +267,7 @@ static int intel_sst_probe(struct pci_dev *pci, return -EINVAL; ops = sst_drv_ctx->ops; - mutex_init(&sst_drv_ctx->sst_lock); + sst_init_locks(sst_drv_ctx); /* pvt_id 0 reserved for async messages */ sst_drv_ctx->pvt_id = 1; @@ -270,10 +278,6 @@ static int intel_sst_probe(struct pci_dev *pci, sst_drv_ctx->use_dma = 0; sst_drv_ctx->use_lli = 0; - spin_lock_init(&sst_drv_ctx->ipc_spin_lock); - spin_lock_init(&sst_drv_ctx->block_lock); - spin_lock_init(&sst_drv_ctx->rx_msg_lock); - if (sst_workqueue_init(sst_drv_ctx)) return -EINVAL;