Return-path: Received: from mtiwmhc13.worldnet.att.net ([204.127.131.117]:52546 "EHLO mtiwmhc13.worldnet.att.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751446AbYL3Rw7 (ORCPT ); Tue, 30 Dec 2008 12:52:59 -0500 Message-ID: <495A5FEC.5070608@lwfinger.net> (sfid-20081230_185306_380281_8ED22973) Date: Tue, 30 Dec 2008 11:52:44 -0600 From: Larry Finger MIME-Version: 1.0 To: Alan Jenkins CC: Alan Stern , Bob Copeland , linux-wireless@vger.kernel.org, linux-pm@lists.linux-foundation.org, USB list , Hin-Tak Leung , Herton Ronaldo Krzesinski Subject: Re: [linux-pm] rtl8187 usb wifi adaptor causes suspend hang References: <495A5AE5.1040902@tuffmail.co.uk> In-Reply-To: <495A5AE5.1040902@tuffmail.co.uk> Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-wireless-owner@vger.kernel.org List-ID: Alan Jenkins wrote: > That won't fix hibernation though. The disconnect method can still get > called in resume from hibernation, before the workqueue gets unfrozen. > To be honest, I'm far more interested in suspend-to-disk than > suspend-to-ram. Does this patch fix your problem? It works here, but I only did one test. The patch is for wireless-testing. Larry Index: wireless-testing/drivers/net/wireless/rtl818x/rtl8187_dev.c =================================================================== --- wireless-testing.orig/drivers/net/wireless/rtl818x/rtl8187_dev.c +++ wireless-testing/drivers/net/wireless/rtl818x/rtl8187_dev.c @@ -1464,6 +1464,32 @@ static int __devinit rtl8187_probe(struc return err; } +#ifdef CONFIG_PM + +static int rtl8187_suspend(struct usb_interface *intf, pm_message_t state) +{ + struct ieee80211_hw *dev = usb_get_intfdata(intf); + struct rtl8187_priv *priv; + int time; + + if (!dev) + return 0; + + priv = dev->priv; + + time = usb_wait_anchor_empty_timeout(&priv->anchored, 1000); + if (!time) + usb_kill_anchored_urbs(&priv->anchored); + return 0; +} + +static int rtl8187_resume(struct usb_interface *intf) +{ + return 0; +} + +#endif /* CONFIG_PM */ + static void __devexit rtl8187_disconnect(struct usb_interface *intf) { struct ieee80211_hw *dev = usb_get_intfdata(intf); @@ -1484,6 +1510,10 @@ static struct usb_driver rtl8187_driver .id_table = rtl8187_table, .probe = rtl8187_probe, .disconnect = __devexit_p(rtl8187_disconnect), +#ifdef CONFIG_PM + .suspend = rtl8187_suspend, + .resume = rtl8187_resume, +#endif /* CONFIG_PM */ }; static int __init rtl8187_init(void)