From patchwork Sun May 6 15:47:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10382865 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 DEAAA60236 for ; Sun, 6 May 2018 15:48:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE8CE2787C for ; Sun, 6 May 2018 15:48:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B17C428738; Sun, 6 May 2018 15:48:01 +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=-2.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, T_DKIM_INVALID 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 937942787C for ; Sun, 6 May 2018 15:48:00 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 8B859267345; Sun, 6 May 2018 17:47:57 +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 1C90226734C; Sun, 6 May 2018 17:47:54 +0200 (CEST) Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) by alsa0.perex.cz (Postfix) with ESMTP id E0873267338 for ; Sun, 6 May 2018 17:47:51 +0200 (CEST) Received: by mail-qt0-f193.google.com with SMTP id m16-v6so33274073qtg.13 for ; Sun, 06 May 2018 08:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=N0JGOfZ2u0rwrcqUhpVitU+8lHQ6Mwvnvzxa217L1Yc=; b=Ki+T93ll1AGXQ8+jeTtm7R54ox8ESCN56W3ToRsLRz/0xu/FN89gAmJ19TmwKDatek bBVrJaaLw7WSXV7GjEE9CZohC510zcpwXpYFtKZR30nWGMpFBsc+XwBzfS5gJitl+WdD 1KRC/WNwqvv/eVj8BcIPrpJToBZ9uhhNGppYu/vFGIeqh2KBeSVfJsp51NpCzhZa9ClK s4UM45+nvWkFsAxYRPXTS2foFIzjLrYIgmtAwWTkm5TWDOt2WenT+f5A0TRX0p7mBwUK UafbpVQNcjje4ADd6H6hjsXmc62InlXkWlT1aWT2kVsQHl8AA0N7xTKS5I4KtLO2VVT7 YfmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=N0JGOfZ2u0rwrcqUhpVitU+8lHQ6Mwvnvzxa217L1Yc=; b=o1kKCe6fHMb/j7qfhS2Z+kRuAIAConn0ynonJ5o8m2OSAx+jF2XdnTMFt97oUUZBZo GTSWnxA33Iali1t8BMB0c/8SMHYvvdVLvQWuGcKJISpYxRgqQKhIJruSpLenGAtaNMc9 Bmn9mblmtOQLFvfnTKvKf2bkoOZ/2ERlAeR2NzHEW68O1KqIpeSU+R+H4mgU8fedPY4+ 60Crg4gSkO6inUCEDHVqAllKQGD/Q2dTkW04DEZKzincHWXusvmwJ2dLooMpFuIHuDzs B33H71z9FcbUQiimftVPoP2lfeJSshIQxZrG1U9400D7/AFztC9Dp+5ov/kE7tFUKjj9 4r5w== X-Gm-Message-State: ALQs6tC3aWWy5LWFTlmfGW/a8ob1A76GEJSpA5g11KcW2hHChukeZ4ln xOQE/G6Gjb3Py8KMmv66H2Q= X-Google-Smtp-Source: AB8JxZou+WHIKanW8v12PLDkeGXK9i+QGgY8Ye9OBWcPgNUlloumdB95phr61nD6kW5jXs3uDW7CTQ== X-Received: by 2002:ac8:90b:: with SMTP id t11-v6mr30381069qth.107.1525621670352; Sun, 06 May 2018 08:47:50 -0700 (PDT) Received: from localhost.localdomain ([2804:14d:90ae:4c9c:cde4:b11c:33c2:be38]) by smtp.gmail.com with ESMTPSA id 135sm16180309qkf.26.2018.05.06.08.47.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 06 May 2018 08:47:49 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Date: Sun, 6 May 2018 12:47:43 -0300 Message-Id: <1525621665-11022-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 2.7.4 Cc: Fabio Estevam , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 1/3] ASoC: pcm_native: Use 'snd_pcm_format_t' type 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: Fabio Estevam 'snd_pcm_format_t' type is better suited for iterating through the SNDRV_PCM_FORMAT members. Also, use SNDRV_PCM_FORMAT_FIRST for the first element. Signed-off-by: Fabio Estevam --- sound/core/pcm_native.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 7585444..5d62b7c 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -2051,13 +2051,13 @@ static int snd_pcm_hw_rule_mulkdiv(struct snd_pcm_hw_params *params, static int snd_pcm_hw_rule_format(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) { - unsigned int k; + snd_pcm_format_t k; const struct snd_interval *i = hw_param_interval_c(params, rule->deps[0]); struct snd_mask m; struct snd_mask *mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); snd_mask_any(&m); - for (k = 0; k <= SNDRV_PCM_FORMAT_LAST; ++k) { + for (k = SNDRV_PCM_FORMAT_FIRST; k <= SNDRV_PCM_FORMAT_LAST; ++k) { int bits; if (! snd_mask_test(mask, k)) continue; @@ -2074,12 +2074,12 @@ static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) { struct snd_interval t; - unsigned int k; + snd_pcm_format_t k; t.min = UINT_MAX; t.max = 0; t.openmin = 0; t.openmax = 0; - for (k = 0; k <= SNDRV_PCM_FORMAT_LAST; ++k) { + for (k = SNDRV_PCM_FORMAT_FIRST; k <= SNDRV_PCM_FORMAT_LAST; ++k) { int bits; if (! snd_mask_test(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), k)) continue;