From patchwork Mon Oct 20 14:06:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liam Girdwood X-Patchwork-Id: 5106911 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AA0999F30B for ; Mon, 20 Oct 2014 17:19:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D2B87201EF for ; Mon, 20 Oct 2014 17:19:21 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D185A20149 for ; Mon, 20 Oct 2014 17:19:20 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id E49C42657DC; Mon, 20 Oct 2014 19:19:19 +0200 (CEST) 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 17BFC265930; Mon, 20 Oct 2014 17:23:03 +0200 (CEST) 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 24B3D265930; Mon, 20 Oct 2014 17:23:01 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by alsa0.perex.cz (Postfix) with ESMTP id 141F8266549 for ; Mon, 20 Oct 2014 16:07:47 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 20 Oct 2014 07:07:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,756,1406617200"; d="scan'208";a="617236505" Received: from mrdissan-mobl.gar.corp.intel.com (HELO loki.ger.corp.intel.com) ([10.252.122.19]) by fmsmga002.fm.intel.com with ESMTP; 20 Oct 2014 07:07:44 -0700 From: Liam Girdwood To: Mark Brown Date: Mon, 20 Oct 2014 15:06:51 +0100 Message-Id: <1413814012-5619-6-git-send-email-liam.r.girdwood@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1413814012-5619-1-git-send-email-liam.r.girdwood@linux.intel.com> References: <1413814012-5619-1-git-send-email-liam.r.girdwood@linux.intel.com> Cc: Liam Girdwood , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 6/7] ASoC: Intel: Add runtime module lookup API call 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 Add an API to allow quick lookup of runtime modules based on ID. Signed-off-by: Liam Girdwood --- sound/soc/intel/sst-firmware.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c index 684f15d..a52ba7a 100644 --- a/sound/soc/intel/sst-firmware.c +++ b/sound/soc/intel/sst-firmware.c @@ -1161,6 +1161,26 @@ struct sst_module *sst_module_get_from_id(struct sst_dsp *dsp, u32 id) } EXPORT_SYMBOL_GPL(sst_module_get_from_id); +struct sst_module_runtime *sst_module_runtime_get_from_id( + struct sst_module *module, u32 id) +{ + struct sst_module_runtime *runtime; + struct sst_dsp *dsp = module->dsp; + + mutex_lock(&dsp->mutex); + + list_for_each_entry(runtime, &module->runtime_list, list) { + if (runtime->id == id) { + mutex_unlock(&dsp->mutex); + return runtime; + } + } + + mutex_unlock(&dsp->mutex); + return NULL; +} +EXPORT_SYMBOL_GPL(sst_module_runtime_get_from_id); + /* returns block address in DSP address space */ u32 sst_dsp_get_offset(struct sst_dsp *dsp, u32 offset, enum sst_mem_type type)