All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: tiwai@suse.de, perex@perex.cz
Cc: alsa-devel@alsa-project.org
Subject: [PATCH v2 6/8] ALSA: pcm: adaption of code formatting
Date: Fri,  9 Jun 2017 06:37:04 +0900	[thread overview]
Message-ID: <20170608213706.5420-7-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <20170608213706.5420-1-o-takashi@sakamocchi.jp>

This commit modifies current for readability in below aspects:
 - use bool type variable instead of int type variable assigned to 0/1
 - move variable definition from loop to top of the function definition

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/core/pcm_native.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index db4cdd114ed4..40560e579d33 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -328,9 +328,11 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
 	unsigned int rstamps[constrs->rules_num];
 	unsigned int vstamps[SNDRV_PCM_HW_PARAM_LAST_INTERVAL + 1];
 	unsigned int stamp = 2;
+	struct snd_pcm_hw_rule *r;
+	unsigned int d;
 	struct snd_mask old_mask;
 	struct snd_interval old_interval;
-	int again;
+	bool again;
 	int changed;
 
 	for (k = 0; k < constrs->rules_num; k++)
@@ -338,10 +340,9 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
 	for (k = 0; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++)
 		vstamps[k] = (params->rmask & (1 << k)) ? 1 : 0;
 retry:
-	again = 0;
+	again = false;
 	for (k = 0; k < constrs->rules_num; k++) {
-		struct snd_pcm_hw_rule *r = &constrs->rules[k];
-		unsigned int d;
+		r = &constrs->rules[k];
 		if (r->cond && !(r->cond & params->flags))
 			continue;
 		for (d = 0; r->deps[d] >= 0; d++) {
@@ -375,7 +376,7 @@ static int constrain_params_by_rules(struct snd_pcm_substream *substream,
 		if (changed && r->var >= 0) {
 			params->cmask |= (1 << r->var);
 			vstamps[r->var] = stamp;
-			again = 1;
+			again = true;
 		}
 		if (changed < 0)
 			return changed;
@@ -453,7 +454,6 @@ int snd_pcm_hw_refine(struct snd_pcm_substream *substream,
 	params->rmask = 0;
 	return 0;
 }
-
 EXPORT_SYMBOL(snd_pcm_hw_refine);
 
 static int snd_pcm_hw_refine_user(struct snd_pcm_substream *substream,
-- 
2.11.0

  parent reply	other threads:[~2017-06-08 21:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 21:36 [PATCH v2 0/8] [PATCH 0/8] ALSA: pcm: code refactoring for snd_pcm_hw_refine() Takashi Sakamoto
2017-06-08 21:36 ` [PATCH v2 1/8] ALSA: pcm: add a helper function to constrain mask-type parameters Takashi Sakamoto
2017-06-08 21:37 ` [PATCH v2 2/8] ALSA: pcm: add a helper function to constrain interval-type parameters Takashi Sakamoto
2017-06-08 21:37 ` [PATCH v2 3/8] ALSA: pcm: add a helper function to apply parameter rules Takashi Sakamoto
2017-06-08 21:37 ` [PATCH v2 4/8] ALSA: pcm: use goto statement instead of while statement to reduce indentation Takashi Sakamoto
2017-06-08 21:37 ` [PATCH v2 5/8] ALSA: pcm: remove function local variable with alternative evaluation Takashi Sakamoto
2017-06-08 21:37 ` Takashi Sakamoto [this message]
2017-06-08 21:37 ` [PATCH v2 7/8] ALSA: pcm: use helper functions to check whether parameters are determined Takashi Sakamoto
2017-06-08 21:37 ` [PATCH v2 8/8] ALSA: pcm: add comment about application of rule to PCM parameters Takashi Sakamoto
2017-06-08 21:44 ` [PATCH v2 0/8] [PATCH 0/8] ALSA: pcm: code refactoring for snd_pcm_hw_refine() Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170608213706.5420-7-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.