Commit cd11cdd2 authored by Gustavo F. Padovan's avatar Gustavo F. Padovan

Bluetooth: use list_for_each_entry() in hidp

list_for_each_entry is much more meaningful.
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 794d1756
...@@ -81,12 +81,10 @@ static unsigned char hidp_mkeyspat[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }; ...@@ -81,12 +81,10 @@ static unsigned char hidp_mkeyspat[] = { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
static struct hidp_session *__hidp_get_session(bdaddr_t *bdaddr) static struct hidp_session *__hidp_get_session(bdaddr_t *bdaddr)
{ {
struct hidp_session *session; struct hidp_session *session;
struct list_head *p;
BT_DBG(""); BT_DBG("");
list_for_each(p, &hidp_session_list) { list_for_each_entry(session, &hidp_session_list, list) {
session = list_entry(p, struct hidp_session, list);
if (!bacmp(bdaddr, &session->bdaddr)) if (!bacmp(bdaddr, &session->bdaddr))
return session; return session;
} }
...@@ -1140,19 +1138,16 @@ int hidp_del_connection(struct hidp_conndel_req *req) ...@@ -1140,19 +1138,16 @@ int hidp_del_connection(struct hidp_conndel_req *req)
int hidp_get_connlist(struct hidp_connlist_req *req) int hidp_get_connlist(struct hidp_connlist_req *req)
{ {
struct list_head *p; struct hidp_session *session;
int err = 0, n = 0; int err = 0, n = 0;
BT_DBG(""); BT_DBG("");
down_read(&hidp_session_sem); down_read(&hidp_session_sem);
list_for_each(p, &hidp_session_list) { list_for_each_entry(session, &hidp_session_list, list) {
struct hidp_session *session;
struct hidp_conninfo ci; struct hidp_conninfo ci;
session = list_entry(p, struct hidp_session, list);
__hidp_copy_session(session, &ci); __hidp_copy_session(session, &ci);
if (copy_to_user(req->ci, &ci, sizeof(ci))) { if (copy_to_user(req->ci, &ci, sizeof(ci))) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment