Skip to content

Commit 73ea73a

Browse files
roychl666gregkh
authored andcommitted
USB: gadget: core: adjust uevent timing on gadget unbind
The KOBJ_CHANGE uevent is sent before gadget unbind is actually executed, resulting in inaccurate uevent emitted at incorrect timing (the uevent would have USB_UDC_DRIVER variable set while it would soon be removed). Move the KOBJ_CHANGE uevent to the end of the unbind function so that uevent is sent only after the change has been made. Fixes: 2ccea03 ("usb: gadget: introduce UDC Class") Cc: [email protected] Signed-off-by: Roy Luo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 33cc938 commit 73ea73a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/usb/gadget/udc/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,8 +1646,6 @@ static void gadget_unbind_driver(struct device *dev)
16461646

16471647
dev_dbg(&udc->dev, "unbinding gadget driver [%s]\n", driver->function);
16481648

1649-
kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
1650-
16511649
udc->allow_connect = false;
16521650
cancel_work_sync(&udc->vbus_work);
16531651
mutex_lock(&udc->connect_lock);
@@ -1667,6 +1665,8 @@ static void gadget_unbind_driver(struct device *dev)
16671665
driver->is_bound = false;
16681666
udc->driver = NULL;
16691667
mutex_unlock(&udc_lock);
1668+
1669+
kobject_uevent(&udc->dev.kobj, KOBJ_CHANGE);
16701670
}
16711671

16721672
/* ------------------------------------------------------------------------- */

0 commit comments

Comments
 (0)