[PATCH] i386: PARAVIRT: Export paravirt_ops for non GPL modules too
[powerpc.git] / net / bluetooth / hci_conn.c
index 90e3a28..63980bd 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
    BlueZ - Bluetooth protocol stack for Linux
    Copyright (C) 2000-2001 Qualcomm Incorporated
 
    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
-   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 
-   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 
-   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 
+   CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
-   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 
-   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 
+   ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
+   COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
    SOFTWARE IS DISCLAIMED.
 */
 
@@ -29,7 +29,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/poll.h>
 #include <linux/fcntl.h>
@@ -51,7 +50,7 @@
 #define BT_DBG(D...)
 #endif
 
-static void hci_acl_connect(struct hci_conn *conn)
+void hci_acl_connect(struct hci_conn *conn)
 {
        struct hci_dev *hdev = conn->hdev;
        struct inquiry_entry *ie;
@@ -63,6 +62,8 @@ static void hci_acl_connect(struct hci_conn *conn)
        conn->out   = 1;
        conn->link_mode = HCI_LM_MASTER;
 
+       conn->attempt++;
+
        memset(&cp, 0, sizeof(cp));
        bacpy(&cp.bdaddr, &conn->dst);
        cp.pscan_rep_mode = 0x02;
@@ -71,16 +72,16 @@ static void hci_acl_connect(struct hci_conn *conn)
                        inquiry_entry_age(ie) <= INQUIRY_ENTRY_AGE_MAX) {
                cp.pscan_rep_mode = ie->data.pscan_rep_mode;
                cp.pscan_mode     = ie->data.pscan_mode;
-               cp.clock_offset   = ie->data.clock_offset | __cpu_to_le16(0x8000);
+               cp.clock_offset   = ie->data.clock_offset | cpu_to_le16(0x8000);
                memcpy(conn->dev_class, ie->data.dev_class, 3);
        }
 
-       cp.pkt_type = __cpu_to_le16(hdev->pkt_type & ACL_PTYPE_MASK);
+       cp.pkt_type = cpu_to_le16(hdev->pkt_type & ACL_PTYPE_MASK);
        if (lmp_rswitch_capable(hdev) && !(hdev->link_mode & HCI_LM_MASTER))
                cp.role_switch  = 0x01;
        else
                cp.role_switch  = 0x00;
-               
+
        hci_send_cmd(hdev, OGF_LINK_CTL, OCF_CREATE_CONN, sizeof(cp), &cp);
 }
 
@@ -106,7 +107,7 @@ void hci_acl_disconn(struct hci_conn *conn, __u8 reason)
 
        conn->state = BT_DISCONN;
 
-       cp.handle = __cpu_to_le16(conn->handle);
+       cp.handle = cpu_to_le16(conn->handle);
        cp.reason = reason;
        hci_send_cmd(conn->hdev, OGF_LINK_CTL,
                                OCF_DISCONNECT, sizeof(cp), &cp);
@@ -122,8 +123,8 @@ void hci_add_sco(struct hci_conn *conn, __u16 handle)
        conn->state = BT_CONNECT;
        conn->out = 1;
 
-       cp.pkt_type = __cpu_to_le16(hdev->pkt_type & SCO_PTYPE_MASK);
-       cp.handle   = __cpu_to_le16(handle);
+       cp.pkt_type = cpu_to_le16(hdev->pkt_type & SCO_PTYPE_MASK);
+       cp.handle   = cpu_to_le16(handle);
 
        hci_send_cmd(hdev, OGF_LINK_CTL, OCF_ADD_SCO, sizeof(cp), &cp);
 }
@@ -144,7 +145,7 @@ static void hci_conn_timeout(unsigned long arg)
        case BT_CONNECT:
                hci_acl_connect_cancel(conn);
                break;
-       case BT_CONNECTED:
+       case BT_CONNECTED:
                hci_acl_disconn(conn, 0x13);
                break;
        default:
@@ -270,7 +271,7 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src)
                if (!test_bit(HCI_UP, &d->flags) || test_bit(HCI_RAW, &d->flags))
                        continue;
 
-               /* Simple routing: 
+               /* Simple routing:
                 *   No source address - find interface with bdaddr != dst
                 *   Source address    - find interface with bdaddr == src
                 */
