diff options
author | Anton Tikhomirov <av.tikhomirov@samsung.com> | 2013-11-26 03:46:05 +0100 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-11-26 17:58:18 +0100 |
commit | 16e569e9661ea2b964b8abb607a51e5285254021 (patch) | |
tree | 528220cbbd28bb3ab6e16ea0603d9da38a153490 /drivers/usb/phy/phy-fsm-usb.c | |
parent | usb: phy: fsm: protect against multiple inclusions (diff) | |
download | linux-16e569e9661ea2b964b8abb607a51e5285254021.tar.xz linux-16e569e9661ea2b964b8abb607a51e5285254021.zip |
usb: phy: replace spinlock with mutex in OTG FSM
OTG Final State Machine calls functions which may sleep.
For example, start_gadget callback implementation can use
usb_gadget_vbus_connect(), whose context: can sleep.
If so, mutex should be used instead of spinlock.
Signed-off-by: Anton Tikhomirov <av.tikhomirov@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/phy/phy-fsm-usb.c')
-rw-r--r-- | drivers/usb/phy/phy-fsm-usb.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/phy/phy-fsm-usb.c b/drivers/usb/phy/phy-fsm-usb.c index 329c2d2f8595..2817b04a6c47 100644 --- a/drivers/usb/phy/phy-fsm-usb.c +++ b/drivers/usb/phy/phy-fsm-usb.c @@ -23,7 +23,7 @@ #include <linux/kernel.h> #include <linux/types.h> -#include <linux/spinlock.h> +#include <linux/mutex.h> #include <linux/delay.h> #include <linux/usb.h> #include <linux/usb/gadget.h> @@ -245,9 +245,8 @@ int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) int otg_statemachine(struct otg_fsm *fsm) { enum usb_otg_state state; - unsigned long flags; - spin_lock_irqsave(&fsm->lock, flags); + mutex_lock(&fsm->lock); state = fsm->otg->phy->state; state_changed = 0; @@ -359,7 +358,7 @@ int otg_statemachine(struct otg_fsm *fsm) default: break; } - spin_unlock_irqrestore(&fsm->lock, flags); + mutex_lock(&fsm->lock); VDBG("quit statemachine, changed = %d\n", state_changed); return state_changed; |