From cc098dc705895f6b0109b7e8e026ac2b8ae1c0a1 Mon Sep 17 00:00:00 2001 From: Ivan Vecera Date: Sun, 29 Nov 2009 23:12:52 -0800 Subject: [PATCH] r8169: restore mac addr in rtl8169_remove_one and rtl_shutdown The newer chipsets (all PCI-E) are known that they need full power cycle (AC or battery removal) to reset MAC address to a hardwired one. Previous patch to address this problem loads the original MAC address from EEPROM. But it brought other problem for which it is necessary to introduce a new module parameter. However, it might suffice to restore the initial MAC address before shutdown/reboot/kexec and when removing the module. Signed-off-by: Ivan Vecera Signed-off-by: David S. Miller --- drivers/net/r8169.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index b9221bdc7184..0fe2fc90f207 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -3235,6 +3235,10 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev) flush_scheduled_work(); unregister_netdev(dev); + + /* restore original MAC address */ + rtl_rar_set(tp, dev->perm_addr); + rtl_disable_msi(pdev, tp); rtl8169_release_board(pdev, dev, tp->mmio_addr); pci_set_drvdata(pdev, NULL); @@ -4881,6 +4885,9 @@ static void rtl_shutdown(struct pci_dev *pdev) rtl8169_net_suspend(dev); + /* restore original MAC address */ + rtl_rar_set(tp, dev->perm_addr); + spin_lock_irq(&tp->lock); rtl8169_asic_down(ioaddr); -- 2.39.2