From b92d3eea9041f143fd9d54c104110c3d55427f8f Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Thu, 29 Nov 2012 17:46:05 +0200 Subject: [PATCH] --- yaml --- r: 341951 b: refs/heads/master c: 5d05416e0907b0dd30b62b002bed3b85e6efbd61 h: refs/heads/master i: 341949: 18be2f9d53912a9e64a281c798aa90ec035297b7 341947: a3b2fc9a530790091b468172be65f23441b2603f 341943: 15ed11c67954a112ceff0a52f2b68865aecbcf15 341935: ebe9b0fed21b554e41d64d331a5a5b92eca9533c 341919: e7c5ee32b3acd3f0d8d076288580611e1f7bfbf1 341887: 37d4e48455db2f41ef25409736cdaea02998ca04 v: v3 --- [refs] | 2 +- trunk/include/net/bluetooth/hci_core.h | 16 ++++++++++++++++ trunk/net/bluetooth/l2cap_core.c | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 77febb73e744..ef809157b9d2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ced5c338d7b696021058c23fb6a286def2171df5 +refs/heads/master: 5d05416e0907b0dd30b62b002bed3b85e6efbd61 diff --git a/trunk/include/net/bluetooth/hci_core.h b/trunk/include/net/bluetooth/hci_core.h index 2f2b743f5b10..014a2eaa5389 100644 --- a/trunk/include/net/bluetooth/hci_core.h +++ b/trunk/include/net/bluetooth/hci_core.h @@ -779,6 +779,22 @@ void hci_conn_del_sysfs(struct hci_conn *conn); #define lmp_host_le_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE) #define lmp_host_le_br_capable(dev) !!((dev)->host_features[0] & LMP_HOST_LE_BREDR) +/* returns true if at least one AMP active */ +static inline bool hci_amp_capable(void) +{ + struct hci_dev *hdev; + bool ret = false; + + read_lock(&hci_dev_list_lock); + list_for_each_entry(hdev, &hci_dev_list, list) + if (hdev->amp_type == HCI_AMP && + test_bit(HCI_UP, &hdev->flags)) + ret = true; + read_unlock(&hci_dev_list_lock); + + return ret; +} + /* ----- HCI protocols ----- */ #define HCI_PROTO_DEFER 0x01 diff --git a/trunk/net/bluetooth/l2cap_core.c b/trunk/net/bluetooth/l2cap_core.c index f7ee037c7934..d8cffdbf0d37 100644 --- a/trunk/net/bluetooth/l2cap_core.c +++ b/trunk/net/bluetooth/l2cap_core.c @@ -1013,6 +1013,7 @@ static bool __amp_capable(struct l2cap_chan *chan) struct l2cap_conn *conn = chan->conn; if (enable_hs && + hci_amp_capable() && chan->chan_policy == BT_CHANNEL_POLICY_AMP_PREFERRED && conn->fixed_chan_mask & L2CAP_FC_A2MP) return true;