Revert "USB: HCD: Fix URB giveback issue in tasklet function"

This reverts commit 5d952c7ae3 which is
commit 26c6c2f8a907c9e3a2f24990552a4d77235791e6 upstream.

It breaks the Android GKI kernel abi, and is not needed for Android
devices, so revert it for now.  If it is needed for this branch, it can
come back later in an ABI-stable way.

Bug: 161946584
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I7cebceb7c3e1eccf4a36a18dbe0e7ec21378b719
This commit is contained in:
Greg Kroah-Hartman 2022-08-22 19:16:15 +02:00
parent 05426a3d4f
commit 15a2cff2b5
2 changed files with 11 additions and 16 deletions

View File

@ -1688,6 +1688,7 @@ static void usb_giveback_urb_bh(unsigned long param)
spin_lock_irq(&bh->lock);
bh->running = true;
restart:
list_replace_init(&bh->head, &local_list);
spin_unlock_irq(&bh->lock);
@ -1701,17 +1702,10 @@ static void usb_giveback_urb_bh(unsigned long param)
bh->completing_ep = NULL;
}
/*
* giveback new URBs next time to prevent this function
* from not exiting for a long time.
*/
/* check if there are new URBs to giveback */
spin_lock_irq(&bh->lock);
if (!list_empty(&bh->head)) {
if (bh->high_prio)
tasklet_hi_schedule(&bh->bh);
else
tasklet_schedule(&bh->bh);
}
if (!list_empty(&bh->head))
goto restart;
bh->running = false;
spin_unlock_irq(&bh->lock);
}
@ -1736,7 +1730,7 @@ static void usb_giveback_urb_bh(unsigned long param)
void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, int status)
{
struct giveback_urb_bh *bh;
bool running;
bool running, high_prio_bh;
/* pass status to tasklet via unlinked */
if (likely(!urb->unlinked))
@ -1747,10 +1741,13 @@ void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, int status)
return;
}
if (usb_pipeisoc(urb->pipe) || usb_pipeint(urb->pipe))
if (usb_pipeisoc(urb->pipe) || usb_pipeint(urb->pipe)) {
bh = &hcd->high_prio_bh;
else
high_prio_bh = true;
} else {
bh = &hcd->low_prio_bh;
high_prio_bh = false;
}
spin_lock(&bh->lock);
list_add_tail(&urb->urb_list, &bh->head);
@ -1759,7 +1756,7 @@ void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, int status)
if (running)
;
else if (bh->high_prio)
else if (high_prio_bh)
tasklet_hi_schedule(&bh->bh);
else
tasklet_schedule(&bh->bh);
@ -2799,7 +2796,6 @@ int usb_add_hcd(struct usb_hcd *hcd,
/* initialize tasklets */
init_giveback_urb_bh(&hcd->high_prio_bh);
hcd->high_prio_bh.high_prio = true;
init_giveback_urb_bh(&hcd->low_prio_bh);
/* enable irqs just before we start the controller,

View File

@ -67,7 +67,6 @@
struct giveback_urb_bh {
bool running;
bool high_prio;
spinlock_t lock;
struct list_head head;
struct tasklet_struct bh;