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/hci_conn.c | |
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/hci_conn.c')
-rw-r--r-- | net/bluetooth/hci_conn.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index c1c597e3e198..6e98ff3da2a4 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -453,16 +453,13 @@ int hci_conn_del(struct hci_conn *conn) | |||
453 | struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src) | 453 | struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src) |
454 | { | 454 | { |
455 | int use_src = bacmp(src, BDADDR_ANY); | 455 | int use_src = bacmp(src, BDADDR_ANY); |
456 | struct hci_dev *hdev = NULL; | 456 | struct hci_dev *hdev = NULL, *d; |
457 | struct list_head *p; | ||
458 | 457 | ||
459 | BT_DBG("%s -> %s", batostr(src), batostr(dst)); | 458 | BT_DBG("%s -> %s", batostr(src), batostr(dst)); |
460 | 459 | ||
461 | read_lock_bh(&hci_dev_list_lock); | 460 | read_lock_bh(&hci_dev_list_lock); |
462 | 461 | ||
463 | list_for_each(p, &hci_dev_list) { | 462 | list_for_each_entry(d, &hci_dev_list, list) { |
464 | struct hci_dev *d = list_entry(p, struct hci_dev, list); | ||
465 | |||
466 | if (!test_bit(HCI_UP, &d->flags) || test_bit(HCI_RAW, &d->flags)) | 463 | if (!test_bit(HCI_UP, &d->flags) || test_bit(HCI_RAW, &d->flags)) |
467 | continue; | 464 | continue; |
468 | 465 | ||
@@ -855,10 +852,10 @@ EXPORT_SYMBOL(hci_conn_put_device); | |||
855 | 852 | ||
856 | int hci_get_conn_list(void __user *arg) | 853 | int hci_get_conn_list(void __user *arg) |
857 | { | 854 | { |
855 | register struct hci_conn *c; | ||
858 | struct hci_conn_list_req req, *cl; | 856 | struct hci_conn_list_req req, *cl; |
859 | struct hci_conn_info *ci; | 857 | struct hci_conn_info *ci; |
860 | struct hci_dev *hdev; | 858 | struct hci_dev *hdev; |
861 | struct list_head *p; | ||
862 | int n = 0, size, err; | 859 | int n = 0, size, err; |
863 | 860 | ||
864 | if (copy_from_user(&req, arg, sizeof(req))) | 861 | if (copy_from_user(&req, arg, sizeof(req))) |
@@ -882,10 +879,7 @@ int hci_get_conn_list(void __user *arg) | |||
882 | ci = cl->conn_info; | 879 | ci = cl->conn_info; |
883 | 880 | ||
884 | hci_dev_lock_bh(hdev); | 881 | hci_dev_lock_bh(hdev); |
885 | list_for_each(p, &hdev->conn_hash.list) { | 882 | list_for_each_entry(c, &hdev->conn_hash.list, list) { |
886 | register struct hci_conn *c; | ||
887 | c = list_entry(p, struct hci_conn, list); | ||
888 | |||
889 | bacpy(&(ci + n)->bdaddr, &c->dst); | 883 | bacpy(&(ci + n)->bdaddr, &c->dst); |
890 | (ci + n)->handle = c->handle; | 884 | (ci + n)->handle = c->handle; |
891 | (ci + n)->type = c->type; | 885 | (ci + n)->type = c->type; |