diff options
author | Arjan van de Ven <arjan@infradead.org> | 2008-10-21 00:42:39 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-10-31 00:53:48 -0400 |
commit | 275f165fa970174f8a98205529750e8abb6c0a33 (patch) | |
tree | a9548561c6fd50de8a0d706704ba6c6f22bc7b19 /drivers/net | |
parent | 842e08bd6891bd78b4c3d2e0c4a94bebb32ab3ad (diff) |
pci: use pci_ioremap_bar() in drivers/net
Use the newly introduced pci_ioremap_bar() function in drivers/net.
pci_ioremap_bar() just takes a pci device and a bar number, with the goal
of making it really hard to get wrong, while also having a central place
to stick sanity checks.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bnx2x_main.c | 3 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 7 | ||||
-rw-r--r-- | drivers/net/epic100.c | 2 | ||||
-rw-r--r-- | drivers/net/ixgb/ixgb_main.c | 3 | ||||
-rw-r--r-- | drivers/net/qla3xxx.c | 4 | ||||
-rw-r--r-- | drivers/net/s2io.c | 6 | ||||
-rw-r--r-- | drivers/net/wan/dscc4.c | 3 | ||||
-rw-r--r-- | drivers/net/wan/pc300too.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/pci200syn.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_pci.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ipw2200.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00pci.c | 3 |
12 files changed, 14 insertions, 25 deletions
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 9cfc941aab0a..42965ad54f08 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -10087,8 +10087,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, | |||
10087 | 10087 | ||
10088 | dev->irq = pdev->irq; | 10088 | dev->irq = pdev->irq; |
10089 | 10089 | ||
10090 | bp->regview = ioremap_nocache(dev->base_addr, | 10090 | bp->regview = pci_ioremap_bar(pdev, 0); |
10091 | pci_resource_len(pdev, 0)); | ||
10092 | if (!bp->regview) { | 10091 | if (!bp->regview) { |
10093 | printk(KERN_ERR PFX "Cannot map register space, aborting\n"); | 10092 | printk(KERN_ERR PFX "Cannot map register space, aborting\n"); |
10094 | rc = -ENOMEM; | 10093 | rc = -ENOMEM; |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index 1d487624ad94..07b38fbe4e03 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -966,8 +966,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
966 | hw->back = adapter; | 966 | hw->back = adapter; |
967 | 967 | ||
968 | err = -EIO; | 968 | err = -EIO; |
969 | hw->hw_addr = ioremap(pci_resource_start(pdev, BAR_0), | 969 | hw->hw_addr = pci_ioremap_bar(pdev, BAR_0); |
970 | pci_resource_len(pdev, BAR_0)); | ||
971 | if (!hw->hw_addr) | 970 | if (!hw->hw_addr) |
972 | goto err_ioremap; | 971 | goto err_ioremap; |
973 | 972 | ||
@@ -1015,9 +1014,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
1015 | * because it depends on mac_type */ | 1014 | * because it depends on mac_type */ |
1016 | if ((hw->mac_type == e1000_ich8lan) && | 1015 | if ((hw->mac_type == e1000_ich8lan) && |
1017 | (pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { | 1016 | (pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) { |
1018 | hw->flash_address = | 1017 | hw->flash_address = pci_ioremap_bar(pdev, 1); |
1019 | ioremap(pci_resource_start(pdev, 1), | ||
1020 | pci_resource_len(pdev, 1)); | ||
1021 | if (!hw->flash_address) | 1018 | if (!hw->flash_address) |
1022 | goto err_flashmap; | 1019 | goto err_flashmap; |
1023 | } | 1020 | } |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index 9e4b313100ad..65a404076abe 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -363,7 +363,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev, | |||
363 | ioaddr = pci_resource_start (pdev, 0); | 363 | ioaddr = pci_resource_start (pdev, 0); |
364 | #else | 364 | #else |
365 | ioaddr = pci_resource_start (pdev, 1); | 365 | ioaddr = pci_resource_start (pdev, 1); |
366 | ioaddr = (long) ioremap (ioaddr, pci_resource_len (pdev, 1)); | 366 | ioaddr = (long) pci_ioremap_bar(pdev, 1); |
367 | if (!ioaddr) { | 367 | if (!ioaddr) { |
368 | dev_err(&pdev->dev, "ioremap failed\n"); | 368 | dev_err(&pdev->dev, "ioremap failed\n"); |
369 | goto err_out_free_netdev; | 369 | goto err_out_free_netdev; |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index be3c7dc96f63..21995dff1fa4 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -381,8 +381,7 @@ ixgb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
381 | adapter->hw.back = adapter; | 381 | adapter->hw.back = adapter; |
382 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_DEBUG_LEVEL_SHIFT); | 382 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_DEBUG_LEVEL_SHIFT); |
383 | 383 | ||
384 | adapter->hw.hw_addr = ioremap(pci_resource_start(pdev, BAR_0), | 384 | adapter->hw.hw_addr = pci_ioremap_bar(pdev, BAR_0); |
385 | pci_resource_len(pdev, BAR_0)); | ||
386 | if (!adapter->hw.hw_addr) { | 385 | if (!adapter->hw.hw_addr) { |
387 | err = -EIO; | 386 | err = -EIO; |
388 | goto err_ioremap; | 387 | goto err_ioremap; |
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c index 9589ca75a139..acf8dc55e2a0 100644 --- a/drivers/net/qla3xxx.c +++ b/drivers/net/qla3xxx.c | |||
@@ -3977,9 +3977,7 @@ static int __devinit ql3xxx_probe(struct pci_dev *pdev, | |||
3977 | if (qdev->device_id == QL3032_DEVICE_ID) | 3977 | if (qdev->device_id == QL3032_DEVICE_ID) |
3978 | ndev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; | 3978 | ndev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; |
3979 | 3979 | ||
3980 | qdev->mem_map_registers = | 3980 | qdev->mem_map_registers = pci_ioremap_bar(pdev, 1); |
3981 | ioremap_nocache(pci_resource_start(pdev, 1), | ||
3982 | pci_resource_len(qdev->pdev, 1)); | ||
3983 | if (!qdev->mem_map_registers) { | 3981 | if (!qdev->mem_map_registers) { |
3984 | printk(KERN_ERR PFX "%s: cannot map device registers\n", | 3982 | printk(KERN_ERR PFX "%s: cannot map device registers\n", |
3985 | pci_name(pdev)); | 3983 | pci_name(pdev)); |
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c index 66c1a80c2680..5663fa7aa3da 100644 --- a/drivers/net/s2io.c +++ b/drivers/net/s2io.c | |||
@@ -7917,8 +7917,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
7917 | goto mem_alloc_failed; | 7917 | goto mem_alloc_failed; |
7918 | } | 7918 | } |
7919 | 7919 | ||
7920 | sp->bar0 = ioremap(pci_resource_start(pdev, 0), | 7920 | sp->bar0 = pci_ioremap_bar(pdev, 0); |
7921 | pci_resource_len(pdev, 0)); | ||
7922 | if (!sp->bar0) { | 7921 | if (!sp->bar0) { |
7923 | DBG_PRINT(ERR_DBG, "%s: Neterion: cannot remap io mem1\n", | 7922 | DBG_PRINT(ERR_DBG, "%s: Neterion: cannot remap io mem1\n", |
7924 | dev->name); | 7923 | dev->name); |
@@ -7926,8 +7925,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) | |||
7926 | goto bar0_remap_failed; | 7925 | goto bar0_remap_failed; |
7927 | } | 7926 | } |
7928 | 7927 | ||
7929 | sp->bar1 = ioremap(pci_resource_start(pdev, 2), | 7928 | sp->bar1 = pci_ioremap_bar(pdev, 2); |
7930 | pci_resource_len(pdev, 2)); | ||
7931 | if (!sp->bar1) { | 7929 | if (!sp->bar1) { |
7932 | DBG_PRINT(ERR_DBG, "%s: Neterion: cannot remap io mem2\n", | 7930 | DBG_PRINT(ERR_DBG, "%s: Neterion: cannot remap io mem2\n", |
7933 | dev->name); | 7931 | dev->name); |
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index 5f1ccb2b08b1..7d16ca3cb93c 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
@@ -730,8 +730,7 @@ static int __devinit dscc4_init_one(struct pci_dev *pdev, | |||
730 | goto err_free_mmio_region_1; | 730 | goto err_free_mmio_region_1; |
731 | } | 731 | } |
732 | 732 | ||
733 | ioaddr = ioremap(pci_resource_start(pdev, 0), | 733 | ioaddr = pci_ioremap_bar(pdev, 0); |
734 | pci_resource_len(pdev, 0)); | ||
735 | if (!ioaddr) { | 734 | if (!ioaddr) { |
736 | printk(KERN_ERR "%s: cannot remap MMIO region %llx @ %llx\n", | 735 | printk(KERN_ERR "%s: cannot remap MMIO region %llx @ %llx\n", |
737 | DRV_NAME, (unsigned long long)pci_resource_len(pdev, 0), | 736 | DRV_NAME, (unsigned long long)pci_resource_len(pdev, 0), |
diff --git a/drivers/net/wan/pc300too.c b/drivers/net/wan/pc300too.c index bf1b01590429..222671165223 100644 --- a/drivers/net/wan/pc300too.c +++ b/drivers/net/wan/pc300too.c | |||
@@ -379,7 +379,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev, | |||
379 | card->scabase = ioremap(scaphys, PC300_SCA_SIZE); | 379 | card->scabase = ioremap(scaphys, PC300_SCA_SIZE); |
380 | 380 | ||
381 | ramphys = pci_resource_start(pdev,3) & PCI_BASE_ADDRESS_MEM_MASK; | 381 | ramphys = pci_resource_start(pdev,3) & PCI_BASE_ADDRESS_MEM_MASK; |
382 | card->rambase = ioremap(ramphys, pci_resource_len(pdev,3)); | 382 | card->rambase = pci_ioremap_bar(pdev, 3); |
383 | 383 | ||
384 | if (card->plxbase == NULL || | 384 | if (card->plxbase == NULL || |
385 | card->scabase == NULL || | 385 | card->scabase == NULL || |
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c index b595b64e7538..bba111cdeebe 100644 --- a/drivers/net/wan/pci200syn.c +++ b/drivers/net/wan/pci200syn.c | |||
@@ -343,7 +343,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, | |||
343 | card->scabase = ioremap(scaphys, PCI200SYN_SCA_SIZE); | 343 | card->scabase = ioremap(scaphys, PCI200SYN_SCA_SIZE); |
344 | 344 | ||
345 | ramphys = pci_resource_start(pdev,3) & PCI_BASE_ADDRESS_MEM_MASK; | 345 | ramphys = pci_resource_start(pdev,3) & PCI_BASE_ADDRESS_MEM_MASK; |
346 | card->rambase = ioremap(ramphys, pci_resource_len(pdev,3)); | 346 | card->rambase = pci_ioremap_bar(pdev, 3); |
347 | 347 | ||
348 | if (card->plxbase == NULL || | 348 | if (card->plxbase == NULL || |
349 | card->scabase == NULL || | 349 | card->scabase == NULL || |
diff --git a/drivers/net/wireless/hostap/hostap_pci.c b/drivers/net/wireless/hostap/hostap_pci.c index 3a874fc621d3..8fdd41f4b4f2 100644 --- a/drivers/net/wireless/hostap/hostap_pci.c +++ b/drivers/net/wireless/hostap/hostap_pci.c | |||
@@ -312,7 +312,7 @@ static int prism2_pci_probe(struct pci_dev *pdev, | |||
312 | goto err_out_disable; | 312 | goto err_out_disable; |
313 | } | 313 | } |
314 | 314 | ||
315 | mem = ioremap(phymem, pci_resource_len(pdev, 0)); | 315 | mem = pci_ioremap_bar(pdev, 0); |
316 | if (mem == NULL) { | 316 | if (mem == NULL) { |
317 | printk(KERN_ERR "prism2: Cannot remap PCI memory region\n") ; | 317 | printk(KERN_ERR "prism2: Cannot remap PCI memory region\n") ; |
318 | goto fail; | 318 | goto fail; |
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index d0bfd8621119..13633d8274a3 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -11621,7 +11621,7 @@ static int __devinit ipw_pci_probe(struct pci_dev *pdev, | |||
11621 | length = pci_resource_len(pdev, 0); | 11621 | length = pci_resource_len(pdev, 0); |
11622 | priv->hw_len = length; | 11622 | priv->hw_len = length; |
11623 | 11623 | ||
11624 | base = ioremap_nocache(pci_resource_start(pdev, 0), length); | 11624 | base = pci_ioremap_bar(pdev, 0); |
11625 | if (!base) { | 11625 | if (!base) { |
11626 | err = -ENODEV; | 11626 | err = -ENODEV; |
11627 | goto out_pci_release_regions; | 11627 | goto out_pci_release_regions; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index adf2876ed8ab..62449da577e5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -222,8 +222,7 @@ static int rt2x00pci_alloc_reg(struct rt2x00_dev *rt2x00dev) | |||
222 | { | 222 | { |
223 | struct pci_dev *pci_dev = to_pci_dev(rt2x00dev->dev); | 223 | struct pci_dev *pci_dev = to_pci_dev(rt2x00dev->dev); |
224 | 224 | ||
225 | rt2x00dev->csr.base = ioremap(pci_resource_start(pci_dev, 0), | 225 | rt2x00dev->csr.base = pci_ioremap_bar(pci_dev, 0); |
226 | pci_resource_len(pci_dev, 0)); | ||
227 | if (!rt2x00dev->csr.base) | 226 | if (!rt2x00dev->csr.base) |
228 | goto exit; | 227 | goto exit; |
229 | 228 | ||