* [PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not needed
@ 2015-07-16 20:17 Christophe JAILLET
2015-07-16 20:52 ` Julia Lawall
2015-07-30 11:51 ` Marcel Holtmann
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2015-07-16 20:17 UTC (permalink / raw)
To: marcel, gustavo, johan.hedberg, davem
Cc: linux-bluetooth, linux-kernel, kernel-janitors,
Christophe JAILLET
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not needed
2015-07-16 20:17 [PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not needed Christophe JAILLET
@ 2015-07-16 20:52 ` Julia Lawall
2015-07-30 11:51 ` Marcel Holtmann
1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2015-07-16 20:52 UTC (permalink / raw)
To: Christophe JAILLET
Cc: marcel, gustavo, johan.hedberg, davem, linux-bluetooth,
linux-kernel, kernel-janitors
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not needed
2015-07-16 20:17 [PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not needed Christophe JAILLET
2015-07-16 20:52 ` Julia Lawall
@ 2015-07-30 11:51 ` Marcel Holtmann
1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2015-07-30 11:51 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Gustavo F. Padovan, Johan Hedberg, David S. Miller,
linux-bluetooth, linux-kernel, kernel-janitors
Hi Christophe,
> 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) {
you have two spaces here. I fixed that and applied the patch.
Regards
Marcel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-30 11:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-16 20:17 [PATCH] Bluetooth: cmtp: Do not use list_for_each_safe when not needed Christophe JAILLET
2015-07-16 20:52 ` Julia Lawall
2015-07-30 11:51 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox