Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / net / bluetooth / hci_conn.c
index a2bd4b1..f812ed1 100644 (file)
@@ -30,7 +30,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
-#include <linux/major.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/poll.h>
@@ -348,6 +347,24 @@ int hci_conn_change_link_key(struct hci_conn *conn)
 }
 EXPORT_SYMBOL(hci_conn_change_link_key);
 
+/* Switch role */
+int hci_conn_switch_role(struct hci_conn *conn, uint8_t role)
+{
+       BT_DBG("conn %p", conn);
+
+       if (!role && conn->link_mode & HCI_LM_MASTER)
+               return 1;
+
+       if (!test_and_set_bit(HCI_CONN_RSWITCH_PEND, &conn->pend)) {
+               struct hci_cp_switch_role cp;
+               bacpy(&cp.bdaddr, &conn->dst);
+               cp.role = role;
+               hci_send_cmd(conn->hdev, OGF_LINK_POLICY, OCF_SWITCH_ROLE, sizeof(cp), &cp);
+       }
+       return 0;
+}
+EXPORT_SYMBOL(hci_conn_switch_role);
+
 /* Drop all connection on the device */
 void hci_conn_hash_flush(struct hci_dev *hdev)
 {
@@ -386,7 +403,7 @@ int hci_get_conn_list(void __user *arg)
 
        size = sizeof(req) + req.conn_num * sizeof(*ci);
 
-       if (!(cl = (void *) kmalloc(size, GFP_KERNEL)))
+       if (!(cl = kmalloc(size, GFP_KERNEL)))
                return -ENOMEM;
 
        if (!(hdev = hci_dev_get(req.dev_id))) {