lkml.org 
[lkml]   [2020]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 3/3] Bluetooth: hci_bcm: Ignore deprecated command fail case
From
Date
Hi Amitesh,

> Broadcom VSC uart_clock_setting is deprecated in
> newer controllers. Ignore error if the controller
> returns invalid or bad request error code.
>
> Signed-off-by: Amitesh Chandra <amitesh.chandra@broadcom.com>
> Signed-off-by: Manoj Babulal <manoj.babulal@broadcom.com>
> ---
> drivers/bluetooth/hci_bcm.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
> index 680478f..d316788 100644
> --- a/drivers/bluetooth/hci_bcm.c
> +++ b/drivers/bluetooth/hci_bcm.c
> @@ -158,15 +158,18 @@ static int bcm_set_baudrate(struct hci_uart *hu, unsigned int speed)
> skb = __hci_cmd_sync(hdev, 0xfc45, 1, &clock, HCI_INIT_TIMEOUT);
> if (IS_ERR(skb)) {
> int err = PTR_ERR(skb);
> - bt_dev_err(hdev, "BCM: failed to write clock (%d)",
> - err);
> - return err;
> + /* Ignore err if command is deprecated in controller */
> + if (err != -EBADRQC) {
> + bt_dev_err(hdev, "BCM: failed to write "
> + "clock (%d)", err);
> + return err;
> + }
> + } else {
> + kfree_skb(skb);
> }
> -
> - kfree_skb(skb);
> }

So I really disliked try-and-error of HCI commands. Can we know up-front
somehow if the controller supports a command or not. It is a total waste of
time to send a command that might fail. So we better know this before
sending it.

Regards

Marcel

\
 
 \ /
  Last update: 2020-11-11 12:08    [W:0.034 / U:1.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site