All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: usb-audio: use list_for_each_entry_continue_reverse
@ 2015-12-21 15:55 Geliang Tang
  2015-12-22  9:58   ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Geliang Tang @ 2015-12-21 15:55 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Ricard Wanderlof, Johan Rastén
  Cc: Geliang Tang, alsa-devel, linux-kernel

For better readability, use list_for_each_entry_continue_reverse()
in have_dup_chmap().

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 sound/usb/stream.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 8ee14f2..c4dc577 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -125,11 +125,9 @@ static int usb_chmap_ctl_info(struct snd_kcontrol *kcontrol,
 static bool have_dup_chmap(struct snd_usb_substream *subs,
 			   struct audioformat *fp)
 {
-	struct list_head *p;
+	struct audioformat *prev = fp;
 
-	for (p = fp->list.prev; p != &subs->fmt_list; p = p->prev) {
-		struct audioformat *prev;
-		prev = list_entry(p, struct audioformat, list);
+	list_for_each_entry_continue_reverse(prev, &subs->fmt_list, list) {
 		if (prev->chmap &&
 		    !memcmp(prev->chmap, fp->chmap, sizeof(*fp->chmap)))
 			return true;
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [alsa-devel] [PATCH] ALSA: usb-audio: use list_for_each_entry_continue_reverse
  2015-12-21 15:55 [PATCH] ALSA: usb-audio: use list_for_each_entry_continue_reverse Geliang Tang
@ 2015-12-22  9:58   ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2015-12-22  9:58 UTC (permalink / raw)
  To: Geliang Tang
  Cc: Jaroslav Kysela, Takashi Iwai, Ricard Wanderlof,
	Johan Rastén, alsa-devel, linux-kernel

On Mon, 21 Dec 2015 16:55:39 +0100,
Geliang Tang wrote:
> 
> For better readability, use list_for_each_entry_continue_reverse()
> in have_dup_chmap().
> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>

Applied, thanks.


Takashi

> ---
>  sound/usb/stream.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/usb/stream.c b/sound/usb/stream.c
> index 8ee14f2..c4dc577 100644
> --- a/sound/usb/stream.c
> +++ b/sound/usb/stream.c
> @@ -125,11 +125,9 @@ static int usb_chmap_ctl_info(struct snd_kcontrol *kcontrol,
>  static bool have_dup_chmap(struct snd_usb_substream *subs,
>  			   struct audioformat *fp)
>  {
> -	struct list_head *p;
> +	struct audioformat *prev = fp;
>  
> -	for (p = fp->list.prev; p != &subs->fmt_list; p = p->prev) {
> -		struct audioformat *prev;
> -		prev = list_entry(p, struct audioformat, list);
> +	list_for_each_entry_continue_reverse(prev, &subs->fmt_list, list) {
>  		if (prev->chmap &&
>  		    !memcmp(prev->chmap, fp->chmap, sizeof(*fp->chmap)))
>  			return true;
> -- 
> 2.5.0
> 
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ALSA: usb-audio: use list_for_each_entry_continue_reverse
@ 2015-12-22  9:58   ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2015-12-22  9:58 UTC (permalink / raw)
  To: Geliang Tang
  Cc: alsa-devel, Ricard Wanderlof, Takashi Iwai, linux-kernel,
	Johan Rastén

On Mon, 21 Dec 2015 16:55:39 +0100,
Geliang Tang wrote:
> 
> For better readability, use list_for_each_entry_continue_reverse()
> in have_dup_chmap().
> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>

Applied, thanks.


Takashi

> ---
>  sound/usb/stream.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/usb/stream.c b/sound/usb/stream.c
> index 8ee14f2..c4dc577 100644
> --- a/sound/usb/stream.c
> +++ b/sound/usb/stream.c
> @@ -125,11 +125,9 @@ static int usb_chmap_ctl_info(struct snd_kcontrol *kcontrol,
>  static bool have_dup_chmap(struct snd_usb_substream *subs,
>  			   struct audioformat *fp)
>  {
> -	struct list_head *p;
> +	struct audioformat *prev = fp;
>  
> -	for (p = fp->list.prev; p != &subs->fmt_list; p = p->prev) {
> -		struct audioformat *prev;
> -		prev = list_entry(p, struct audioformat, list);
> +	list_for_each_entry_continue_reverse(prev, &subs->fmt_list, list) {
>  		if (prev->chmap &&
>  		    !memcmp(prev->chmap, fp->chmap, sizeof(*fp->chmap)))
>  			return true;
> -- 
> 2.5.0
> 
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-22  9:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-21 15:55 [PATCH] ALSA: usb-audio: use list_for_each_entry_continue_reverse Geliang Tang
2015-12-22  9:58 ` [alsa-devel] " Takashi Iwai
2015-12-22  9:58   ` Takashi Iwai

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.