From patchwork Wed Mar 17 22:39:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 47972 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 005C1B7D1D for ; Thu, 18 Mar 2010 09:36:32 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756170Ab0CQWg2 (ORCPT ); Wed, 17 Mar 2010 18:36:28 -0400 Received: from ogre.sisk.pl ([217.79.144.158]:47375 "EHLO ogre.sisk.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756160Ab0CQWg1 (ORCPT ); Wed, 17 Mar 2010 18:36:27 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by ogre.sisk.pl (Postfix) with ESMTP id 5478917BEAC; Wed, 17 Mar 2010 23:07:54 +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 05449-04; Wed, 17 Mar 2010 23:07:47 +0100 (CET) Received: from tosh.localnet (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 28D6317BE79; Wed, 17 Mar 2010 23:07:47 +0100 (CET) From: "Rafael J. Wysocki" To: David Miller Subject: Re: e1000e: Fix build with CONFIG_PM disabled. Date: Wed, 17 Mar 2010 23:39:15 +0100 User-Agent: KMail/1.12.4 (Linux/2.6.34-rc1-rjw; KDE/4.3.5; x86_64; ; ) Cc: emil.s.tantilov@intel.com, netdev@vger.kernel.org, bruce.w.allan@intel.com, jesse.brandeburg@intel.com, jeffrey.t.kirsher@intel.com References: <20100316.234100.133957798.davem@davemloft.net> <20100317.111717.85209898.davem@davemloft.net> In-Reply-To: <20100317.111717.85209898.davem@davemloft.net> MIME-Version: 1.0 Message-Id: <201003172339.15494.rjw@sisk.pl> X-Virus-Scanned: amavisd-new at ogre.sisk.pl using MkS_Vir for Linux Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wednesday 17 March 2010, David Miller wrote: > From: "Tantilov, Emil S" > Date: Wed, 17 Mar 2010 11:57:59 -0600 > > > But then the driver build fails again when CONFIG_PM_RUNTIME is not set. > > > > drivers/net/e1000e/netdev.c: In function `e1000_runtime_resume`: > > drivers/net/e1000e/netdev.c:4807: error: `struct dev_pm_info` has no member named `runtime_auto` > > Ugh, can someone send me a fix for that? Appended, on top of your patch. It only moves the code around and adds #ifdefs. Thanks, Rafael --- From: Rafael J. Wysocki Subject: Net / e1000e: Fix build issue introduced by runtime PM patch The recent PCI runtime PM patch broke build for CONFIG_PM_RUNTIME and CONFIG_PM_SLEEP undefined. Fix that by moving the PM callbacks under suitable #ifdefs. Signed-off-by: Rafael J. Wysocki --- drivers/net/e1000e/netdev.c | 116 +++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 59 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/drivers/net/e1000e/netdev.c =================================================================== --- linux-2.6.orig/drivers/net/e1000e/netdev.c +++ linux-2.6/drivers/net/e1000e/netdev.c @@ -4664,58 +4664,12 @@ static void e1000e_disable_l1aspm(struct } } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_OPS static bool e1000e_pm_ready(struct e1000_adapter *adapter) { return !!adapter->tx_ring->buffer_info; } -static int e1000_idle(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct net_device *netdev = pci_get_drvdata(pdev); - struct e1000_adapter *adapter = netdev_priv(netdev); - - if (!e1000e_pm_ready(adapter)) - return 0; - - if (adapter->idle_check) { - adapter->idle_check = false; - if (!e1000e_has_link(adapter)) - pm_schedule_suspend(dev, MSEC_PER_SEC); - } - - return -EBUSY; -} - -static int e1000_suspend(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - int retval; - bool wake; - - retval = __e1000_shutdown(pdev, &wake, false); - if (!retval) - e1000_complete_shutdown(pdev, true, wake); - - return retval; -} - -static int e1000_runtime_suspend(struct device *dev) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct net_device *netdev = pci_get_drvdata(pdev); - struct e1000_adapter *adapter = netdev_priv(netdev); - - if (e1000e_pm_ready(adapter)) { - bool wake; - - __e1000_shutdown(pdev, &wake, true); - } - - return 0; -} - static int __e1000_resume(struct pci_dev *pdev) { struct net_device *netdev = pci_get_drvdata(pdev); @@ -4783,6 +4737,20 @@ static int __e1000_resume(struct pci_dev return 0; } +#ifdef CONFIG_PM_SLEEP +static int e1000_suspend(struct device *dev) +{ + struct pci_dev *pdev = to_pci_dev(dev); + int retval; + bool wake; + + retval = __e1000_shutdown(pdev, &wake, false); + if (!retval) + e1000_complete_shutdown(pdev, true, wake); + + return retval; +} + static int e1000_resume(struct device *dev) { struct pci_dev *pdev = to_pci_dev(dev); @@ -4794,6 +4762,41 @@ static int e1000_resume(struct device *d return __e1000_resume(pdev); } +#endif /* CONFIG_PM_SLEEP */ + +#ifdef CONFIG_PM_RUNTIME +static int e1000_runtime_suspend(struct device *dev) +{ + struct pci_dev *pdev = to_pci_dev(dev); + struct net_device *netdev = pci_get_drvdata(pdev); + struct e1000_adapter *adapter = netdev_priv(netdev); + + if (e1000e_pm_ready(adapter)) { + bool wake; + + __e1000_shutdown(pdev, &wake, true); + } + + return 0; +} + +static int e1000_idle(struct device *dev) +{ + struct pci_dev *pdev = to_pci_dev(dev); + struct net_device *netdev = pci_get_drvdata(pdev); + struct e1000_adapter *adapter = netdev_priv(netdev); + + if (!e1000e_pm_ready(adapter)) + return 0; + + if (adapter->idle_check) { + adapter->idle_check = false; + if (!e1000e_has_link(adapter)) + pm_schedule_suspend(dev, MSEC_PER_SEC); + } + + return -EBUSY; +} static int e1000_runtime_resume(struct device *dev) { @@ -4807,7 +4810,8 @@ static int e1000_runtime_resume(struct d adapter->idle_check = !dev->power.runtime_auto; return __e1000_resume(pdev); } -#endif +#endif /* CONFIG_PM_RUNTIME */ +#endif /* CONFIG_PM_OPS */ static void e1000_shutdown(struct pci_dev *pdev) { @@ -5475,17 +5479,11 @@ static DEFINE_PCI_DEVICE_TABLE(e1000_pci }; MODULE_DEVICE_TABLE(pci, e1000_pci_tbl); -#ifdef CONFIG_PM +#ifdef CONFIG_PM_OPS static const struct dev_pm_ops e1000_pm_ops = { - .suspend = e1000_suspend, - .resume = e1000_resume, - .freeze = e1000_suspend, - .thaw = e1000_resume, - .poweroff = e1000_suspend, - .restore = e1000_resume, - .runtime_suspend = e1000_runtime_suspend, - .runtime_resume = e1000_runtime_resume, - .runtime_idle = e1000_idle, + SET_SYSTEM_SLEEP_PM_OPS(e1000_suspend, e1000_resume) + SET_RUNTIME_PM_OPS(e1000_runtime_suspend, + e1000_runtime_resume, e1000_idle) }; #endif @@ -5495,7 +5493,7 @@ static struct pci_driver e1000_driver = .id_table = e1000_pci_tbl, .probe = e1000_probe, .remove = __devexit_p(e1000_remove), -#ifdef CONFIG_PM +#ifdef CONFIG_PM_OPS .driver.pm = &e1000_pm_ops, #endif .shutdown = e1000_shutdown,