The following call stack ensures that usb_state_changed() is called after usb_init.
///////////////////////////////////////////////////////////////////////////////////////////////////////////
extcon_init() --> usb_init() -->
event_handler_state_changed (DEVICE_NOTIFIER_STATE_START) --> add_extcon_event_handler() -->
get_extcon_init_state() -> config_parse() -> extcon_load_uevent() -> extcon_update() -> usb_state_changed()
///////////////////////////////////////////////////////////////////////////////////////////////////////////
Also, when usb_state_changed() is called from usb_init,
the extcon value is always -1 because the extcon initial value has not yet been retrieved.
The initial state of usb_state_changed() is -1, and usb_state_changed(-1) does nothing.
Change-Id: I77d774c9a396b3773203a69db83aa408e315205a
static int old = -1; /* to update at the first time */
int ret;
+ /* For debugging. Do not move the location. */
_I("USB state is changed from (%d) to (%d).", old, status);
if (old == status)
add_usb_tethering_handler();
add_usb_debug_handler();
-
- ret = usb_state_changed(extcon_usb_ops.status);
- if (ret < 0)
- _E("Failed to update usb status: %d", ret);
}
static void usb_exit(void *data)