From patchwork Thu Apr 16 16:14:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 6226981 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A7F21BF4A6 for ; Thu, 16 Apr 2015 16:19:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C6D702013D for ; Thu, 16 Apr 2015 16:19:06 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 96665200B4 for ; Thu, 16 Apr 2015 16:19:05 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C85A5265979; Thu, 16 Apr 2015 18:19:04 +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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id F1A9F26549A; Thu, 16 Apr 2015 18:15:01 +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 1F28C265357; Thu, 16 Apr 2015 18:14:56 +0200 (CEST) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 90339261A5A for ; Thu, 16 Apr 2015 18:14:38 +0200 (CEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id DEAC3AD7C; Thu, 16 Apr 2015 16:14:37 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Thu, 16 Apr 2015 18:14:25 +0200 Message-Id: <1429200870-5288-12-git-send-email-tiwai@suse.de> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1429200870-5288-1-git-send-email-tiwai@suse.de> References: <1429200870-5288-1-git-send-email-tiwai@suse.de> Cc: Vinod Koul , Jeeja KP , Liam Girdwood Subject: [alsa-devel] [PATCH 11/16] ALSA: hda - Minor refactoring 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 Move the small portion of the common sequence in hda_intel.c and hda_tegra.c into hda_controller.c. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_controller.c | 10 +++++++--- sound/pci/hda/hda_intel.c | 3 --- sound/pci/hda/hda_tegra.c | 3 --- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 21058b41b2c6..aaf01e841426 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -107,18 +107,22 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream, { struct azx_pcm *apcm = snd_pcm_substream_chip(substream); struct azx *chip = apcm->chip; + struct azx_dev *azx_dev = get_azx_dev(substream); int ret; - dsp_lock(get_azx_dev(substream)); - if (dsp_is_locked(get_azx_dev(substream))) { + dsp_lock(azx_dev); + if (dsp_is_locked(azx_dev)) { ret = -EBUSY; goto unlock; } + azx_dev->core.bufsize = 0; + azx_dev->core.period_bytes = 0; + azx_dev->core.format_val = 0; ret = chip->ops->substream_alloc_pages(chip, substream, params_buffer_bytes(hw_params)); unlock: - dsp_unlock(get_azx_dev(substream)); + dsp_unlock(azx_dev); return ret; } diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 9dff693005ea..8a1471851ca7 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1743,9 +1743,6 @@ static int substream_alloc_pages(struct azx *chip, int ret; mark_runtime_wc(chip, azx_dev, substream, false); - azx_dev->core.bufsize = 0; - azx_dev->core.period_bytes = 0; - azx_dev->core.format_val = 0; ret = snd_pcm_lib_malloc_pages(substream, size); if (ret < 0) return ret; diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 397e1821020f..d5349809f43d 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -104,9 +104,6 @@ static int substream_alloc_pages(struct azx *chip, { struct azx_dev *azx_dev = get_azx_dev(substream); - azx_dev->core.bufsize = 0; - azx_dev->core.period_bytes = 0; - azx_dev->core.format_val = 0; return snd_pcm_lib_malloc_pages(substream, size); }