From akpm@linux-foundation.org Wed May 30 20:20:55 2007 Return-Path: Received: from murder ([unix socket]) by ogre.sisk.pl (Cyrus v2.2.12) with LMTPA; Wed, 30 May 2007 20:09:27 +0200 X-Sieve: CMU Sieve 2.2 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 3E83A4F79C for ; Wed, 30 May 2007 20:09:27 +0200 (CEST) Received: from ogre.sisk.pl ([127.0.0.1]) by localhost (ogre.sisk.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23662-02 for ; Wed, 30 May 2007 20:09:26 +0200 (CEST) Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ogre.sisk.pl (Postfix) with ESMTP id 2FCC04F790 for ; Wed, 30 May 2007 20:09:26 +0200 (CEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753668AbXE3SVr (ORCPT ); Wed, 30 May 2007 14:21:47 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753809AbXE3SVr (ORCPT ); Wed, 30 May 2007 14:21:47 -0400 Received: from smtp1.linux-foundation.org ([207.189.120.13]:38318 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753668AbXE3SVq (ORCPT ); Wed, 30 May 2007 14:21:46 -0400 Received: from shell0.pdx.osdl.net (fw.osdl.org [65.172.181.6]) by smtp1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id l4UIKuof030146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 30 May 2007 11:20:58 -0700 Received: from localhost.localdomain (shell0.pdx.osdl.net [10.9.0.31]) by shell0.pdx.osdl.net (8.13.1/8.11.6) with ESMTP id l4UIKtRQ001564; Wed, 30 May 2007 11:20:56 -0700 Message-Id: <200705301820.l4UIKtRQ001564@shell0.pdx.osdl.net> Subject: + usb-replace-flush_workqueue-with-cancel_sync_work.patch added to -mm tree To: mm-commits@vger.kernel.org Cc: stern@rowland.harvard.edu, akpm@linux-foundation.org, greg@kroah.com, mlord@pobox.com, oleg@tv-sign.ru From: akpm@linux-foundation.org Date: Wed, 30 May 2007 11:20:55 -0700 X-MIMEDefang-Filter: osdl$Revision: 1.179 $ X-Scanned-By: MIMEDefang 2.53 on 207.189.120.13 Sender: mm-commits-owner@vger.kernel.org Precedence: bulk Reply-To: linux-kernel@vger.kernel.org X-Mailing-List: mm-commits@vger.kernel.org X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux X-Length: 7201 X-UID: 356544 Status: R X-Status: NC X-KMail-EncryptionState: X-KMail-SignatureState: X-KMail-MDN-Sent: The patch titled USB: replace flush_workqueue with cancel_sync_work has been added to the -mm tree. Its filename is usb-replace-flush_workqueue-with-cancel_sync_work.patch drivers/usb/core/hcd.c | 2 +- drivers/usb/core/hub.c | 32 +++++++++++++++++++++++++------- drivers/usb/core/usb.c | 4 ---- 3 files changed, 26 insertions(+), 12 deletions(-) Index: linux-2.6.22-rc3/drivers/usb/core/hcd.c =================================================================== --- linux-2.6.22-rc3.orig/drivers/usb/core/hcd.c 2007-05-26 22:08:13.000000000 +0200 +++ linux-2.6.22-rc3/drivers/usb/core/hcd.c 2007-05-31 08:03:40.000000000 +0200 @@ -1681,7 +1681,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) spin_unlock_irq (&hcd_root_hub_lock); #ifdef CONFIG_PM - flush_workqueue(ksuspend_usb_wq); + cancel_work_sync(&hcd->wakeup_work); #endif mutex_lock(&usb_bus_list_lock); Index: linux-2.6.22-rc3/drivers/usb/core/hub.c =================================================================== --- linux-2.6.22-rc3.orig/drivers/usb/core/hub.c 2007-05-31 08:01:23.000000000 +0200 +++ linux-2.6.22-rc3/drivers/usb/core/hub.c 2007-05-31 08:03:40.000000000 +0200 @@ -1159,6 +1159,30 @@ static void release_address(struct usb_d } } +#ifdef CONFIG_USB_SUSPEND + +static void usb_stop_pm(struct usb_device *udev) +{ + /* Synchronize with the ksuspend thread to prevent any more + * autosuspend requests from being submitted, and decrement + * the parent's count of unsuspended children. + */ + usb_pm_lock(udev); + if (udev->parent && !udev->discon_suspended) + usb_autosuspend_device(udev->parent); + usb_pm_unlock(udev); + + /* Stop any autosuspend requests already submitted */ + cancel_rearming_delayed_work(&udev->autosuspend); +} + +#else + +static inline void usb_stop_pm(struct usb_device *udev) +{ } + +#endif + /** * usb_disconnect - disconnect a device (usbcore-internal) * @pdev: pointer to device being disconnected @@ -1225,13 +1249,7 @@ void usb_disconnect(struct usb_device ** *pdev = NULL; spin_unlock_irq(&device_state_lock); - /* Decrement the parent's count of unsuspended children */ - if (udev->parent) { - usb_pm_lock(udev); - if (!udev->discon_suspended) - usb_autosuspend_device(udev->parent); - usb_pm_unlock(udev); - } + usb_stop_pm(udev); put_device(&udev->dev); } Index: linux-2.6.22-rc3/drivers/usb/core/usb.c =================================================================== --- linux-2.6.22-rc3.orig/drivers/usb/core/usb.c 2007-05-26 22:08:13.000000000 +0200 +++ linux-2.6.22-rc3/drivers/usb/core/usb.c 2007-05-31 08:03:40.000000000 +0200 @@ -184,10 +184,6 @@ static void usb_release_dev(struct devic udev = to_usb_device(dev); -#ifdef CONFIG_USB_SUSPEND - cancel_delayed_work(&udev->autosuspend); - flush_workqueue(ksuspend_usb_wq); -#endif usb_destroy_configuration(udev); usb_put_hcd(bus_to_hcd(udev->bus)); kfree(udev->product);