Commit f4280918 authored by Andrei Emeltchenko's avatar Andrei Emeltchenko Committed by Gustavo F. Padovan

Bluetooth: Simplify num_comp_pkts_evt function

Simplify function and remove fourth level of indentation.
Signed-off-by: default avatarAndrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarGustavo F. Padovan <padovan@profusion.mobi>
parent 350ee4cf
...@@ -2273,14 +2273,19 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s ...@@ -2273,14 +2273,19 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
count = get_unaligned_le16(ptr++); count = get_unaligned_le16(ptr++);
conn = hci_conn_hash_lookup_handle(hdev, handle); conn = hci_conn_hash_lookup_handle(hdev, handle);
if (conn) { if (!conn)
continue;
conn->sent -= count; conn->sent -= count;
if (conn->type == ACL_LINK) { switch (conn->type) {
case ACL_LINK:
hdev->acl_cnt += count; hdev->acl_cnt += count;
if (hdev->acl_cnt > hdev->acl_pkts) if (hdev->acl_cnt > hdev->acl_pkts)
hdev->acl_cnt = hdev->acl_pkts; hdev->acl_cnt = hdev->acl_pkts;
} else if (conn->type == LE_LINK) { break;
case LE_LINK:
if (hdev->le_pkts) { if (hdev->le_pkts) {
hdev->le_cnt += count; hdev->le_cnt += count;
if (hdev->le_cnt > hdev->le_pkts) if (hdev->le_cnt > hdev->le_pkts)
...@@ -2290,11 +2295,17 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s ...@@ -2290,11 +2295,17 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s
if (hdev->acl_cnt > hdev->acl_pkts) if (hdev->acl_cnt > hdev->acl_pkts)
hdev->acl_cnt = hdev->acl_pkts; hdev->acl_cnt = hdev->acl_pkts;
} }
} else { break;
case SCO_LINK:
hdev->sco_cnt += count; hdev->sco_cnt += count;
if (hdev->sco_cnt > hdev->sco_pkts) if (hdev->sco_cnt > hdev->sco_pkts)
hdev->sco_cnt = hdev->sco_pkts; hdev->sco_cnt = hdev->sco_pkts;
} break;
default:
BT_ERR("Unknown type %d conn %p", conn->type, conn);
break;
} }
} }
......
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