Skip to content

Commit

Permalink
Bluetooth: Don't send unnecessary write_le_enable command
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johan Hedberg committed Feb 27, 2012
1 parent 816a11d commit 0b60eba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,7 @@ static int set_le(struct sock *sk, u16 index, void *data, u16 len)
struct pending_cmd *cmd;
struct hci_dev *hdev;
int err;
u8 val;
u8 val, enabled;

BT_DBG("request for hci%u", index);

Expand All @@ -1280,8 +1280,9 @@ static int set_le(struct sock *sk, u16 index, void *data, u16 len)
}

val = !!cp->val;
enabled = !!(hdev->host_features[0] & LMP_HOST_LE);

if (!hdev_is_powered(hdev)) {
if (!hdev_is_powered(hdev) || val == enabled) {
bool changed = false;

if (val != test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) {
Expand Down

0 comments on commit 0b60eba

Please sign in to comment.