From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
netdev@vger.kernel.org,
Kweh Hock Leong <hock.leong.kweh@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Vince Bridgers <vbridgers2013@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH 1/5] stmmac: pci: convert to use dev_pm_ops
Date: Tue, 21 Oct 2014 19:35:29 +0300 [thread overview]
Message-ID: <1413909333-16380-2-git-send-email-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <1413909333-16380-1-git-send-email-andriy.shevchenko@linux.intel.com>
Convert system PM callbacks to use dev_pm_ops. In addition remove the PCI calls
related to a power state since the bus code cares about this already.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 27 ++++++++++--------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index 655a23b..5459a4e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -143,30 +143,26 @@ static void stmmac_pci_remove(struct pci_dev *pdev)
pci_disable_device(pdev);
}
-#ifdef CONFIG_PM
-static int stmmac_pci_suspend(struct pci_dev *pdev, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int stmmac_pci_suspend(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct net_device *ndev = pci_get_drvdata(pdev);
- int ret;
- ret = stmmac_suspend(ndev);
- pci_save_state(pdev);
- pci_set_power_state(pdev, pci_choose_state(pdev, state));
-
- return ret;
+ return stmmac_suspend(ndev);
}
-static int stmmac_pci_resume(struct pci_dev *pdev)
+static int stmmac_pci_resume(struct device *dev)
{
+ struct pci_dev *pdev = to_pci_dev(dev);
struct net_device *ndev = pci_get_drvdata(pdev);
- pci_set_power_state(pdev, PCI_D0);
- pci_restore_state(pdev);
-
return stmmac_resume(ndev);
}
#endif
+static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_pci_suspend, stmmac_pci_resume);
+
#define STMMAC_VENDOR_ID 0x700
#define STMMAC_DEVICE_ID 0x1108
@@ -183,10 +179,9 @@ struct pci_driver stmmac_pci_driver = {
.id_table = stmmac_id_table,
.probe = stmmac_pci_probe,
.remove = stmmac_pci_remove,
-#ifdef CONFIG_PM
- .suspend = stmmac_pci_suspend,
- .resume = stmmac_pci_resume,
-#endif
+ .driver = {
+ .pm = &stmmac_pm_ops,
+ },
};
MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet PCI driver");
--
2.1.1
next prev parent reply other threads:[~2014-10-21 18:30 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 16:35 [PATCH 0/5] stmmac: pci: various cleanups and fixes Andy Shevchenko
2014-10-21 16:35 ` Andy Shevchenko [this message]
2014-10-21 16:35 ` [PATCH 2/5] stmmac: pci: use managed resources Andy Shevchenko
2014-10-21 20:55 ` Sergei Shtylyov
2014-10-22 8:36 ` Andy Shevchenko
2014-10-27 15:28 ` Giuseppe CAVALLARO
2014-10-30 8:05 ` Andy Shevchenko
2014-11-12 5:14 ` Rayagond Kokatanur
2014-11-12 9:28 ` Andy Shevchenko
2014-10-21 16:35 ` [PATCH 3/5] stmmac: pci: convert to use dev_* macros Andy Shevchenko
2014-10-21 16:35 ` [PATCH 4/5] stmmac: pci: set default filter bins Andy Shevchenko
2014-10-21 16:35 ` [PATCH 5/5] stmmac: pci: remove FSF address Andy Shevchenko
2014-10-30 8:13 ` [PATCH 0/5] stmmac: pci: various cleanups and fixes Giuseppe CAVALLARO
2014-10-30 9:41 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1413909333-16380-2-git-send-email-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=davem@davemloft.net \
--cc=hock.leong.kweh@intel.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
--cc=vbridgers2013@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).