@@ -326,7 +327,7 @@ struct hci_conn * hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst)
 
                hci_conn_hold(sco);
 
-               if (acl->state == BT_CONNECTED && 
+               if (acl->state == BT_CONNECTED &&
                                (sco->state == BT_OPEN || sco->state == BT_CLOSED))
                        hci_add_sco(sco, acl->handle);
 
@@ -347,7 +348,7 @@ int hci_conn_auth(struct hci_conn *conn)
 
        if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) {
                struct hci_cp_auth_requested cp;
-               cp.handle = __cpu_to_le16(conn->handle);
+               cp.handle = cpu_to_le16(conn->handle);
                hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_AUTH_REQUESTED, sizeof(cp), &cp);
        }
        return 0;
@@ -367,8 +368,8 @@ int hci_conn_encrypt(struct hci_conn *conn)
 
        if (hci_conn_auth(conn)) {
                struct hci_cp_set_conn_encrypt cp;
-               cp.handle  = __cpu_to_le16(conn->handle);
-               cp.encrypt = 1; 
+               cp.handle  = cpu_to_le16(conn->handle);
+               cp.encrypt = 1;
                hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_SET_CONN_ENCRYPT, sizeof(cp), &cp);
        }
        return 0;
@@ -382,7 +383,7 @@ int hci_conn_change_link_key(struct hci_conn *conn)
 
        if (!test_and_set_bit(HCI_CONN_AUTH_PEND, &conn->pend)) {
                struct hci_cp_change_conn_link_key cp;
-               cp.handle = __cpu_to_le16(conn->handle);
+               cp.handle = cpu_to_le16(conn->handle);
                hci_send_cmd(conn->hdev, OGF_LINK_CTL, OCF_CHANGE_CONN_LINK_KEY, sizeof(cp), &cp);
        }
        return 0;
@@ -422,7 +423,7 @@ void hci_conn_enter_active_mode(struct hci_conn *conn)
 
        if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) {
                struct hci_cp_exit_sniff_mode cp;
-               cp.handle = __cpu_to_le16(conn->handle);
+               cp.handle = cpu_to_le16(conn->handle);
                hci_send_cmd(hdev, OGF_LINK_POLICY,
                                OCF_EXIT_SNIFF_MODE, sizeof(cp), &cp);
        }
@@ -451,21 +452,21 @@ void hci_conn_enter_sniff_mode(struct hci_conn *conn)
 
        if (lmp_sniffsubr_capable(hdev) && lmp_sniffsubr_capable(conn)) {
                struct hci_cp_sniff_subrate cp;
-               cp.handle             = __cpu_to_le16(conn->handle);
-               cp.max_latency        = __constant_cpu_to_le16(0);
-               cp.min_remote_timeout = __constant_cpu_to_le16(0);
-               cp.min_local_timeout  = __constant_cpu_to_le16(0);
+               cp.handle             = cpu_to_le16(conn->handle);
+               cp.max_latency        = cpu_to_le16(0);
+               cp.min_remote_timeout = cpu_to_le16(0);
+               cp.min_local_timeout  = cpu_to_le16(0);
                hci_send_cmd(hdev, OGF_LINK_POLICY,
                                OCF_SNIFF_SUBRATE, sizeof(cp), &cp);
        }
 
        if (!test_and_set_bit(HCI_CONN_MODE_CHANGE_PEND, &conn->pend)) {
                struct hci_cp_sniff_mode cp;
-               cp.handle       = __cpu_to_le16(conn->handle);
-               cp.max_interval = __cpu_to_le16(hdev->sniff_max_interval);
-               cp.min_interval = __cpu_to_le16(hdev->sniff_min_interval);
-               cp.attempt      = __constant_cpu_to_le16(4);
-               cp.timeout      = __constant_cpu_to_le16(1);
+               cp.handle       = cpu_to_le16(conn->handle);
+               cp.max_interval = cpu_to_le16(hdev->sniff_max_interval);
+               cp.min_interval = cpu_to_le16(hdev->sniff_min_interval);
+               cp.attempt      = cpu_to_le16(4);
+               cp.timeout      = cpu_to_le16(1);
                hci_send_cmd(hdev, OGF_LINK_POLICY,
                                OCF_SNIFF_MODE, sizeof(cp), &cp);
        }