Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: otg-fsm: support multiple instances

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>

authored by

Roger Quadros and committed by
Peter Chen
4e332df6 fa59507f

+5 -6
+4 -6
drivers/usb/common/usb-otg-fsm.c
··· 61 61 return 0; 62 62 } 63 63 64 - static int state_changed; 65 - 66 64 /* Called when leaving a state. Do state clean up jobs here */ 67 65 static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) 68 66 { ··· 206 208 /* Called when entering a state */ 207 209 static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) 208 210 { 209 - state_changed = 1; 210 211 if (fsm->otg->state == new_state) 211 212 return 0; 212 213 VDBG("Set state: %s\n", usb_otg_state_string(new_state)); ··· 321 324 } 322 325 323 326 fsm->otg->state = new_state; 327 + fsm->state_changed = 1; 324 328 return 0; 325 329 } 326 330 ··· 333 335 mutex_lock(&fsm->lock); 334 336 335 337 state = fsm->otg->state; 336 - state_changed = 0; 338 + fsm->state_changed = 0; 337 339 /* State machine state change judgement */ 338 340 339 341 switch (state) { ··· 446 448 } 447 449 mutex_unlock(&fsm->lock); 448 450 449 - VDBG("quit statemachine, changed = %d\n", state_changed); 450 - return state_changed; 451 + VDBG("quit statemachine, changed = %d\n", fsm->state_changed); 452 + return fsm->state_changed; 451 453 } 452 454 EXPORT_SYMBOL_GPL(otg_statemachine);
+1
include/linux/usb/otg-fsm.h
··· 210 210 struct mutex lock; 211 211 u8 *host_req_flag; 212 212 struct delayed_work hnp_polling_work; 213 + bool state_changed; 213 214 }; 214 215 215 216 struct otg_fsm_ops {