Bluetooth: Separate AMP controller type from HCI device type
authorMarcel Holtmann <marcel@holtmann.org>
Sat, 5 Oct 2013 18:47:43 +0000 (11:47 -0700)
committerJohan Hedberg <johan.hedberg@intel.com>
Sun, 6 Oct 2013 08:22:38 +0000 (10:22 +0200)
There are two defined HCI device types. One is for BR/EDR controllers
and the other is for AMP controllers. The HCI device type is not the
same as the AMP controller type. It just happens that currently the
defined types match, but that is not guaranteed.

Split the usage of AMP controller type into its own domain so that
it is possible to separate between BR/EDR controllers, 802.11 AMP
controllers and any other AMP technology that might be defined in
the future.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
include/net/bluetooth/hci_core.h
net/bluetooth/a2mp.c

index db650baf81779688ff0c2c43a032c3557925add0..4cb355b023a49b3d7ef4da58e68188d7953244b1 100644 (file)
@@ -803,7 +803,7 @@ static inline bool hci_amp_capable(void)
 
        read_lock(&hci_dev_list_lock);
        list_for_each_entry(hdev, &hci_dev_list, list)
-               if (hdev->amp_type == HCI_AMP &&
+               if (hdev->amp_type != AMP_TYPE_BREDR &&
                    test_bit(HCI_UP, &hdev->flags))
                        ret = true;
        read_unlock(&hci_dev_list_lock);
index a6e45e177b3d9e0cc4257a07bb074771a8ed5cc5..b2ef3d392a0e8c03c9652fa8444c552676334f75 100644 (file)
@@ -78,7 +78,7 @@ u8 __next_ident(struct amp_mgr *mgr)
 static inline void __a2mp_cl_bredr(struct a2mp_cl *cl)
 {
        cl->id = 0;
-       cl->type = 0;
+       cl->type = AMP_TYPE_BREDR;
        cl->status = 1;
 }
 
@@ -352,7 +352,7 @@ static int a2mp_getampassoc_req(struct amp_mgr *mgr, struct sk_buff *skb,
        tmp = amp_mgr_lookup_by_state(READ_LOC_AMP_ASSOC);
 
        hdev = hci_dev_get(req->id);
-       if (!hdev || hdev->amp_type == HCI_BREDR || tmp) {
+       if (!hdev || hdev->amp_type == AMP_TYPE_BREDR || tmp) {
                struct a2mp_amp_assoc_rsp rsp;
                rsp.id = req->id;
 
@@ -459,7 +459,7 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
        rsp.remote_id = req->local_id;
 
        hdev = hci_dev_get(req->remote_id);
-       if (!hdev || hdev->amp_type != HCI_AMP) {
+       if (!hdev || hdev->amp_type == AMP_TYPE_BREDR) {
                rsp.status = A2MP_STATUS_INVALID_CTRL_ID;
                goto send_rsp;
        }
@@ -879,7 +879,7 @@ void a2mp_send_getinfo_rsp(struct hci_dev *hdev)
        rsp.id = hdev->id;
        rsp.status = A2MP_STATUS_INVALID_CTRL_ID;
 
-       if (hdev->amp_type != HCI_BREDR) {
+       if (hdev->amp_type != AMP_TYPE_BREDR) {
                rsp.status = 0;
                rsp.total_bw = cpu_to_le32(hdev->amp_total_bw);
                rsp.max_bw = cpu_to_le32(hdev->amp_max_bw);