From: INSUN PYO Date: Mon, 24 Feb 2020 06:09:30 +0000 (+0900) Subject: Removed the usb_state_changed() function that was called by usb_init() without meaning. X-Git-Tag: accepted/tizen/unified/20200225.224439~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F15%2F225715%2F2;p=platform%2Fcore%2Fsystem%2Fdeviced.git Removed the usb_state_changed() function that was called by usb_init() without meaning. 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 --- diff --git a/src/usb/usb.c b/src/usb/usb.c index f94ca80..2d52bf2 100644 --- a/src/usb/usb.c +++ b/src/usb/usb.c @@ -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)