From: Johan Hedberg Date: Wed, 24 Oct 2012 21:09:53 +0000 (+0300) Subject: Bluetooth: Fix sending unnecessary HCI_LE_Host_Enable X-Git-Tag: firefly_0821_release~3680^2~1480^2~17^2~247^2~21 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=430a61b8037e3184eb7e59220bb4a43530b8d0f6;p=firefly-linux-kernel-4.4.55.git Bluetooth: Fix sending unnecessary HCI_LE_Host_Enable This patch fixes sending an unnecessary HCI_LE_Host_Enable command if the command has already been sent as part of the default HCI init sequence. Signed-off-by: Johan Hedberg Signed-off-by: Gustavo Padovan --- diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index bcf7690a23cb..1a304e2d5a74 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -2926,8 +2926,14 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered) cp.le = 1; cp.simul = !!lmp_le_br_capable(hdev); - hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, - sizeof(cp), &cp); + /* Check first if we already have the right + * host state (host features set) + */ + if (cp.le != !!lmp_host_le_capable(hdev) || + cp.simul != !!lmp_host_le_br_capable(hdev)) + hci_send_cmd(hdev, + HCI_OP_WRITE_LE_HOST_SUPPORTED, + sizeof(cp), &cp); } if (lmp_bredr_capable(hdev)) {