Skip to content

Commit

Permalink
usb: musb: Fix locking errors for host only mode
Browse files Browse the repository at this point in the history
If we have USB gadgets disabled and USB_MUSB_HOST set, we get
errors "possible irq lock inverssion dependency detected"
errors during boot.

Let's fix the issue by adding start_musb flag and start
the controller after we're out of the spinlock protected
section.

Reported-by: Ladislav Michl <[email protected]>
Tested-by: Ladislav Michl <[email protected]>
Signed-off-by: Tony Lindgren <[email protected]>
Signed-off-by: Bin Liu <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
tmlind authored and gregkh committed Aug 30, 2016
1 parent 3fa2a81 commit 2c55754
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/usb/musb/musb_virthub.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ int musb_hub_control(
u32 temp;
int retval = 0;
unsigned long flags;
bool start_musb = false;

spin_lock_irqsave(&musb->lock, flags);

Expand Down Expand Up @@ -390,7 +391,7 @@ int musb_hub_control(
* logic relating to VBUS power-up.
*/
if (!hcd->self.is_b_host && musb_has_gadget(musb))
musb_start(musb);
start_musb = true;
break;
case USB_PORT_FEAT_RESET:
musb_port_reset(musb, true);
Expand Down Expand Up @@ -451,5 +452,9 @@ int musb_hub_control(
retval = -EPIPE;
}
spin_unlock_irqrestore(&musb->lock, flags);

if (start_musb)
musb_start(musb);

return retval;
}

0 comments on commit 2c55754

Please sign in to comment.