public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: alsa-devel@alsa-project.org, clemens@ladisch.de
Subject: Re: [PATCH 5/8] ALSA: control: rename loop index to i
Date: Wed, 11 Feb 2015 12:55:49 +0100	[thread overview]
Message-ID: <s5h61b8psqi.wl-tiwai@suse.de> (raw)
In-Reply-To: <1423651052-19593-6-git-send-email-o-takashi@sakamocchi.jp>

At Wed, 11 Feb 2015 19:37:29 +0900,
Takashi Sakamoto wrote:
> 
> This is a fashion and subtle issue, but can reduce characters in a file.

Sorry, I see no merit by this action.  The idx is even clearer than
using i for these purposes.  And, if it's i, people expect it being
int, not unsigned.


Takashi

> 
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> ---
>  sound/core/control.c | 44 ++++++++++++++++++++++----------------------
>  1 file changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/sound/core/control.c b/sound/core/control.c
> index 19f9f4e..15af804 100644
> --- a/sound/core/control.c
> +++ b/sound/core/control.c
> @@ -119,7 +119,7 @@ static int snd_ctl_release(struct inode *inode, struct file *file)
>  	struct snd_card *card;
>  	struct snd_ctl_file *ctl;
>  	struct snd_kcontrol *control;
> -	unsigned int idx;
> +	unsigned int i;
>  
>  	ctl = file->private_data;
>  	file->private_data = NULL;
> @@ -129,9 +129,9 @@ static int snd_ctl_release(struct inode *inode, struct file *file)
>  	write_unlock_irqrestore(&card->ctl_files_rwlock, flags);
>  	down_write(&card->controls_rwsem);
>  	list_for_each_entry(control, &card->controls, list)
> -		for (idx = 0; idx < control->count; idx++)
> -			if (control->vd[idx].owner == ctl)
> -				control->vd[idx].owner = NULL;
> +		for (i = 0; i < control->count; i++)
> +			if (control->vd[i].owner == ctl)
> +				control->vd[i].owner = NULL;
>  	up_write(&card->controls_rwsem);
>  	snd_ctl_empty_read_queue(ctl);
>  	put_pid(ctl->pid);
> @@ -205,7 +205,7 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control,
>  					unsigned int access)
>  {
>  	struct snd_kcontrol *kctl;
> -	unsigned int idx;
> +	unsigned int i;
>  	
>  	if (snd_BUG_ON(!control || !control->count))
>  		return NULL;
> @@ -219,8 +219,8 @@ static struct snd_kcontrol *snd_ctl_new(struct snd_kcontrol *control,
>  		return NULL;
>  	}
>  	*kctl = *control;
> -	for (idx = 0; idx < kctl->count; idx++)
> -		kctl->vd[idx].access = access;
> +	for (i = 0; i < kctl->count; i++)
> +		kctl->vd[i].access = access;
>  	return kctl;
>  }
>  
> @@ -340,7 +340,7 @@ static int snd_ctl_find_hole(struct snd_card *card, unsigned int count)
>  int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
>  {
>  	struct snd_ctl_elem_id id;
> -	unsigned int idx;
> +	unsigned int i;
>  	unsigned int count;
>  	int err = -EINVAL;
>  
> @@ -376,7 +376,7 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
>  	id = kcontrol->id;
>  	count = kcontrol->count;
>  	up_write(&card->controls_rwsem);
> -	for (idx = 0; idx < count; idx++, id.index++, id.numid++)
> +	for (i = 0; i < count; i++, id.index++, id.numid++)
>  		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id);
>  	return 0;
>  
> @@ -405,7 +405,7 @@ int snd_ctl_replace(struct snd_card *card, struct snd_kcontrol *kcontrol,
>  {
>  	struct snd_ctl_elem_id id;
>  	unsigned int count;
> -	unsigned int idx;
> +	unsigned int i;
>  	struct snd_kcontrol *old;
>  	int ret;
>  
> @@ -443,7 +443,7 @@ add:
>  	id = kcontrol->id;
>  	count = kcontrol->count;
>  	up_write(&card->controls_rwsem);
> -	for (idx = 0; idx < count; idx++, id.index++, id.numid++)
> +	for (i = 0; i < count; i++, id.index++, id.numid++)
>  		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id);
>  	return 0;
>  
> @@ -467,14 +467,14 @@ EXPORT_SYMBOL(snd_ctl_replace);
>  int snd_ctl_remove(struct snd_card *card, struct snd_kcontrol *kcontrol)
>  {
>  	struct snd_ctl_elem_id id;
> -	unsigned int idx;
> +	unsigned int i;
>  
>  	if (snd_BUG_ON(!card || !kcontrol))
>  		return -EINVAL;
>  	list_del(&kcontrol->list);
>  	card->controls_count -= kcontrol->count;
>  	id = kcontrol->id;
> -	for (idx = 0; idx < kcontrol->count; idx++, id.index++, id.numid++)
> +	for (i = 0; i < kcontrol->count; i++, id.index++, id.numid++)
>  		snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_REMOVE, &id);
>  	snd_ctl_free_one(kcontrol);
>  	return 0;
> @@ -523,7 +523,7 @@ static int snd_ctl_remove_user_ctl(struct snd_ctl_file * file,
>  {
>  	struct snd_card *card = file->card;
>  	struct snd_kcontrol *kctl;
> -	int idx, ret;
> +	int i, ret;
>  
>  	down_write(&card->controls_rwsem);
>  	kctl = snd_ctl_find_id(card, id);
> @@ -535,8 +535,8 @@ static int snd_ctl_remove_user_ctl(struct snd_ctl_file * file,
>  		ret = -EINVAL;
>  		goto error;
>  	}
> -	for (idx = 0; idx < kctl->count; idx++)
> -		if (kctl->vd[idx].owner != NULL && kctl->vd[idx].owner != file) {
> +	for (i = 0; i < kctl->count; i++)
> +		if (kctl->vd[i].owner != NULL && kctl->vd[i].owner != file) {
>  			ret = -EBUSY;
>  			goto error;
>  		}
> @@ -725,7 +725,7 @@ static int snd_ctl_elem_list(struct snd_card *card,
>  	struct snd_ctl_elem_list list;
>  	struct snd_kcontrol *kctl;
>  	struct snd_ctl_elem_id *dst, *id;
> -	unsigned int offset, space, jidx;
> +	unsigned int offset, space, i;
>  	
>  	if (copy_from_user(&list, _list, sizeof(list)))
>  		return -EFAULT;
> @@ -755,8 +755,8 @@ static int snd_ctl_elem_list(struct snd_card *card,
>  		id = dst;
>  		while (space > 0 && plist != &card->controls) {
>  			kctl = snd_kcontrol(plist);
> -			for (jidx = offset; space > 0 && jidx < kctl->count; jidx++) {
> -				snd_ctl_build_ioff(id, kctl, jidx);
> +			for (i = offset; space > 0 && i < kctl->count; i++) {
> +				snd_ctl_build_ioff(id, kctl, i);
>  				id++;
>  				space--;
>  				list.used++;
> @@ -1183,7 +1183,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
>  	unsigned int access;
>  	unsigned int elem_data_size;
>  	struct user_element *ue;
> -	int idx, err;
> +	int i, err;
>  
>  	if (info->count < 1)
>  		return -EINVAL;
> @@ -1257,8 +1257,8 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
>  	_kctl->private_data = ue;
>  
>  	/* Lock values in this user controls. */
> -	for (idx = 0; idx < _kctl->count; idx++)
> -		_kctl->vd[idx].owner = file;
> +	for (i = 0; i < _kctl->count; i++)
> +		_kctl->vd[i].owner = file;
>  
>  	err = snd_ctl_add(card, _kctl);
>  	if (err < 0)
> -- 
> 2.1.0
> 

  reply	other threads:[~2015-02-11 11:55 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-11 10:37 [PATCH 0/8] ALSA: control: refactoring core codes Takashi Sakamoto
2015-02-11 10:37 ` [PATCH 1/8] ALSA: control: change type from long due to the definition of sizeof operator Takashi Sakamoto
2015-02-11 11:53   ` Takashi Iwai
2015-02-11 10:37 ` [PATCH 2/8] ALSA: control: obsolete switch statement with const value table Takashi Sakamoto
2015-02-11 10:51   ` Lars-Peter Clausen
2015-02-11 11:27     ` Takashi Sakamoto
2015-02-11 10:37 ` [PATCH 3/8] ALSA: control: gathering evaluations to access Takashi Sakamoto
2015-02-11 10:37 ` [PATCH 4/8] ALSA: control: add a comment about locking values after creating Takashi Sakamoto
2015-02-11 10:37 ` [PATCH 5/8] ALSA: control: rename loop index to i Takashi Sakamoto
2015-02-11 11:55   ` Takashi Iwai [this message]
2015-02-12 12:50     ` Takashi Sakamoto
2015-02-11 10:37 ` [PATCH 6/8] ALSA: control: fix over 80 characters lines Takashi Sakamoto
2015-02-11 12:01   ` Takashi Iwai
2015-02-12 12:47     ` Takashi Sakamoto
2015-02-12 12:54       ` Jaroslav Kysela
2015-02-11 10:37 ` [PATCH 7/8] ALSA: control: rename to appropriate macro name Takashi Sakamoto
2015-02-11 10:37 ` [PATCH 8/8] ALSA: control: arrange snd_ctl_new() as a local function Takashi Sakamoto
2015-02-11 12:49   ` Lars-Peter Clausen
2015-02-11 13:04     ` Takashi Iwai
2015-02-12 12:45       ` Takashi Sakamoto
2015-02-12 12:57         ` Takashi Iwai
2015-02-11 13:19 ` [PATCH 0/8] ALSA: control: refactoring core codes Takashi Iwai
2015-02-12 12:38   ` Takashi Sakamoto
2015-03-05 15:43 ` [PATCH 0/2][RFC] ALSA: core: optimizations for creating new controls Takashi Sakamoto
2015-03-05 15:43   ` [PATCH 1/2] ALSA: core: use precomputed table to check userspace control params Takashi Sakamoto
2015-03-05 15:43   ` [PATCH 2/2] ALSA: core: reduce stack usage related to snd_ctl_new() Takashi Sakamoto
2015-03-05 15:58   ` [PATCH 0/2][RFC] ALSA: core: optimizations for creating new controls Takashi Iwai
2015-03-07  4:57     ` Takashi Sakamoto
2015-03-10 13:13   ` [PATCH 0/2 v2] " Takashi Sakamoto
2015-03-10 13:13     ` [PATCH 1/2] ALSA: core: use precomputed table to check userspace control params Takashi Sakamoto
2015-03-10 13:13     ` [PATCH 2/2] ALSA: core: reduce stack usage related to snd_ctl_new() Takashi Sakamoto
2015-03-10 14:44     ` [PATCH 0/2 v2] ALSA: core: optimizations for creating new controls 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=s5h61b8psqi.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=o-takashi@sakamocchi.jp \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox