From: Dima Zavin Date: Wed, 14 Sep 2011 18:52:45 +0000 (-0700) Subject: usb: gadget: android: dump the uevents sent when changing states X-Git-Tag: firefly_0821_release~7613^2~310 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fc7534906acf0efd26abcd2aa971a453e9b51768;p=firefly-linux-kernel-4.4.55.git usb: gadget: android: dump the uevents sent when changing states Change-Id: If5011e39f400b3aca036a890b8b932a7606a7ac2 Signed-off-by: Dima Zavin --- diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c index a7d5b19dc161..8ff997261e01 100644 --- a/drivers/usb/gadget/android.c +++ b/drivers/usb/gadget/android.c @@ -163,22 +163,24 @@ static void android_work(struct work_struct *data) char *disconnected[2] = { "USB_STATE=DISCONNECTED", NULL }; char *connected[2] = { "USB_STATE=CONNECTED", NULL }; char *configured[2] = { "USB_STATE=CONFIGURED", NULL }; + char **uevent_envp = NULL; unsigned long flags; spin_lock_irqsave(&cdev->lock, flags); if (cdev->config) { - spin_unlock_irqrestore(&cdev->lock, flags); - kobject_uevent_env(&dev->dev->kobj, KOBJ_CHANGE, - configured); - return; - } - if (dev->connected != dev->sw_connected) { + uevent_envp = configured; + } else if (dev->connected != dev->sw_connected) { dev->sw_connected = dev->connected; - spin_unlock_irqrestore(&cdev->lock, flags); - kobject_uevent_env(&dev->dev->kobj, KOBJ_CHANGE, - dev->sw_connected ? connected : disconnected); + uevent_envp = dev->sw_connected ? connected : disconnected; + } + spin_unlock_irqrestore(&cdev->lock, flags); + + if (uevent_envp) { + kobject_uevent_env(&dev->dev->kobj, KOBJ_CHANGE, uevent_envp); + pr_info("%s: sent uevent %s\n", __func__, uevent_envp[0]); } else { - spin_unlock_irqrestore(&cdev->lock, flags); + pr_info("%s: did not send uevent (%d %d %p)\n", __func__, + dev->connected, dev->sw_connected, cdev->config); } }