diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-10-06 16:35:31 -0400 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-10-06 21:15:49 -0400 |
commit | cd11cdd28468d6222ce6489b2212fa7b0efaefdf (patch) | |
tree | a28addaebd7b1182a73a9d282dfe5f8a6681d992 /net/bluetooth/hidp | |
parent | 794d175698f0e78be7f2e3f4bdbe0e7cd3f2d6ae (diff) |
Bluetooth: use list_for_each_entry() in hidp
list_for_each_entry is much more meaningful.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hidp')
-rw-r--r-- | net/bluetooth/hidp/core.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c index d7bae2be83b2..08bfbb0f0926 100644 --- a/net/bluetooth/hidp/core.c +++ b/net/bluetooth/hidp/core.c | |||
@@ -81,12 +81,10 @@ static unsigned char hidp_mkeyspat[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; | |||
81 | static struct hidp_session *__hidp_get_session(bdaddr_t *bdaddr) | 81 | static struct hidp_session *__hidp_get_session(bdaddr_t *bdaddr) |
82 | { | 82 | { |
83 | struct hidp_session *session; | 83 | struct hidp_session *session; |
84 | struct list_head *p; | ||
85 | 84 | ||
86 | BT_DBG(""); | 85 | BT_DBG(""); |
87 | 86 | ||
88 | list_for_each(p, &hidp_session_list) { | 87 | list_for_each_entry(session, &hidp_session_list, list) { |
89 | session = list_entry(p, struct hidp_session, list); | ||
90 | if (!bacmp(bdaddr, &session->bdaddr)) | 88 | if (!bacmp(bdaddr, &session->bdaddr)) |
91 | return session; | 89 | return session; |
92 | } | 90 | } |
@@ -1140,19 +1138,16 @@ int hidp_del_connection(struct hidp_conndel_req *req) | |||
1140 | 1138 | ||
1141 | int hidp_get_connlist(struct hidp_connlist_req *req) | 1139 | int hidp_get_connlist(struct hidp_connlist_req *req) |
1142 | { | 1140 | { |
1143 | struct list_head *p; | 1141 | struct hidp_session *session; |
1144 | int err = 0, n = 0; | 1142 | int err = 0, n = 0; |
1145 | 1143 | ||
1146 | BT_DBG(""); | 1144 | BT_DBG(""); |
1147 | 1145 | ||
1148 | down_read(&hidp_session_sem); | 1146 | down_read(&hidp_session_sem); |
1149 | 1147 | ||
1150 | list_for_each(p, &hidp_session_list) { | 1148 | list_for_each_entry(session, &hidp_session_list, list) { |
1151 | struct hidp_session *session; | ||
1152 | struct hidp_conninfo ci; | 1149 | struct hidp_conninfo ci; |
1153 | 1150 | ||
1154 | session = list_entry(p, struct hidp_session, list); | ||
1155 | |||
1156 | __hidp_copy_session(session, &ci); | 1151 | __hidp_copy_session(session, &ci); |
1157 | 1152 | ||
1158 | if (copy_to_user(req->ci, &ci, sizeof(ci))) { | 1153 | if (copy_to_user(req->ci, &ci, sizeof(ci))) { |