Skip to content
  • Chen-Yu Tsai's avatar
    phy: sun4i-usb: Use spinlock to guard phyctl register access · 72c6187f
    Chen-Yu Tsai authored
    commit 919ab2524c52e5f801d8873f09145ce822cdd43a upstream.
    
    The musb driver calls into this phy driver to disable/enable squelch
    detection. This function was introduced in 24fe86a6 ("phy: sun4i-usb:
    Add a sunxi specific function for setting squelch-detect"). This
    function in turn calls sun4i_usb_phy_write, which uses a mutex to
    guard the common access register. Unfortunately musb does this
    in atomic context, which results in the following warning with lock
    debugging enabled:
    
    BUG: sleeping function called from invalid context at kernel/locking/mutex.c:97
    in_atomic(): 1, irqs_disabled(): 128, pid: 96, name: kworker/0:2
    CPU: 0 PID: 96 Comm: kworker/0:2 Not tainted 4.8.0-rc4-00181-gd502f8ad1c3e #13
    Hardware name: Allwinner sun8i Family
    Workqueue: events musb_deassert_reset
    [<c010bc01>] (unwind_backtrace) from [<c0109237>] (show_stack+0xb/0xc)
    [<c0109237>] (show_stack) from [<c02a669b>] (dump_stack+0x67/0x74)
    [<c02a669b>] (dump_stack) from [<c05d...
    72c6187f