2024-02-23 08:54:04

by quic_zijuhu

[permalink] [raw]
Subject: [PATCH] Bluetooth: btusb: Correct timeout macro argument used to receive control message

USB driver defines macro @USB_CTRL_SET_TIMEOUT for sending control message
timeout and @USB_CTRL_GET_TIMEOUT for receiving, but usb_control_msg()
uses wrong macro @USB_CTRL_SET_TIMEOUT as argument to receive control
message, fixed by using @USB_CTRL_GET_TIMEOUT to receive message.

Signed-off-by: Zijun Hu <[email protected]>
---
drivers/bluetooth/btusb.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index edfb49bbaa28..07935751e4c7 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2949,7 +2949,7 @@ static int btusb_mtk_uhw_reg_read(struct btusb_data *data, u32 reg, u32 *val)
err = usb_control_msg(data->udev, pipe, 0x01,
0xDE,
reg >> 16, reg & 0xffff,
- buf, 4, USB_CTRL_SET_TIMEOUT);
+ buf, 4, USB_CTRL_GET_TIMEOUT);
if (err < 0) {
bt_dev_err(hdev, "Failed to read uhw reg(%d)", err);
goto err_free_buf;
@@ -2977,7 +2977,7 @@ static int btusb_mtk_reg_read(struct btusb_data *data, u32 reg, u32 *val)
err = usb_control_msg(data->udev, pipe, 0x63,
USB_TYPE_VENDOR | USB_DIR_IN,
reg >> 16, reg & 0xffff,
- buf, size, USB_CTRL_SET_TIMEOUT);
+ buf, size, USB_CTRL_GET_TIMEOUT);
if (err < 0)
goto err_free_buf;

@@ -3681,7 +3681,7 @@ static int btusb_qca_send_vendor_req(struct usb_device *udev, u8 request,
*/
pipe = usb_rcvctrlpipe(udev, 0);
err = usb_control_msg(udev, pipe, request, USB_TYPE_VENDOR | USB_DIR_IN,
- 0, 0, buf, size, USB_CTRL_SET_TIMEOUT);
+ 0, 0, buf, size, USB_CTRL_GET_TIMEOUT);
if (err < 0) {
dev_err(&udev->dev, "Failed to access otp area (%d)", err);
goto done;
--
2.7.4



2024-04-22 14:57:32

by quic_zijuhu

[permalink] [raw]
Subject: [PATCH v1 RESEND] Bluetooth: btusb: Correct timeout macro argument used to receive control message

USB driver defines macro @USB_CTRL_SET_TIMEOUT for sending control message
timeout and @USB_CTRL_GET_TIMEOUT for receiving, but usb_control_msg()
uses wrong macro @USB_CTRL_SET_TIMEOUT as argument to receive control
message, fixed by using @USB_CTRL_GET_TIMEOUT to receive message.

Signed-off-by: Zijun Hu <[email protected]>
---
drivers/bluetooth/btusb.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 8bede0a33566..5e9f7b65abbc 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2956,7 +2956,7 @@ static int btusb_mtk_uhw_reg_read(struct btusb_data *data, u32 reg, u32 *val)
err = usb_control_msg(data->udev, pipe, 0x01,
0xDE,
reg >> 16, reg & 0xffff,
- buf, 4, USB_CTRL_SET_TIMEOUT);
+ buf, 4, USB_CTRL_GET_TIMEOUT);
if (err < 0) {
bt_dev_err(hdev, "Failed to read uhw reg(%d)", err);
goto err_free_buf;
@@ -2984,7 +2984,7 @@ static int btusb_mtk_reg_read(struct btusb_data *data, u32 reg, u32 *val)
err = usb_control_msg(data->udev, pipe, 0x63,
USB_TYPE_VENDOR | USB_DIR_IN,
reg >> 16, reg & 0xffff,
- buf, size, USB_CTRL_SET_TIMEOUT);
+ buf, size, USB_CTRL_GET_TIMEOUT);
if (err < 0)
goto err_free_buf;

@@ -3699,7 +3699,7 @@ static int btusb_qca_send_vendor_req(struct usb_device *udev, u8 request,
*/
pipe = usb_rcvctrlpipe(udev, 0);
err = usb_control_msg(udev, pipe, request, USB_TYPE_VENDOR | USB_DIR_IN,
- 0, 0, buf, size, USB_CTRL_SET_TIMEOUT);
+ 0, 0, buf, size, USB_CTRL_GET_TIMEOUT);
if (err < 0) {
dev_err(&udev->dev, "Failed to access otp area (%d)", err);
goto done;
--
2.7.4


2024-04-22 15:44:40

by bluez.test.bot

[permalink] [raw]
Subject: RE: [v1,RESEND] Bluetooth: btusb: Correct timeout macro argument used to receive control message

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=846709

---Test result---

Test Summary:
CheckPatch PASS 0.65 seconds
GitLint FAIL 0.52 seconds
SubjectPrefix PASS 0.12 seconds
BuildKernel PASS 30.30 seconds
CheckAllWarning PASS 33.23 seconds
CheckSparse PASS 38.88 seconds
CheckSmatch FAIL 36.36 seconds
BuildKernel32 PASS 29.20 seconds
TestRunnerSetup PASS 523.77 seconds
TestRunner_l2cap-tester PASS 18.39 seconds
TestRunner_iso-tester FAIL 35.39 seconds
TestRunner_bnep-tester PASS 4.70 seconds
TestRunner_mgmt-tester PASS 112.38 seconds
TestRunner_rfcomm-tester PASS 7.28 seconds
TestRunner_sco-tester PASS 15.10 seconds
TestRunner_ioctl-tester PASS 7.66 seconds
TestRunner_mesh-tester PASS 5.81 seconds
TestRunner_smp-tester PASS 6.82 seconds
TestRunner_userchan-tester PASS 4.94 seconds
IncrementalBuild PASS 28.28 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v1,RESEND] Bluetooth: btusb: Correct timeout macro argument used to receive control message

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (92>80): "[v1,RESEND] Bluetooth: btusb: Correct timeout macro argument used to receive control message"
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bpa10x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bpa10x.o'
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 122, Passed: 121 (99.2%), Failed: 1, Not Run: 0

Failed Test Cases
ISO Connect2 Suspend - Success Failed 8.199 seconds


---
Regards,
Linux Bluetooth

2024-04-22 15:49:57

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH v1 RESEND] Bluetooth: btusb: Correct timeout macro argument used to receive control message

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Mon, 22 Apr 2024 22:57:10 +0800 you wrote:
> USB driver defines macro @USB_CTRL_SET_TIMEOUT for sending control message
> timeout and @USB_CTRL_GET_TIMEOUT for receiving, but usb_control_msg()
> uses wrong macro @USB_CTRL_SET_TIMEOUT as argument to receive control
> message, fixed by using @USB_CTRL_GET_TIMEOUT to receive message.
>
> Signed-off-by: Zijun Hu <[email protected]>
>
> [...]

Here is the summary with links:
- [v1,RESEND] Bluetooth: btusb: Correct timeout macro argument used to receive control message
https://git.kernel.org/bluetooth/bluetooth-next/c/927927f2471f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html