* [PATCH] bluetooth: btusb: Fix issue with suspend
@ 2014-09-05 15:16 Larry Finger
2014-09-06 17:02 ` Marcel Holtmann
0 siblings, 1 reply; 7+ messages in thread
From: Larry Finger @ 2014-09-05 15:16 UTC (permalink / raw)
To: Marcel Holtmann, Gustavo Padovan, Johan Hedberg
Cc: linux-bluetooth-u79uwXL29TY76Z2rM5mHXA,
netdev-u79uwXL29TY76Z2rM5mHXA, Champion Chen, Larry Finger,
Stable
From: Champion Chen <champion_chen-kXabqFNEczNtrwSWzY7KCg@public.gmane.org>
Suspend could fail for some platforms because
btusb_suspend==> btusb_stop_traffic ==> usb_kill_anchored_urbs,
When btusb_bulk_complete returns before system suspend and resubmits an urb,
the system cannot enter suspend state.
Signed-off-by: Champion Chen <champion_chen-kXabqFNEczNtrwSWzY7KCg@public.gmane.org>
Signed-off-by: Larry Finger <Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
Cc: Stable <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
---
Johan,
To help Champion with the process, I have formatted the patch in
the correct manner. I hope I understand the issue correctly and
stated it in a coherent manner in the commit message.
Larry
---
drivers/bluetooth/btusb.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 292c38e..45a7211 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -330,6 +330,9 @@ static void btusb_intr_complete(struct urb *urb)
BT_ERR("%s corrupted event packet", hdev->name);
hdev->stat.err_rx++;
}
+ } else if (urb->status == -ENOENT) {
+ /* Avoid suspend failed when usb_kill_urb */
+ return;
}
if (!test_bit(BTUSB_INTR_RUNNING, &data->flags))
@@ -417,6 +420,9 @@ static void btusb_bulk_complete(struct urb *urb)
urb->actual_length) < 0) {
BT_ERR("%s corrupted ACL packet", hdev->name);
hdev->stat.err_rx++;
+ } else if (urb->status == -ENOENT) {
+ /* Avoid suspend failed when usb_kill_urb */
+ return;
}
}
@@ -512,6 +518,9 @@ static void btusb_isoc_complete(struct urb *urb)
hdev->stat.err_rx++;
}
}
+ } else if (urb->status == -ENOENT) {
+ /* Avoid suspend failed when usb_kill_urb */
+ return;
}
if (!test_bit(BTUSB_ISOC_RUNNING, &data->flags))
--
1.8.4.5
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] bluetooth: btusb: Fix issue with suspend
2014-09-05 15:16 [PATCH] bluetooth: btusb: Fix issue with suspend Larry Finger
@ 2014-09-06 17:02 ` Marcel Holtmann
2014-09-06 17:16 ` Larry Finger
0 siblings, 1 reply; 7+ messages in thread
From: Marcel Holtmann @ 2014-09-06 17:02 UTC (permalink / raw)
To: Larry Finger
Cc: Gustavo F. Padovan, Johan Hedberg, linux-bluetooth, netdev,
Champion Chen, Stable
Hi Larry,
> Suspend could fail for some platforms because
> btusb_suspend==> btusb_stop_traffic ==> usb_kill_anchored_urbs,
>
> When btusb_bulk_complete returns before system suspend and resubmits an urb,
> the system cannot enter suspend state.
>
> Signed-off-by: Champion Chen <champion_chen@realsil.com.cn>
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Stable <stable@vger.kernel.org>
> ---
> Johan,
>
> To help Champion with the process, I have formatted the patch in
> the correct manner. I hope I understand the issue correctly and
> stated it in a coherent manner in the commit message.
>
> Larry
> ---
> drivers/bluetooth/btusb.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 292c38e..45a7211 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -330,6 +330,9 @@ static void btusb_intr_complete(struct urb *urb)
> BT_ERR("%s corrupted event packet", hdev->name);
> hdev->stat.err_rx++;
> }
> + } else if (urb->status == -ENOENT) {
> + /* Avoid suspend failed when usb_kill_urb */
> + return;
> }
>
> if (!test_bit(BTUSB_INTR_RUNNING, &data->flags))
> @@ -417,6 +420,9 @@ static void btusb_bulk_complete(struct urb *urb)
> urb->actual_length) < 0) {
> BT_ERR("%s corrupted ACL packet", hdev->name);
> hdev->stat.err_rx++;
> + } else if (urb->status == -ENOENT) {
> + /* Avoid suspend failed when usb_kill_urb */
> + return;
> }
this one is utterly bogus. Either urb->status is 0 or it is -ENOENT, but it will not be both. I think you put it to the wrong if clause.
> }
>
> @@ -512,6 +518,9 @@ static void btusb_isoc_complete(struct urb *urb)
> hdev->stat.err_rx++;
> }
> }
> + } else if (urb->status == -ENOENT) {
> + /* Avoid suspend failed when usb_kill_urb */
> + return;
> }
>
> if (!test_bit(BTUSB_ISOC_RUNNING, &data->flags))
Regards
Marcel
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] bluetooth: btusb: Fix issue with suspend
2014-09-06 17:02 ` Marcel Holtmann
@ 2014-09-06 17:16 ` Larry Finger
[not found] ` <540B4159.9000003-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Larry Finger @ 2014-09-06 17:16 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Gustavo F. Padovan, Johan Hedberg, linux-bluetooth, netdev,
Champion Chen, Stable
On 09/06/2014 12:02 PM, Marcel Holtmann wrote:
> Hi Larry,
>
>> Suspend could fail for some platforms because
>> btusb_suspend==> btusb_stop_traffic ==> usb_kill_anchored_urbs,
>>
>> When btusb_bulk_complete returns before system suspend and resubmits an urb,
>> the system cannot enter suspend state.
>>
>> Signed-off-by: Champion Chen <champion_chen@realsil.com.cn>
>> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
>> Cc: Stable <stable@vger.kernel.org>
>> ---
>> Johan,
>>
>> To help Champion with the process, I have formatted the patch in
>> the correct manner. I hope I understand the issue correctly and
>> stated it in a coherent manner in the commit message.
>>
>> Larry
>> ---
>> drivers/bluetooth/btusb.c | 9 +++++++++
>> 1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
>> index 292c38e..45a7211 100644
>> --- a/drivers/bluetooth/btusb.c
>> +++ b/drivers/bluetooth/btusb.c
>> @@ -330,6 +330,9 @@ static void btusb_intr_complete(struct urb *urb)
>> BT_ERR("%s corrupted event packet", hdev->name);
>> hdev->stat.err_rx++;
>> }
>> + } else if (urb->status == -ENOENT) {
>> + /* Avoid suspend failed when usb_kill_urb */
>> + return;
>> }
>>
>> if (!test_bit(BTUSB_INTR_RUNNING, &data->flags))
>> @@ -417,6 +420,9 @@ static void btusb_bulk_complete(struct urb *urb)
>> urb->actual_length) < 0) {
>> BT_ERR("%s corrupted ACL packet", hdev->name);
>> hdev->stat.err_rx++;
>> + } else if (urb->status == -ENOENT) {
>> + /* Avoid suspend failed when usb_kill_urb */
>> + return;
>> }
>
> this one is utterly bogus. Either urb->status is 0 or it is -ENOENT, but it will not be both. I think you put it to the wrong if clause.
Thanks for the review. Obviously, you are correct. A revised patch will be sent
soon.
The code sent by Champion is now posted at
http://github.com/lwfinger/rtl8723au_bt/new. It works for everyone that has
tested it.
Larry
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-09-06 19:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-05 15:16 [PATCH] bluetooth: btusb: Fix issue with suspend Larry Finger
2014-09-06 17:02 ` Marcel Holtmann
2014-09-06 17:16 ` Larry Finger
[not found] ` <540B4159.9000003-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
2014-09-06 17:35 ` Marcel Holtmann
[not found] ` <D5B40282-A085-4B47-8F7B-27480CAB6B19-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2014-09-06 19:05 ` Larry Finger
2014-09-06 19:12 ` Marcel Holtmann
2014-09-06 19:19 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).