aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorUlisses Furquim <ulisses@profusion.mobi>2011-12-21 07:11:33 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2011-12-22 11:07:29 -0500
commit686ebf283ba19f82abd8aaec023cd124749be9ec (patch)
tree9d10d8bc79779756dd8833a2c6ef8d5ad019ac81 /net/bluetooth/hci_core.c
parent68a8aea45973c8d0bc05f58389ce9e82e04bb5f6 (diff)
Bluetooth: Make HCI call directly into SCO and L2CAP event functions
The struct hci_proto and all related register/unregister and dispatching code was removed. HCI core code now call directly the SCO and L2CAP event functions. Signed-off-by: Ulisses Furquim <ulisses@profusion.mobi> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c59
1 files changed, 4 insertions, 55 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index fea8dad72e3a..22c8331cd0d5 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -69,10 +69,6 @@ DEFINE_RWLOCK(hci_dev_list_lock);
69LIST_HEAD(hci_cb_list); 69LIST_HEAD(hci_cb_list);
70DEFINE_RWLOCK(hci_cb_list_lock); 70DEFINE_RWLOCK(hci_cb_list_lock);
71 71
72/* HCI protocols */
73#define HCI_MAX_PROTO 2
74struct hci_proto *hci_proto[HCI_MAX_PROTO];
75
76/* HCI notifiers list */ 72/* HCI notifiers list */
77static ATOMIC_NOTIFIER_HEAD(hci_notifier); 73static ATOMIC_NOTIFIER_HEAD(hci_notifier);
78 74
@@ -1830,43 +1826,6 @@ EXPORT_SYMBOL(hci_recv_stream_fragment);
1830 1826
1831/* ---- Interface to upper protocols ---- */ 1827/* ---- Interface to upper protocols ---- */
1832 1828
1833/* Register/Unregister protocols. */
1834int hci_register_proto(struct hci_proto *hp)
1835{
1836 int err = 0;
1837
1838 BT_DBG("%p name %s id %d", hp, hp->name, hp->id);
1839
1840 if (hp->id >= HCI_MAX_PROTO)
1841 return -EINVAL;
1842
1843 if (!hci_proto[hp->id])
1844 hci_proto[hp->id] = hp;
1845 else
1846 err = -EEXIST;
1847
1848 return err;
1849}
1850EXPORT_SYMBOL(hci_register_proto);
1851
1852int hci_unregister_proto(struct hci_proto *hp)
1853{
1854 int err = 0;
1855
1856 BT_DBG("%p name %s id %d", hp, hp->name, hp->id);
1857
1858 if (hp->id >= HCI_MAX_PROTO)
1859 return -EINVAL;
1860
1861 if (hci_proto[hp->id])
1862 hci_proto[hp->id] = NULL;
1863 else
1864 err = -ENOENT;
1865
1866 return err;
1867}
1868EXPORT_SYMBOL(hci_unregister_proto);
1869
1870int hci_register_cb(struct hci_cb *cb) 1829int hci_register_cb(struct hci_cb *cb)
1871{ 1830{
1872 BT_DBG("%p name %s", cb, cb->name); 1831 BT_DBG("%p name %s", cb, cb->name);
@@ -2470,16 +2429,11 @@ static inline void hci_acldata_packet(struct hci_dev *hdev, struct sk_buff *skb)
2470 hci_dev_unlock(hdev); 2429 hci_dev_unlock(hdev);
2471 2430
2472 if (conn) { 2431 if (conn) {
2473 register struct hci_proto *hp;
2474
2475 hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF); 2432 hci_conn_enter_active_mode(conn, BT_POWER_FORCE_ACTIVE_OFF);
2476 2433
2477 /* Send to upper protocol */ 2434 /* Send to upper protocol */
2478 hp = hci_proto[HCI_PROTO_L2CAP]; 2435 l2cap_recv_acldata(conn, skb, flags);
2479 if (hp && hp->recv_acldata) { 2436 return;
2480 hp->recv_acldata(conn, skb, flags);
2481 return;
2482 }
2483 } else { 2437 } else {
2484 BT_ERR("%s ACL packet for unknown connection handle %d", 2438 BT_ERR("%s ACL packet for unknown connection handle %d",
2485 hdev->name, handle); 2439 hdev->name, handle);
@@ -2508,14 +2462,9 @@ static inline void hci_scodata_packet(struct hci_dev *hdev, struct sk_buff *skb)
2508 hci_dev_unlock(hdev); 2462 hci_dev_unlock(hdev);
2509 2463
2510 if (conn) { 2464 if (conn) {
2511 register struct hci_proto *hp;
2512
2513 /* Send to upper protocol */ 2465 /* Send to upper protocol */
2514 hp = hci_proto[HCI_PROTO_SCO]; 2466 sco_recv_scodata(conn, skb);
2515 if (hp && hp->recv_scodata) { 2467 return;
2516 hp->recv_scodata(conn, skb);
2517 return;
2518 }
2519 } else { 2468 } else {
2520 BT_ERR("%s SCO packet for unknown connection handle %d", 2469 BT_ERR("%s SCO packet for unknown connection handle %d",
2521 hdev->name, handle); 2470 hdev->name, handle);