From patchwork Sun Dec 19 23:32:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafael Wysocki X-Patchwork-Id: 419191 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBJNXcVp010286 for ; Sun, 19 Dec 2010 23:33:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932559Ab0LSXdf (ORCPT ); Sun, 19 Dec 2010 18:33:35 -0500 Received: from ogre.sisk.pl ([217.79.144.158]:39527 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932557Ab0LSXd3 (ORCPT ); Sun, 19 Dec 2010 18:33:29 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id E0FCE19CC4C; Mon, 20 Dec 2010 00:28:06 +0100 (CET) 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 23331-08; Mon, 20 Dec 2010 00:27:44 +0100 (CET) Received: from ferrari.rjw.lan (220-bem-13.acn.waw.pl [82.210.184.220]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ogre.sisk.pl (Postfix) with ESMTP id 9A8C519851A; Mon, 20 Dec 2010 00:27:44 +0100 (CET) From: "Rafael J. Wysocki" To: "Luis R. Rodriguez" Subject: [PATCH] ath9k: Do not use legacy PCI power management Date: Mon, 20 Dec 2010 00:32:21 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.37-rc6+; KDE/4.4.4; x86_64; ; ) Cc: LKML , "Linux-pm mailing list" , linux-wireless@vger.kernel.org, ath9k-devel@venema.h4ckr.net, "John W. Linville" References: <201010160036.17653.rjw@sisk.pl> In-Reply-To: <201010160036.17653.rjw@sisk.pl> MIME-Version: 1.0 Message-Id: <201012200032.21704.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sun, 19 Dec 2010 23:33:39 +0000 (UTC) Index: linux-2.6/drivers/net/wireless/ath/ath9k/pci.c =================================================================== --- linux-2.6.orig/drivers/net/wireless/ath/ath9k/pci.c +++ linux-2.6/drivers/net/wireless/ath/ath9k/pci.c @@ -247,34 +247,25 @@ static void ath_pci_remove(struct pci_de #ifdef CONFIG_PM -static int ath_pci_suspend(struct pci_dev *pdev, pm_message_t state) +static int ath_pci_suspend(struct device *device) { + struct pci_dev *pdev = to_pci_dev(device); struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ath_wiphy *aphy = hw->priv; struct ath_softc *sc = aphy->sc; ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1); - pci_save_state(pdev); - pci_disable_device(pdev); - pci_set_power_state(pdev, PCI_D3hot); - return 0; } -static int ath_pci_resume(struct pci_dev *pdev) +static int ath_pci_resume(struct device *device) { + struct pci_dev *pdev = to_pci_dev(device); struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ath_wiphy *aphy = hw->priv; struct ath_softc *sc = aphy->sc; u32 val; - int err; - - pci_restore_state(pdev); - - err = pci_enable_device(pdev); - if (err) - return err; /* * Suspend/Resume resets the PCI configuration space, so we have to @@ -293,7 +284,15 @@ static int ath_pci_resume(struct pci_dev return 0; } -#endif /* CONFIG_PM */ +static SIMPLE_DEV_PM_OPS(ath9k_pm_ops, ath_pci_suspend, ath_pci_resume); +#define ATH9K_PM_OPS (&ath9k_pm_ops) + +#else /* !CONFIG_PM */ + +#define ATH9K_PM_OPS NULL + +#endif /* !CONFIG_PM */ + MODULE_DEVICE_TABLE(pci, ath_pci_id_table); @@ -302,10 +301,7 @@ static struct pci_driver ath_pci_driver .id_table = ath_pci_id_table, .probe = ath_pci_probe, .remove = ath_pci_remove, -#ifdef CONFIG_PM - .suspend = ath_pci_suspend, - .resume = ath_pci_resume, -#endif /* CONFIG_PM */ + .driver.pm = ATH9K_PM_OPS, }; int ath_pci_init(void)