From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: LKML <linux-kernel@vger.kernel.org>
Cc: ACPI mailing list <acpi-devel@lists.sourceforge.net>,
Andrew Morton <akpm@osdl.org>,
alsa-devel@alsa-project.org
Subject: Re: [PATCH] 2.6.13-rc3-git5: fix Bug #4416 (2/2)
Date: Tue, 26 Jul 2005 12:54:04 +0200 [thread overview]
Message-ID: <200507261254.05507.rjw@sisk.pl> (raw)
In-Reply-To: <200507261247.05684.rjw@sisk.pl>
The following patch adds basic suspend/resume support to the sk98lin
network driver.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
--- linux-2.6.13-rc3-git5/drivers/net/sk98lin/skge.c 2005-07-23 19:26:29.000000000 +0200
+++ patched/drivers/net/sk98lin/skge.c 2005-07-25 18:17:57.000000000 +0200
@@ -5133,6 +5133,75 @@ static void __devexit skge_remove_one(st
kfree(pAC);
}
+#ifdef CONFIG_PM
+static int skge_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+ struct net_device *dev = pci_get_drvdata(pdev);
+ DEV_NET *pNet = netdev_priv(dev);
+ SK_AC *pAC = pNet->pAC;
+ struct net_device *otherdev = pAC->dev[1];
+
+ if (pNet->Up) {
+ pAC->WasIfUp[0] = SK_TRUE;
+ DoPrintInterfaceChange = SK_FALSE;
+ SkDrvDeInitAdapter(pAC, 0); /* performs SkGeClose */
+ }
+ if (otherdev != dev) {
+ pNet = netdev_priv(otherdev);
+ if (pNet->Up) {
+ pAC->WasIfUp[1] = SK_TRUE;
+ DoPrintInterfaceChange = SK_FALSE;
+ SkDrvDeInitAdapter(pAC, 1); /* performs SkGeClose */
+ }
+ }
+
+ pci_save_state(pdev);
+ pci_enable_wake(pdev, pci_choose_state(pdev, state), 0);
+ if (pAC->AllocFlag & SK_ALLOC_IRQ) {
+ free_irq(dev->irq, dev);
+ }
+ pci_disable_device(pdev);
+ pci_set_power_state(pdev, pci_choose_state(pdev, state));
+
+ return 0;
+}
+
+static int skge_resume(struct pci_dev *pdev)
+{
+ struct net_device *dev = pci_get_drvdata(pdev);
+ DEV_NET *pNet = netdev_priv(dev);
+ SK_AC *pAC = pNet->pAC;
+ int ret;
+
+ pci_set_power_state(pdev, PCI_D0);
+ pci_restore_state(pdev);
+ pci_enable_device(pdev);
+ pci_set_master(pdev);
+ if (pAC->GIni.GIMacsFound == 2)
+ ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev);
+ else
+ ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev);
+ if (ret) {
+ printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq);
+ pAC->AllocFlag &= ~SK_ALLOC_IRQ;
+ dev->irq = 0;
+ pci_disable_device(pdev);
+ return -EBUSY;
+ }
+
+ if (pAC->WasIfUp[0] == SK_TRUE) {
+ DoPrintInterfaceChange = SK_FALSE;
+ SkDrvInitAdapter(pAC, 0); /* first device */
+ }
+ if (pAC->dev[1] != dev && pAC->WasIfUp[1] == SK_TRUE) {
+ DoPrintInterfaceChange = SK_FALSE;
+ SkDrvInitAdapter(pAC, 1); /* second device */
+ }
+
+ return 0;
+}
+#endif
+
static struct pci_device_id skge_pci_tbl[] = {
{ PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
{ PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
@@ -5158,6 +5227,8 @@ static struct pci_driver skge_driver = {
.id_table = skge_pci_tbl,
.probe = skge_probe_one,
.remove = __devexit_p(skge_remove_one),
+ .suspend = skge_suspend,
+ .resume = skge_resume,
};
static int __init skge_init(void)
next prev parent reply other threads:[~2005-07-26 10:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-26 10:47 [PATCH] 2.6.13-rc3-git5: fix Bug #4416 (0/2) Rafael J. Wysocki
2005-07-26 10:51 ` [PATCH] 2.6.13-rc3-git5: fix Bug #4416 (1/2) Rafael J. Wysocki
2005-07-27 8:53 ` [Alsa-devel] " Takashi Iwai
2005-07-27 20:52 ` [ACPI] " Pavel Machek
2005-07-28 8:06 ` Takashi Iwai
2005-07-28 8:31 ` Pavel Machek
2005-07-28 8:37 ` Shaohua Li
2005-07-28 8:43 ` Rafael J. Wysocki
2005-07-28 8:48 ` Shaohua Li
2005-07-28 11:18 ` Rafael J. Wysocki
2005-07-26 10:54 ` Rafael J. Wysocki [this message]
2005-07-26 12:25 ` [ACPI] Re: [PATCH] 2.6.13-rc3-git5: fix Bug #4416 (2/2) Carl-Daniel Hailfinger
2005-07-26 21:02 ` Rafael J. Wysocki
2005-07-26 21:11 ` Peter Buckingham
2005-07-26 21:37 ` Rafael J. Wysocki
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=200507261254.05507.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=acpi-devel@lists.sourceforge.net \
--cc=akpm@osdl.org \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®