Re: [PATCH v2 3/6] Bluetooth: Remove timeout handling from hci_cancel_le_scan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Andre,

> This patch moves the LE scanning timeout handling from hci_cancel_
> le_scan helper to stop_discovery.
> 
> Since we want discovery code handling LE scanning timeout, we should
> handle it in stop_discovery instead of hci_cancel_le_scan.
> 
> Signed-off-by: Andre Guedes <andre.guedes@xxxxxxxxxxxxx>
> ---
> net/bluetooth/hci_core.c | 14 +++++---------
> net/bluetooth/mgmt.c     | 15 ++++++++++++---
> 2 files changed, 17 insertions(+), 12 deletions(-)
> 
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 59f583b..200ec5a 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1905,20 +1905,16 @@ static int hci_do_le_scan(struct hci_dev *hdev, u8 type, u16 interval,
> 
> int hci_cancel_le_scan(struct hci_dev *hdev)
> {
> +	struct hci_cp_le_set_scan_enable cp;
> +
> 	BT_DBG("%s", hdev->name);
> 
> 	if (!test_bit(HCI_LE_SCAN, &hdev->dev_flags))
> 		return -EALREADY;
> 
> -	if (cancel_delayed_work(&hdev->le_scan_disable)) {
> -		struct hci_cp_le_set_scan_enable cp;
> -
> -		/* Send HCI command to disable LE Scan */
> -		memset(&cp, 0, sizeof(cp));
> -		hci_send_cmd(hdev, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
> -	}
> -
> -	return 0;
> +	/* Send HCI command to disable LE Scan */
> +	memset(&cp, 0, sizeof(cp));
> +	return hci_send_cmd(hdev, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
> }

so we have HCI request framework now and we keep using hci_send_cmd without checking if it fails or succeeds. I don't really think so. This needs to be done as a HCI request as well.

If you want a convenience helper for a single command with a complete callback, then please add that one, but sending commands where the error is not handling from hci_event.c is not acceptable.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux