linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Bluetooth: Don't send unnecessary write_le_enable command
@ 2012-02-27 23:41 johan.hedberg
  2012-02-27 23:41 ` [PATCH 2/2] Bluetooth: Remove redundant read_host_features commands johan.hedberg
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: johan.hedberg @ 2012-02-27 23:41 UTC (permalink / raw)
  To: linux-bluetooth

From: Johan Hedberg <johan.hedberg@intel.com>

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>
---
 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 27830f4..5373bc1 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)
 	struct pending_cmd *cmd;
 	struct hci_dev *hdev;
 	int err;
-	u8 val;
+	u8 val, enabled;
 
 	BT_DBG("request for hci%u", index);
 
@@ -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] & 0x02);
 
-	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)) {
-- 
1.7.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-02-28 17:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-27 23:41 [PATCH 1/2] Bluetooth: Don't send unnecessary write_le_enable command johan.hedberg
2012-02-27 23:41 ` [PATCH 2/2] Bluetooth: Remove redundant read_host_features commands johan.hedberg
2012-02-28  8:01   ` Andrei Emeltchenko
2012-02-28  8:53     ` Johan Hedberg
2012-02-27 23:43 ` [PATCH 1/2] Bluetooth: Don't send unnecessary write_le_enable command Marcel Holtmann
2012-02-28 17:31 ` Andre Guedes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).