Skip to content

Commit cd11cdd

Browse files
author
Gustavo F. Padovan
committed
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>
1 parent 794d175 commit cd11cdd

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

‎net/bluetooth/hidp/core.c‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,10 @@ static unsigned char hidp_mkeyspat[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
8181
static struct hidp_session *__hidp_get_session(bdaddr_t *bdaddr)
8282
{
8383
struct hidp_session *session;
84-
struct list_head *p;
8584

8685
BT_DBG("");
8786

88-
list_for_each(p, &hidp_session_list) {
89-
session = list_entry(p, struct hidp_session, list);
87+
list_for_each_entry(session, &hidp_session_list, list) {
9088
if (!bacmp(bdaddr, &session->bdaddr))
9189
return session;
9290
}
@@ -1140,19 +1138,16 @@ int hidp_del_connection(struct hidp_conndel_req *req)
11401138

11411139
int hidp_get_connlist(struct hidp_connlist_req *req)
11421140
{
1143-
struct list_head *p;
1141+
struct hidp_session *session;
11441142
int err = 0, n = 0;
11451143

11461144
BT_DBG("");
11471145

11481146
down_read(&hidp_session_sem);
11491147

1150-
list_for_each(p, &hidp_session_list) {
1151-
struct hidp_session *session;
1148+
list_for_each_entry(session, &hidp_session_list, list) {
11521149
struct hidp_conninfo ci;
11531150

1154-
session = list_entry(p, struct hidp_session, list);
1155-
11561151
__hidp_copy_session(session, &ci);
11571152

11581153
if (copy_to_user(req->ci, &ci, sizeof(ci))) {

0 commit comments

Comments
 (0)