diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-27 17:57:24 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-27 18:52:34 -0500 |
commit | 0b60eba1b29740a606e6b7694d2dc98b6085a1bf (patch) | |
tree | b8e0a808062b3d8bdee50f48bcc39574a4fba3e2 /net/bluetooth | |
parent | 816a11d5ced501d368fabe09172f3d62744e8b53 (diff) |
Bluetooth: Don't send unnecessary write_le_enable command
If the local host features indicate that LE is already in the state that
is desired there's no point in sending the HCI command to try to change
the setting.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/mgmt.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 27830f401698..c4d3bc9c86b5 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1260,7 +1260,7 @@ static int set_le(struct sock *sk, u16 index, void *data, u16 len) | |||
1260 | struct pending_cmd *cmd; | 1260 | struct pending_cmd *cmd; |
1261 | struct hci_dev *hdev; | 1261 | struct hci_dev *hdev; |
1262 | int err; | 1262 | int err; |
1263 | u8 val; | 1263 | u8 val, enabled; |
1264 | 1264 | ||
1265 | BT_DBG("request for hci%u", index); | 1265 | BT_DBG("request for hci%u", index); |
1266 | 1266 | ||
@@ -1280,8 +1280,9 @@ static int set_le(struct sock *sk, u16 index, void *data, u16 len) | |||
1280 | } | 1280 | } |
1281 | 1281 | ||
1282 | val = !!cp->val; | 1282 | val = !!cp->val; |
1283 | enabled = !!(hdev->host_features[0] & LMP_HOST_LE); | ||
1283 | 1284 | ||
1284 | if (!hdev_is_powered(hdev)) { | 1285 | if (!hdev_is_powered(hdev) || val == enabled) { |
1285 | bool changed = false; | 1286 | bool changed = false; |
1286 | 1287 | ||
1287 | if (val != test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { | 1288 | if (val != test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { |