UPSTREAM: USB: cdc-wdm: add debug messages on cleanup
authorBjørn Mork <bjorn@mork.no>
Mon, 30 Apr 2012 07:26:11 +0000 (09:26 +0200)
committerGerrit <chrome-bot@google.com>
Tue, 16 Oct 2012 21:10:49 +0000 (14:10 -0700)
Device state cleanup is done in either wdm_disconnect or
wdm_release depending on the order they are called. Adding
a couple of debug messages to document the program flow.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 880bca3a2a6f159d7453e0cbcbfe2f1d8204d907)

Change-Id: I78c3b7815b42737fdedafe43934c1755157c6f7c
Signed-off-by: Ben Chan <benchan@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35152
Reviewed-by: Olof Johansson <olofj@chromium.org>
drivers/usb/class/cdc-wdm.c

index 6bf1a40..3491e2e 100644 (file)
@@ -623,10 +623,12 @@ static int wdm_release(struct inode *inode, struct file *file)
        if (!desc->count) {
                dev_dbg(&desc->intf->dev, "wdm_release: cleanup");
                kill_urbs(desc);
-               if (!test_bit(WDM_DISCONNECTING, &desc->flags))
+               if (!test_bit(WDM_DISCONNECTING, &desc->flags)) {
                        desc->manage_power(desc->intf, 0);
-               else
+               } else {
+                       dev_dbg(&desc->intf->dev, "%s: device gone - cleaning up\n", __func__);
                        cleanup(desc);
+               }
        }
        mutex_unlock(&wdm_mutex);
        return 0;
@@ -900,6 +902,8 @@ static void wdm_disconnect(struct usb_interface *intf)
        mutex_unlock(&desc->rlock);
        if (!desc->count)
                cleanup(desc);
+       else
+               dev_dbg(&intf->dev, "%s: %d open files - postponing cleanup\n", __func__, desc->count);
        mutex_unlock(&wdm_mutex);
 }