Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2944

kernel-2.6.18-238.el5.src.rpm

From: Chad Dupuis <cdupuis@redhat.com>
Date: Tue, 3 Aug 2010 13:48:51 -0400
Subject: [net] netxen: minor suspend resume fixes
Message-id: <20100803134607.2239.74998.sendpatchset@localhost.localdomain>
Patchwork-id: 27309
O-Subject: [RHEL 5.6 PATCH 7/44] netxen: minor suspend resume fixes
Bugzilla: 562937
RH-Acked-by: David S. Miller <davem@redhat.com>
RH-Acked-by: Neil Horman <nhorman@redhat.com>

Bugzilla
========

562937

Upstream Status
===============

net-2.6 commit id bc86fcbac0a86a93ee65cc31769c4e83e6ff2295

Description
===========

>From 4511c0714bd30c3a5f1f86dde86210329ab6af51 Mon Sep 17 00:00:00 2001
From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Tue, 8 Dec 2009 20:40:54 +0000
Subject: [PATCH] netxen: minor suspend resume fixes

o pci device should be disable at the end and it should be enable first.
o Interface should be attached(netif_device_attach()) irrespective
  of its state.

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 85eb1c6..49ac345 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -1472,14 +1472,14 @@ static int __netxen_nic_shutdown(struct pci_dev *pdev)
 		pci_enable_wake(pdev, PCI_D3hot, 1);
 	}
 
-	pci_disable_device(pdev);
-
 	return 0;
 }
 static void netxen_nic_shutdown(struct pci_dev *pdev)
 {
 	if (__netxen_nic_shutdown(pdev))
 		return;
+
+	pci_disable_device(pdev);
 }
 #ifdef CONFIG_PM
 static int
@@ -1492,6 +1492,8 @@ netxen_nic_suspend(struct pci_dev *pdev, pm_message_t state)
 		return retval;
 
 	pci_set_power_state(pdev, pci_choose_state(pdev, state));
+
+	pci_disable_device(pdev);
 	return 0;
 }
 
@@ -1502,13 +1504,14 @@ netxen_nic_resume(struct pci_dev *pdev)
 	struct net_device *netdev = adapter->netdev;
 	int err;
 
-	pci_set_power_state(pdev, PCI_D0);
-	pci_restore_state(pdev);
-
 	err = pci_enable_device(pdev);
 	if (err)
 		return err;
 
+	pci_set_power_state(pdev, PCI_D0);
+	pci_set_master(pdev);
+	pci_restore_state(pdev);
+
 	adapter->ahw.crb_win = -1;
 	adapter->ahw.ocm_win = -1;
 
@@ -1527,11 +1530,10 @@ netxen_nic_resume(struct pci_dev *pdev)
 		if (err)
 			goto err_out_detach;
 
-		netif_device_attach(netdev);
-
 		netxen_config_indev_addr(netdev, NETDEV_UP);
 	}
 
+	netif_device_attach(netdev);
 	netxen_schedule_work(adapter, netxen_fw_poll_work, FW_POLL_DELAY);
 	return 0;