diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2011-11-01 04:58:56 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-11-07 14:24:46 -0500 |
commit | 8035ded466049ca2fe8c04564a0fa00f222abe3f (patch) | |
tree | f589157028c85ebaa17be9f329405d1ccffa6304 /net/bluetooth/cmtp | |
parent | 457f48507deb0e8c8dd299c7d8dce7c2c0e291e8 (diff) |
Bluetooth: replace list_for_each with list_for_each_entry whenever possible
When all items in the list have the same type there is no much of a point
to use list_for_each except if you want to use the list pointer itself.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/cmtp')
-rw-r--r-- | net/bluetooth/cmtp/core.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c index 7d00ddf9e9dc..9e8940b24bba 100644 --- a/net/bluetooth/cmtp/core.c +++ b/net/bluetooth/cmtp/core.c | |||
@@ -53,15 +53,13 @@ static LIST_HEAD(cmtp_session_list); | |||
53 | static struct cmtp_session *__cmtp_get_session(bdaddr_t *bdaddr) | 53 | static struct cmtp_session *__cmtp_get_session(bdaddr_t *bdaddr) |
54 | { | 54 | { |
55 | struct cmtp_session *session; | 55 | struct cmtp_session *session; |
56 | struct list_head *p; | ||
57 | 56 | ||
58 | BT_DBG(""); | 57 | BT_DBG(""); |
59 | 58 | ||
60 | list_for_each(p, &cmtp_session_list) { | 59 | list_for_each_entry(session, &cmtp_session_list, list) |
61 | session = list_entry(p, struct cmtp_session, list); | ||
62 | if (!bacmp(bdaddr, &session->bdaddr)) | 60 | if (!bacmp(bdaddr, &session->bdaddr)) |
63 | return session; | 61 | return session; |
64 | } | 62 | |
65 | return NULL; | 63 | return NULL; |
66 | } | 64 | } |
67 | 65 | ||
@@ -431,19 +429,16 @@ int cmtp_del_connection(struct cmtp_conndel_req *req) | |||
431 | 429 | ||
432 | int cmtp_get_connlist(struct cmtp_connlist_req *req) | 430 | int cmtp_get_connlist(struct cmtp_connlist_req *req) |
433 | { | 431 | { |
434 | struct list_head *p; | 432 | struct cmtp_session *session; |
435 | int err = 0, n = 0; | 433 | int err = 0, n = 0; |
436 | 434 | ||
437 | BT_DBG(""); | 435 | BT_DBG(""); |
438 | 436 | ||
439 | down_read(&cmtp_session_sem); | 437 | down_read(&cmtp_session_sem); |
440 | 438 | ||
441 | list_for_each(p, &cmtp_session_list) { | 439 | list_for_each_entry(session, &cmtp_session_list, list) { |
442 | struct cmtp_session *session; | ||
443 | struct cmtp_conninfo ci; | 440 | struct cmtp_conninfo ci; |
444 | 441 | ||
445 | session = list_entry(p, struct cmtp_session, list); | ||
446 | |||
447 | __cmtp_copy_session(session, &ci); | 442 | __cmtp_copy_session(session, &ci); |
448 | 443 | ||
449 | if (copy_to_user(req->ci, &ci, sizeof(ci))) { | 444 | if (copy_to_user(req->ci, &ci, sizeof(ci))) { |