From 8cdb652f68a96373ac0e58852226c80a0fb17035 Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Mon, 4 Jun 2012 21:57:09 +0200 Subject: Revert "USB: cdc-wdm: cannot use dev_printk when device is gone" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8fd4242d5ce7514591eff1b1170ab253b215a787. Signed-off-by: Bjørn Mork --- drivers/usb/class/cdc-wdm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 554ac907777..40a3f0b17d3 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -496,9 +496,7 @@ static int wdm_flush(struct file *file, fl_owner_t id) struct wdm_device *desc = file->private_data; wait_event(desc->wait, !test_bit(WDM_IN_USE, &desc->flags)); - - /* cannot dereference desc->intf if WDM_DISCONNECTING */ - if (desc->werr < 0 && !test_bit(WDM_DISCONNECTING, &desc->flags)) + if (desc->werr < 0) dev_err(&desc->intf->dev, "Error in flush path: %d\n", desc->werr); @@ -588,13 +586,12 @@ static int wdm_release(struct inode *inode, struct file *file) mutex_unlock(&desc->wlock); if (!desc->count) { + dev_dbg(&desc->intf->dev, "wdm_release: cleanup"); + kill_urbs(desc); if (!test_bit(WDM_DISCONNECTING, &desc->flags)) { - dev_dbg(&desc->intf->dev, "wdm_release: cleanup"); - kill_urbs(desc); desc->intf->needs_remote_wakeup = 0; } else { - /* must avoid dev_printk here as desc->intf is invalid */ - pr_debug(KBUILD_MODNAME " %s: device gone - cleaning up\n", __func__); + dev_dbg(&desc->intf->dev, "%s: device gone - cleaning up\n", __func__); cleanup(desc); } } -- cgit v1.2.3