aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 00:04:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-21 00:04:44 -0400
commitf8965467f366fd18f01feafb5db10512d7b4422c (patch)
tree3706a9cd779859271ca61b85c63a1bc3f82d626e /net/bluetooth/hci_core.c
parenta26272e5200765691e67d6780e52b32498fdb659 (diff)
parent2ec8c6bb5d8f3a62a79f463525054bae1e3d4487 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1674 commits) qlcnic: adding co maintainer ixgbe: add support for active DA cables ixgbe: dcb, do not tag tc_prio_control frames ixgbe: fix ixgbe_tx_is_paused logic ixgbe: always enable vlan strip/insert when DCB is enabled ixgbe: remove some redundant code in setting FCoE FIP filter ixgbe: fix wrong offset to fc_frame_header in ixgbe_fcoe_ddp ixgbe: fix header len when unsplit packet overflows to data buffer ipv6: Never schedule DAD timer on dead address ipv6: Use POSTDAD state ipv6: Use state_lock to protect ifa state ipv6: Replace inet6_ifaddr->dead with state cxgb4: notify upper drivers if the device is already up when they load cxgb4: keep interrupts available when the ports are brought down cxgb4: fix initial addition of MAC address cnic: Return SPQ credit to bnx2x after ring setup and shutdown. cnic: Convert cnic_local_flags to atomic ops. can: Fix SJA1000 command register writes on SMP systems bridge: fix build for CONFIG_SYSFS disabled ARCNET: Limit com20020 PCI ID matches for SOHARD cards ... Fix up various conflicts with pcmcia tree drivers/net/ {pcmcia/3c589_cs.c, wireless/orinoco/orinoco_cs.c and wireless/orinoco/spectrum_cs.c} and feature removal (Documentation/feature-removal-schedule.txt). Also fix a non-content conflict due to pm_qos_requirement getting renamed in the PM tree (now pm_qos_request) in net/mac80211/scan.c
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 4ad23192c7a5..2f768de87011 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -37,6 +37,7 @@
37#include <linux/fcntl.h> 37#include <linux/fcntl.h>
38#include <linux/init.h> 38#include <linux/init.h>
39#include <linux/skbuff.h> 39#include <linux/skbuff.h>
40#include <linux/workqueue.h>
40#include <linux/interrupt.h> 41#include <linux/interrupt.h>
41#include <linux/notifier.h> 42#include <linux/notifier.h>
42#include <linux/rfkill.h> 43#include <linux/rfkill.h>
@@ -928,6 +929,10 @@ int hci_register_dev(struct hci_dev *hdev)
928 929
929 write_unlock_bh(&hci_dev_list_lock); 930 write_unlock_bh(&hci_dev_list_lock);
930 931
932 hdev->workqueue = create_singlethread_workqueue(hdev->name);
933 if (!hdev->workqueue)
934 goto nomem;
935
931 hci_register_sysfs(hdev); 936 hci_register_sysfs(hdev);
932 937
933 hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev, 938 hdev->rfkill = rfkill_alloc(hdev->name, &hdev->dev,
@@ -942,6 +947,13 @@ int hci_register_dev(struct hci_dev *hdev)
942 hci_notify(hdev, HCI_DEV_REG); 947 hci_notify(hdev, HCI_DEV_REG);
943 948
944 return id; 949 return id;
950
951nomem:
952 write_lock_bh(&hci_dev_list_lock);
953 list_del(&hdev->list);
954 write_unlock_bh(&hci_dev_list_lock);
955
956 return -ENOMEM;
945} 957}
946EXPORT_SYMBOL(hci_register_dev); 958EXPORT_SYMBOL(hci_register_dev);
947 959
@@ -970,6 +982,8 @@ int hci_unregister_dev(struct hci_dev *hdev)
970 982
971 hci_unregister_sysfs(hdev); 983 hci_unregister_sysfs(hdev);
972 984
985 destroy_workqueue(hdev->workqueue);
986
973 __hci_dev_put(hdev); 987 __hci_dev_put(hdev);
974 988
975 return 0; 989 return 0;
@@ -1260,7 +1274,7 @@ static void hci_add_acl_hdr(struct sk_buff *skb, __u16 handle, __u16 flags)
1260 hdr->dlen = cpu_to_le16(len); 1274 hdr->dlen = cpu_to_le16(len);
1261} 1275}
1262 1276
1263int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags) 1277void hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags)
1264{ 1278{
1265 struct hci_dev *hdev = conn->hdev; 1279 struct hci_dev *hdev = conn->hdev;
1266 struct sk_buff *list; 1280 struct sk_buff *list;
@@ -1302,24 +1316,17 @@ int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags)
1302 } 1316 }
1303 1317
1304 tasklet_schedule(&hdev->tx_task); 1318 tasklet_schedule(&hdev->tx_task);
1305
1306 return 0;
1307} 1319}
1308EXPORT_SYMBOL(hci_send_acl); 1320EXPORT_SYMBOL(hci_send_acl);
1309 1321
1310/* Send SCO data */ 1322/* Send SCO data */
1311int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb) 1323void hci_send_sco(struct hci_conn *conn, struct sk_buff *skb)
1312{ 1324{
1313 struct hci_dev *hdev = conn->hdev; 1325 struct hci_dev *hdev = conn->hdev;
1314 struct hci_sco_hdr hdr; 1326 struct hci_sco_hdr hdr;
1315 1327
1316 BT_DBG("%s len %d", hdev->name, skb->len); 1328 BT_DBG("%s len %d", hdev->name, skb->len);
1317 1329
1318 if (skb->len > hdev->sco_mtu) {
1319 kfree_skb(skb);
1320 return -EINVAL;
1321 }
1322
1323 hdr.handle = cpu_to_le16(conn->handle); 1330 hdr.handle = cpu_to_le16(conn->handle);
1324 hdr.dlen = skb->len; 1331 hdr.dlen = skb->len;
1325 1332
@@ -1332,8 +1339,6 @@ int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb)
1332 1339
1333 skb_queue_tail(&conn->data_q, skb); 1340 skb_queue_tail(&conn->data_q, skb);
1334 tasklet_schedule(&hdev->tx_task); 1341 tasklet_schedule(&hdev->tx_task);
1335
1336 return 0;
1337} 1342}
1338EXPORT_SYMBOL(hci_send_sco); 1343EXPORT_SYMBOL(hci_send_sco);
1339 1344