From patchwork Mon Dec 29 18:41:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 5550231 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 310FF9F2ED for ; Mon, 29 Dec 2014 19:46:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 636312016C for ; Mon, 29 Dec 2014 19:46:02 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 53F6F20121 for ; Mon, 29 Dec 2014 19:46:01 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 77FA2262634; Mon, 29 Dec 2014 20:46:00 +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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 38C8D2606AD; Mon, 29 Dec 2014 20:32:37 +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 D84212605C2; Mon, 29 Dec 2014 20:32:33 +0100 (CET) Received: from smtp-out-184.synserver.de (smtp-out-184.synserver.de [212.40.185.184]) by alsa0.perex.cz (Postfix) with ESMTP id E2A982605C7 for ; Mon, 29 Dec 2014 19:41:52 +0100 (CET) Received: (qmail 19128 invoked by uid 0); 29 Dec 2014 18:41:52 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 18895 Received: from ppp-88-217-12-186.dynamic.mnet-online.de (HELO lars-adi-laptop.fritz.box) [88.217.12.186] by 217.119.54.96 with SMTP; 29 Dec 2014 18:41:52 -0000 From: Lars-Peter Clausen To: Jaroslav Kysela , Takashi Iwai Date: Mon, 29 Dec 2014 19:41:43 +0100 Message-Id: <1419878506-28684-6-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1419878506-28684-1-git-send-email-lars@metafoo.de> References: <1419878506-28684-1-git-send-email-lars@metafoo.de> Cc: alsa-devel@alsa-project.org, Lars-Peter Clausen Subject: [alsa-devel] [PATCH 6/9] ALSA: pcm: Simplify params_period_bytes() 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 The hw_params struct has a parameter that contains the period size in bytes. This can be used instead of deriving the value from other parameters. This is similar to e.g. params_buffer_bytes() Signed-off-by: Lars-Peter Clausen --- include/sound/pcm_params.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h index 2e2169e..042049b 100644 --- a/include/sound/pcm_params.h +++ b/include/sound/pcm_params.h @@ -363,9 +363,7 @@ params_subformat(const struct snd_pcm_hw_params *p) static inline unsigned int params_period_bytes(const struct snd_pcm_hw_params *p) { - return (params_period_size(p) * - snd_pcm_format_physical_width(params_format(p)) * - params_channels(p)) / 8; + return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIOD_BYTES)->min; } /**