Move the state_changed variable into struct otg_fsm
so that we can support multiple instances.
Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
-static int state_changed;
-
/* Called when leaving a state. Do state clean up jobs here */
static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
{
/* Called when leaving a state. Do state clean up jobs here */
static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state)
{
/* Called when entering a state */
static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
{
/* Called when entering a state */
static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
{
if (fsm->otg->state == new_state)
return 0;
VDBG("Set state: %s\n", usb_otg_state_string(new_state));
if (fsm->otg->state == new_state)
return 0;
VDBG("Set state: %s\n", usb_otg_state_string(new_state));
}
fsm->otg->state = new_state;
}
fsm->otg->state = new_state;
+ fsm->state_changed = 1;
mutex_lock(&fsm->lock);
state = fsm->otg->state;
mutex_lock(&fsm->lock);
state = fsm->otg->state;
+ fsm->state_changed = 0;
/* State machine state change judgement */
switch (state) {
/* State machine state change judgement */
switch (state) {
}
mutex_unlock(&fsm->lock);
}
mutex_unlock(&fsm->lock);
- VDBG("quit statemachine, changed = %d\n", state_changed);
- return state_changed;
+ VDBG("quit statemachine, changed = %d\n", fsm->state_changed);
+ return fsm->state_changed;
}
EXPORT_SYMBOL_GPL(otg_statemachine);
}
EXPORT_SYMBOL_GPL(otg_statemachine);
struct mutex lock;
u8 *host_req_flag;
struct delayed_work hnp_polling_work;
struct mutex lock;
u8 *host_req_flag;
struct delayed_work hnp_polling_work;