vserver 2.0 rc7
[linux-2.6.git] / net / bluetooth / hci_conn.c
index a2bd4b1..a31244e 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)
 {