aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r8169.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/r8169.c')
-rw-r--r--drivers/net/r8169.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 340da3915b96..217e709bda3e 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2775,6 +2775,7 @@ static void rtl8169_release_board(struct pci_dev *pdev, struct net_device *dev,
2775{ 2775{
2776 iounmap(ioaddr); 2776 iounmap(ioaddr);
2777 pci_release_regions(pdev); 2777 pci_release_regions(pdev);
2778 pci_clear_mwi(pdev);
2778 pci_disable_device(pdev); 2779 pci_disable_device(pdev);
2779 free_netdev(dev); 2780 free_netdev(dev);
2780} 2781}
@@ -2841,8 +2842,13 @@ static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
2841 spin_lock_irq(&tp->lock); 2842 spin_lock_irq(&tp->lock);
2842 2843
2843 RTL_W8(Cfg9346, Cfg9346_Unlock); 2844 RTL_W8(Cfg9346, Cfg9346_Unlock);
2845
2844 RTL_W32(MAC4, high); 2846 RTL_W32(MAC4, high);
2847 RTL_R32(MAC4);
2848
2845 RTL_W32(MAC0, low); 2849 RTL_W32(MAC0, low);
2850 RTL_R32(MAC0);
2851
2846 RTL_W8(Cfg9346, Cfg9346_Lock); 2852 RTL_W8(Cfg9346, Cfg9346_Lock);
2847 2853
2848 spin_unlock_irq(&tp->lock); 2854 spin_unlock_irq(&tp->lock);
@@ -3030,9 +3036,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3030 goto err_out_free_dev_1; 3036 goto err_out_free_dev_1;
3031 } 3037 }
3032 3038
3033 rc = pci_set_mwi(pdev); 3039 if (pci_set_mwi(pdev) < 0)
3034 if (rc < 0) 3040 netif_info(tp, probe, dev, "Mem-Wr-Inval unavailable\n");
3035 goto err_out_disable_2;
3036 3041
3037 /* make sure PCI base addr 1 is MMIO */ 3042 /* make sure PCI base addr 1 is MMIO */
3038 if (!(pci_resource_flags(pdev, region) & IORESOURCE_MEM)) { 3043 if (!(pci_resource_flags(pdev, region) & IORESOURCE_MEM)) {
@@ -3040,7 +3045,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3040 "region #%d not an MMIO resource, aborting\n", 3045 "region #%d not an MMIO resource, aborting\n",
3041 region); 3046 region);
3042 rc = -ENODEV; 3047 rc = -ENODEV;
3043 goto err_out_mwi_3; 3048 goto err_out_mwi_2;
3044 } 3049 }
3045 3050
3046 /* check for weird/broken PCI region reporting */ 3051 /* check for weird/broken PCI region reporting */
@@ -3048,13 +3053,13 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3048 netif_err(tp, probe, dev, 3053 netif_err(tp, probe, dev,
3049 "Invalid PCI region size(s), aborting\n"); 3054 "Invalid PCI region size(s), aborting\n");
3050 rc = -ENODEV; 3055 rc = -ENODEV;
3051 goto err_out_mwi_3; 3056 goto err_out_mwi_2;
3052 } 3057 }
3053 3058
3054 rc = pci_request_regions(pdev, MODULENAME); 3059 rc = pci_request_regions(pdev, MODULENAME);
3055 if (rc < 0) { 3060 if (rc < 0) {
3056 netif_err(tp, probe, dev, "could not request regions\n"); 3061 netif_err(tp, probe, dev, "could not request regions\n");
3057 goto err_out_mwi_3; 3062 goto err_out_mwi_2;
3058 } 3063 }
3059 3064
3060 tp->cp_cmd = PCIMulRW | RxChkSum; 3065 tp->cp_cmd = PCIMulRW | RxChkSum;
@@ -3067,7 +3072,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3067 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); 3072 rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
3068 if (rc < 0) { 3073 if (rc < 0) {
3069 netif_err(tp, probe, dev, "DMA configuration failed\n"); 3074 netif_err(tp, probe, dev, "DMA configuration failed\n");
3070 goto err_out_free_res_4; 3075 goto err_out_free_res_3;
3071 } 3076 }
3072 } 3077 }
3073 3078
@@ -3076,7 +3081,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3076 if (!ioaddr) { 3081 if (!ioaddr) {
3077 netif_err(tp, probe, dev, "cannot remap MMIO, aborting\n"); 3082 netif_err(tp, probe, dev, "cannot remap MMIO, aborting\n");
3078 rc = -EIO; 3083 rc = -EIO;
3079 goto err_out_free_res_4; 3084 goto err_out_free_res_3;
3080 } 3085 }
3081 3086
3082 tp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP); 3087 tp->pcie_cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
@@ -3118,7 +3123,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3118 if (i == ARRAY_SIZE(rtl_chip_info)) { 3123 if (i == ARRAY_SIZE(rtl_chip_info)) {
3119 dev_err(&pdev->dev, 3124 dev_err(&pdev->dev,
3120 "driver bug, MAC version not found in rtl_chip_info\n"); 3125 "driver bug, MAC version not found in rtl_chip_info\n");
3121 goto err_out_msi_5; 3126 goto err_out_msi_4;
3122 } 3127 }
3123 tp->chipset = i; 3128 tp->chipset = i;
3124 3129
@@ -3183,7 +3188,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3183 3188
3184 rc = register_netdev(dev); 3189 rc = register_netdev(dev);
3185 if (rc < 0) 3190 if (rc < 0)
3186 goto err_out_msi_5; 3191 goto err_out_msi_4;
3187 3192
3188 pci_set_drvdata(pdev, dev); 3193 pci_set_drvdata(pdev, dev);
3189 3194
@@ -3212,14 +3217,13 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3212out: 3217out:
3213 return rc; 3218 return rc;
3214 3219
3215err_out_msi_5: 3220err_out_msi_4:
3216 rtl_disable_msi(pdev, tp); 3221 rtl_disable_msi(pdev, tp);
3217 iounmap(ioaddr); 3222 iounmap(ioaddr);
3218err_out_free_res_4: 3223err_out_free_res_3:
3219 pci_release_regions(pdev); 3224 pci_release_regions(pdev);
3220err_out_mwi_3: 3225err_out_mwi_2:
3221 pci_clear_mwi(pdev); 3226 pci_clear_mwi(pdev);
3222err_out_disable_2:
3223 pci_disable_device(pdev); 3227 pci_disable_device(pdev);
3224err_out_free_dev_1: 3228err_out_free_dev_1:
3225 free_netdev(dev); 3229 free_netdev(dev);