Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1186220 > unrolled thread

[PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not needed

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2015-07-16 22:20 +0200
Last post2015-07-16 23:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not needed Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2015-07-16 22:20 +0200
    Re: [PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not  needed Julia Lawall <julia.lawall@lip6.fr> - 2015-07-16 23:00 +0200

#1186220 — [PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not needed

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2015-07-16 22:20 +0200
Subject[PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not needed
Message-ID<pMXNn-l1-1@gated-at.bofh.it>
There is no need to use the safe version of list_for_each here.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 net/bluetooth/cmtp/capi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/cmtp/capi.c b/net/bluetooth/cmtp/capi.c
index b0c6c6a..4c5e3e0 100644
--- a/net/bluetooth/cmtp/capi.c
+++ b/net/bluetooth/cmtp/capi.c
@@ -100,9 +100,9 @@ static void cmtp_application_del(struct cmtp_session *session, struct cmtp_appli
 static struct cmtp_application *cmtp_application_get(struct cmtp_session *session, int pattern, __u16 value)
 {
 	struct cmtp_application *app;
-	struct list_head *p, *n;
+	struct list_head *p;
 
-	list_for_each_safe(p, n, &session->applications) {
+	list_for_each(p, &session->applications) {
 		app = list_entry(p, struct cmtp_application, list);
 		switch (pattern) {
 		case CMTP_MSGNUM:
@@ -511,13 +511,13 @@ static int cmtp_proc_show(struct seq_file *m, void *v)
 	struct capi_ctr *ctrl = m->private;
 	struct cmtp_session *session = ctrl->driverdata;
 	struct cmtp_application *app;
-	struct list_head *p, *n;
+	struct list_head *p;
 
 	seq_printf(m, "%s\n\n", cmtp_procinfo(ctrl));
 	seq_printf(m, "addr %s\n", session->name);
 	seq_printf(m, "ctrl %d\n", session->num);
 
-	list_for_each_safe(p, n, &session->applications) {
+	list_for_each(p,  &session->applications) {
 		app = list_entry(p, struct cmtp_application, list);
 		seq_printf(m, "appl %d -> %d\n", app->appl, app->mapping);
 	}
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1186239 — Re: [PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not needed

FromJulia Lawall <julia.lawall@lip6.fr>
Date2015-07-16 23:00 +0200
SubjectRe: [PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not needed
Message-ID<pMYq6-14c-19@gated-at.bofh.it>
In reply to#1186220
On Thu, 16 Jul 2015, Christophe JAILLET wrote:

> There is no need to use the safe version of list_for_each here.
Why not list_for_each_entry?  Maybe it's too much of a change to make at
once...

julia

>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  net/bluetooth/cmtp/capi.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/bluetooth/cmtp/capi.c b/net/bluetooth/cmtp/capi.c
> index b0c6c6a..4c5e3e0 100644
> --- a/net/bluetooth/cmtp/capi.c
> +++ b/net/bluetooth/cmtp/capi.c
> @@ -100,9 +100,9 @@ static void cmtp_application_del(struct cmtp_session *session, struct cmtp_appli
>  static struct cmtp_application *cmtp_application_get(struct cmtp_session *session, int pattern, __u16 value)
>  {
>  	struct cmtp_application *app;
> -	struct list_head *p, *n;
> +	struct list_head *p;
>
> -	list_for_each_safe(p, n, &session->applications) {
> +	list_for_each(p, &session->applications) {
>  		app = list_entry(p, struct cmtp_application, list);
>  		switch (pattern) {
>  		case CMTP_MSGNUM:
> @@ -511,13 +511,13 @@ static int cmtp_proc_show(struct seq_file *m, void *v)
>  	struct capi_ctr *ctrl = m->private;
>  	struct cmtp_session *session = ctrl->driverdata;
>  	struct cmtp_application *app;
> -	struct list_head *p, *n;
> +	struct list_head *p;
>
>  	seq_printf(m, "%s\n\n", cmtp_procinfo(ctrl));
>  	seq_printf(m, "addr %s\n", session->name);
>  	seq_printf(m, "ctrl %d\n", session->num);
>
> -	list_for_each_safe(p, n, &session->applications) {
> +	list_for_each(p,  &session->applications) {
>  		app = list_entry(p, struct cmtp_application, list);
>  		seq_printf(m, "appl %d -> %d\n", app->appl, app->mapping);
>  	}
> --
> 2.1.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web