Removed the usb_state_changed() function that was called by usb_init() without meaning. 15/225715/2
authorINSUN PYO <insun.pyo@samsung.com>
Mon, 24 Feb 2020 06:09:30 +0000 (15:09 +0900)
committerINSUN PYO <insun.pyo@samsung.com>
Mon, 24 Feb 2020 06:23:26 +0000 (15:23 +0900)
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

src/usb/usb.c

index f94ca80..2d52bf2 100644 (file)
@@ -375,6 +375,7 @@ static int usb_state_changed(int status)
        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)
@@ -456,10 +457,6 @@ static void usb_init(void *data)
 
        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)