Skip to content

Commit 711584e

Browse files
kda88Gustavo Padovan
authored andcommitted
Bluetooth:Replace list_for_each with list_for_each_entry() helper
Replace list_for_each with list_for_each_entry() helper Signed-off-by: Denis Kirjanov <kirjanov@gmail.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
1 parent 4611dfa commit 711584e

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

‎include/net/bluetooth/hci_core.h‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ struct hci_cb {
880880

881881
static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
882882
{
883-
struct list_head *p;
883+
struct hci_cb *cb;
884884
__u8 encrypt;
885885

886886
hci_proto_auth_cfm(conn, status);
@@ -891,8 +891,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
891891
encrypt = (conn->link_mode & HCI_LM_ENCRYPT) ? 0x01 : 0x00;
892892

893893
read_lock(&hci_cb_list_lock);
894-
list_for_each(p, &hci_cb_list) {
895-
struct hci_cb *cb = list_entry(p, struct hci_cb, list);
894+
list_for_each_entry(cb, &hci_cb_list, list) {
896895
if (cb->security_cfm)
897896
cb->security_cfm(conn, status, encrypt);
898897
}
@@ -902,7 +901,7 @@ static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
902901
static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
903902
__u8 encrypt)
904903
{
905-
struct list_head *p;
904+
struct hci_cb *cb;
906905

907906
if (conn->sec_level == BT_SECURITY_SDP)
908907
conn->sec_level = BT_SECURITY_LOW;
@@ -913,8 +912,7 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
913912
hci_proto_encrypt_cfm(conn, status, encrypt);
914913

915914
read_lock(&hci_cb_list_lock);
916-
list_for_each(p, &hci_cb_list) {
917-
struct hci_cb *cb = list_entry(p, struct hci_cb, list);
915+
list_for_each_entry(cb, &hci_cb_list, list) {
918916
if (cb->security_cfm)
919917
cb->security_cfm(conn, status, encrypt);
920918
}
@@ -923,11 +921,10 @@ static inline void hci_encrypt_cfm(struct hci_conn *conn, __u8 status,
923921

924922
static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status)
925923
{
926-
struct list_head *p;
924+
struct hci_cb *cb;
927925

928926
read_lock(&hci_cb_list_lock);
929-
list_for_each(p, &hci_cb_list) {
930-
struct hci_cb *cb = list_entry(p, struct hci_cb, list);
927+
list_for_each_entry(cb, &hci_cb_list, list) {
931928
if (cb->key_change_cfm)
932929
cb->key_change_cfm(conn, status);
933930
}
@@ -937,11 +934,10 @@ static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status)
937934
static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status,
938935
__u8 role)
939936
{
940-
struct list_head *p;
937+
struct hci_cb *cb;
941938

942939
read_lock(&hci_cb_list_lock);
943-
list_for_each(p, &hci_cb_list) {
944-
struct hci_cb *cb = list_entry(p, struct hci_cb, list);
940+
list_for_each_entry(cb, &hci_cb_list, list) {
945941
if (cb->role_switch_cfm)
946942
cb->role_switch_cfm(conn, status, role);
947943
}

0 commit comments

Comments
 (0)