All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.de>
To: Naveen Kumar Parna <pnaveenkos@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	linux-usb@vger.kernel.org, acho@suse.com
Subject: Re: btusb_intr_complete returns -EPIPE
Date: Tue, 07 Oct 2014 12:01:11 +0200	[thread overview]
Message-ID: <1412676071.1926.1.camel@linux-0dmf.site> (raw)
In-Reply-To: <CAG0bkv+_t8CqM9w5N1hKJtT=_mQmtWWCPe-9jSHuOkNZCL3B9A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 563 bytes --]

On Tue, 2014-10-07 at 12:14 +0530, Naveen Kumar Parna wrote:
> > +       err = usb_clear_halt(data->udev,
> > +                            usb_rcvbulkpipe(data->udev,
> > +                                            data->intr_ep->bEndpointAddress));
> 
> EPIPE occurred for INT in endpoint, so we should use usb_rcvintpipe()
> instead of usb_rcvbulkpipe() right?

Yes. And I noticed a copy and past error.

> Does the “lsusb –v” gives any clue about the reason for getting -EPIPE?

No. Could you nevertheless test the attached version?

	Regards
		Oliver


[-- Attachment #2: 0001-btusb-clear-halt-if-intr-in-stalls.patch --]
[-- Type: text/x-patch, Size: 2656 bytes --]

>From b8109554277bde9da4275e7a9ce1ef76b43ebd59 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oneukum@suse.de>
Date: Mon, 6 Oct 2014 15:27:54 +0200
Subject: [PATCH] btusb: clear halt if intr in stalls

Use a work queue for clearing a halt.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
---
 drivers/bluetooth/btusb.c | 34 ++++++++++++++++++++++++++++++++--
 1 file changed, 32 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 292c38e..716c37a 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -273,6 +273,7 @@ struct btusb_data {
 
 	struct work_struct work;
 	struct work_struct waker;
+	struct work_struct intr_in_work;
 
 	struct usb_anchor tx_anchor;
 	struct usb_anchor intr_anchor;
@@ -314,14 +315,15 @@ static void btusb_intr_complete(struct urb *urb)
 	struct hci_dev *hdev = urb->context;
 	struct btusb_data *data = hci_get_drvdata(hdev);
 	int err;
+	int status = urb->status;
 
 	BT_DBG("%s urb %p status %d count %d", hdev->name,
-					urb, urb->status, urb->actual_length);
+					urb, status, urb->actual_length);
 
 	if (!test_bit(HCI_RUNNING, &hdev->flags))
 		return;
 
-	if (urb->status == 0) {
+	if (status == 0) {
 		hdev->stat.byte_rx += urb->actual_length;
 
 		if (hci_recv_fragment(hdev, HCI_EVENT_PKT,
@@ -330,6 +332,10 @@ static void btusb_intr_complete(struct urb *urb)
 			BT_ERR("%s corrupted event packet", hdev->name);
 			hdev->stat.err_rx++;
 		}
+	} else if (status == -EPIPE) {
+		usb_mark_last_busy(data->udev);
+		schedule_work(&data->intr_in_work);
+		return;
 	}
 
 	if (!test_bit(BTUSB_INTR_RUNNING, &data->flags))
@@ -971,6 +977,29 @@ static void btusb_waker(struct work_struct *work)
 	usb_autopm_put_interface(data->intf);
 }
 
+static void clear_halt_intr_in(struct work_struct *work)
+{
+	struct btusb_data *data = container_of(work, struct btusb_data, intr_in_work);
+	int err;
+
+	err = usb_autopm_get_interface(data->intf);
+	if (err < 0)
+		return;
+
+	err = usb_clear_halt(data->udev,
+			     usb_rcvintpipe(data->udev,
+					     data->intr_ep->bEndpointAddress));
+	if (err < 0)
+		return;
+
+	if (!test_bit(BTUSB_INTR_RUNNING, &data->flags))
+		return;
+
+	btusb_submit_intr_urb(data->hdev, GFP_NOIO);
+
+	usb_autopm_put_interface(data->intf);
+}
+
 static int btusb_setup_bcm92035(struct hci_dev *hdev)
 {
 	struct sk_buff *skb;
@@ -1759,6 +1788,7 @@ static int btusb_probe(struct usb_interface *intf,
 
 	INIT_WORK(&data->work, btusb_work);
 	INIT_WORK(&data->waker, btusb_waker);
+	INIT_WORK(&data->intr_in_work, clear_halt_intr_in);
 	spin_lock_init(&data->txlock);
 
 	init_usb_anchor(&data->tx_anchor);
-- 
1.8.4.5


  reply	other threads:[~2014-10-07 10:01 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-06 11:35 btusb_intr_complete returns -EPIPE Naveen Kumar Parna
2014-10-06 12:24 ` Oliver Neukum
     [not found]   ` <CAG0bkv+nKt-TgONDLENNUncz9NScdJGcYR+J2Z6b=wg2grvqhg@mail.gmail.com>
2014-10-06 12:55     ` Oliver Neukum
2014-10-06 13:03       ` Naveen Kumar Parna
2014-10-06 13:29         ` Oliver Neukum
2014-10-06 14:38           ` Naveen Kumar Parna
2014-10-06 14:50             ` Oliver Neukum
     [not found]               ` <CAG0bkvKJZMhurNNpc_2wgaACRzhyEikb0G0YSY7QnxqBe1rnjw@mail.gmail.com>
2014-10-07  6:44                 ` Naveen Kumar Parna
2014-10-07 10:01                   ` Oliver Neukum [this message]
2014-10-07 13:34                     ` Naveen Kumar Parna
2014-10-07 14:31                       ` Naveen Kumar Parna
2014-10-08  9:09                         ` Oliver Neukum
2014-10-08 10:21                           ` Naveen Kumar Parna
2014-10-08 10:44                             ` Oliver Neukum
2014-10-08 13:01                               ` Naveen Kumar Parna
2014-10-08 13:17                                 ` Oliver Neukum
2014-10-08 14:10                                   ` Naveen Kumar Parna
2014-10-08 14:46                                   ` Alan Stern
  -- strict thread matches above, loose matches on Subject: below --
2014-10-06 12:23 Naveen Kumar Parna
     [not found] <CAG0bkvJDLP2tgnzu7H_ZCRCnZwkw1zUd1uqWwoDkmrU_FLts7w@mail.gmail.com>
2014-10-09 14:31 ` Alan Stern
2014-10-15 10:11   ` Oliver Neukum
2014-10-15 13:09     ` Naveen Kumar Parna
2014-10-15 13:46       ` Naveen Kumar Parna
2014-10-15 16:11         ` Alan Stern
2014-10-16  7:13           ` Naveen Kumar Parna
2014-10-16 14:16             ` Alan Stern
2014-10-16 15:32               ` Naveen Kumar Parna
2014-10-28 12:40                 ` Naveen Kumar Parna
2014-10-28 17:27                   ` Alan Stern
     [not found]                     ` <CAG0bkvL-qy+Wvp7q39TOaQ1dZDd0PKyoXHjO=5TrJvdC8byr8A@mail.gmail.com>
2014-10-31 11:27                       ` Naveen Kumar Parna
2014-10-31 20:51                       ` Alan Stern
2014-10-16  9:15           ` Oliver Neukum
2014-10-16 10:54             ` Naveen Kumar Parna
2014-10-16 14:09               ` Alan Stern
2014-10-16 15:05                 ` Naveen Kumar Parna
2014-10-27  9:19                 ` Naveen Kumar Parna
     [not found] <CAG0bkv+YY90Tq1aTw1Dbg-RSVadoP2U6tyVpW1bZSxBfQ=3Y4g@mail.gmail.com>
2014-11-03 16:19 ` Alan Stern
2014-11-05  6:58   ` Naveen Kumar Parna
2014-11-05 21:09     ` Alan Stern
     [not found] <CAG0bkv+DL0bVs9irE7eUB3rC-J16Ue=b9+_TqeuTHJYMJDkC0g@mail.gmail.com>
2014-11-06 16:44 ` Alan Stern
2014-11-10  6:38   ` Naveen Kumar Parna
2014-11-10 16:56     ` Alan Stern
2014-11-11  9:53       ` Naveen Kumar Parna
2014-11-11 15:56         ` Alan Stern
2014-11-10  9:29   ` Naveen Kumar Parna

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412676071.1926.1.camel@linux-0dmf.site \
    --to=oneukum@suse.de \
    --cc=acho@suse.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pnaveenkos@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.