From: Archie Pusaka <[email protected]>
On cmd_timeout with no reset_gpio, reset the USB port as a last
resort.
This patch changes the behavior of btusb_intel_cmd_timeout and
btusb_rtl_cmd_timeout.
Signed-off-by: Archie Pusaka <[email protected]>
Reviewed-by: Abhishek Pandit-Subedi <[email protected]>
Reviewed-by: Ying Hsu <[email protected]>
---
Tested by not cancelling cmd_timer when handing hci event.
Before the patch:
ERR kernel: [ 716.929206] Bluetooth: hci_cmd_timeout() hci0: command 0x0000 tx timeout
ERR kernel: [ 716.929218] Bluetooth: btusb_rtl_cmd_timeout() hci0: No gpio to reset Realtek device, ignoring
After the patch:
ERR kernel: [ 225.270048] Bluetooth: hci_cmd_timeout() hci0: command 0x0000 tx timeout
ERR kernel: [ 225.270060] Bluetooth: btusb_rtl_cmd_timeout() hci0: Resetting usb device.
INFO kernel: [ 225.386613] usb 3-3: reset full-speed USB device number 3 using xhci_hcd
Changes in v2:
* Update commit message
drivers/bluetooth/btusb.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 271963805a38..11040124ef79 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -696,6 +696,19 @@ struct btusb_data {
unsigned cmd_timeout_cnt;
};
+static void generic_usb_reset(struct hci_dev *hdev, struct btusb_data *data)
+{
+ int err;
+
+ bt_dev_err(hdev, "Resetting usb device.");
+ /* This is not an unbalanced PM reference since the device will reset */
+ err = usb_autopm_get_interface(data->intf);
+ if (!err)
+ usb_queue_reset_device(data->intf);
+ else
+ bt_dev_err(hdev, "Failed usb_autopm_get_interface: %d", err);
+}
+
static void btusb_intel_cmd_timeout(struct hci_dev *hdev)
{
struct btusb_data *data = hci_get_drvdata(hdev);
@@ -705,7 +718,7 @@ static void btusb_intel_cmd_timeout(struct hci_dev *hdev)
return;
if (!reset_gpio) {
- bt_dev_err(hdev, "No way to reset. Ignoring and continuing");
+ generic_usb_reset(hdev, data);
return;
}
@@ -736,7 +749,7 @@ static void btusb_rtl_cmd_timeout(struct hci_dev *hdev)
return;
if (!reset_gpio) {
- bt_dev_err(hdev, "No gpio to reset Realtek device, ignoring");
+ generic_usb_reset(hdev, data);
return;
}
@@ -761,7 +774,6 @@ static void btusb_qca_cmd_timeout(struct hci_dev *hdev)
{
struct btusb_data *data = hci_get_drvdata(hdev);
struct gpio_desc *reset_gpio = data->reset_gpio;
- int err;
if (++data->cmd_timeout_cnt < 5)
return;
@@ -787,13 +799,7 @@ static void btusb_qca_cmd_timeout(struct hci_dev *hdev)
return;
}
- bt_dev_err(hdev, "Multiple cmd timeouts seen. Resetting usb device.");
- /* This is not an unbalanced PM reference since the device will reset */
- err = usb_autopm_get_interface(data->intf);
- if (!err)
- usb_queue_reset_device(data->intf);
- else
- bt_dev_err(hdev, "Failed usb_autopm_get_interface with %d", err);
+ generic_usb_reset(hdev, data);
}
static inline void btusb_free_frags(struct btusb_data *data)
--
2.38.0.rc1.362.ged0d419d3c-goog
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=682952
---Test result---
Test Summary:
CheckPatch PASS 1.87 seconds
GitLint FAIL 0.80 seconds
SubjectPrefix PASS 0.62 seconds
BuildKernel PASS 35.71 seconds
BuildKernel32 PASS 29.33 seconds
Incremental Build with patchesPASS 42.42 seconds
TestRunner: Setup PASS 500.23 seconds
TestRunner: l2cap-tester PASS 16.58 seconds
TestRunner: iso-tester PASS 15.56 seconds
TestRunner: bnep-tester PASS 6.13 seconds
TestRunner: mgmt-tester PASS 99.98 seconds
TestRunner: rfcomm-tester PASS 9.77 seconds
TestRunner: sco-tester PASS 9.18 seconds
TestRunner: ioctl-tester PASS 10.33 seconds
TestRunner: smp-tester PASS 9.27 seconds
TestRunner: userchan-tester PASS 6.31 seconds
Details
##############################
Test: GitLint - FAIL - 0.80 seconds
Run gitlint with rule in .gitlint
[v2] Bluetooth: btusb: Introduce generic USB reset
18: B1 Line exceeds max length (87>80): "ERR kernel: [ 716.929206] Bluetooth: hci_cmd_timeout() hci0: command 0x0000 tx timeout"
19: B1 Line exceeds max length (109>80): "ERR kernel: [ 716.929218] Bluetooth: btusb_rtl_cmd_timeout() hci0: No gpio to reset Realtek device, ignoring"
22: B1 Line exceeds max length (87>80): "ERR kernel: [ 225.270048] Bluetooth: hci_cmd_timeout() hci0: command 0x0000 tx timeout"
23: B1 Line exceeds max length (89>80): "ERR kernel: [ 225.270060] Bluetooth: btusb_rtl_cmd_timeout() hci0: Resetting usb device."
24: B1 Line exceeds max length (88>80): "INFO kernel: [ 225.386613] usb 3-3: reset full-speed USB device number 3 using xhci_hcd"
---
Regards,
Linux Bluetooth