Commit 1e7f0bd8 authored by Domen Puncer's avatar Domen Puncer Committed by Jeff Garzik

drivers/net/: Use the DMA_{64,32}BIT_MASK constants

Use the DMA_{64,32}BIT_MASK constants from dma-mapping.h when calling
pci_set_dma_mask() or pci_set_consistent_dma_mask()

This patch includes dma-mapping.h explicitly because it caused errors
on some architectures otherwise.

See http://marc.theaimsgroup.com/?t=108001993000001&r=1&w=2 for details
Signed-off-by: default avatarTobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: default avatarDomen Puncer <domen@coderock.org>
parent 5ccabb9b
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
...@@ -1167,9 +1168,9 @@ static int __devinit ace_init(struct net_device *dev) ...@@ -1167,9 +1168,9 @@ static int __devinit ace_init(struct net_device *dev)
/* /*
* Configure DMA attributes. * Configure DMA attributes.
*/ */
if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) { if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
ap->pci_using_dac = 1; ap->pci_using_dac = 1;
} else if (!pci_set_dma_mask(pdev, 0xffffffffULL)) { } else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
ap->pci_using_dac = 0; ap->pci_using_dac = 0;
} else { } else {
ecode = -ENODEV; ecode = -ENODEV;
......
...@@ -143,6 +143,7 @@ ...@@ -143,6 +143,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/mii.h> #include <linux/mii.h>
...@@ -2286,7 +2287,7 @@ static int __devinit e100_probe(struct pci_dev *pdev, ...@@ -2286,7 +2287,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
goto err_out_disable_pdev; goto err_out_disable_pdev;
} }
if((err = pci_set_dma_mask(pdev, 0xFFFFFFFFULL))) { if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
DPRINTK(PROBE, ERR, "No usable DMA configuration, aborting.\n"); DPRINTK(PROBE, ERR, "No usable DMA configuration, aborting.\n");
goto err_out_free_res; goto err_out_free_res;
} }
......
...@@ -106,6 +106,7 @@ ...@@ -106,6 +106,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/eisa.h> #include <linux/eisa.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
...@@ -557,7 +558,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr, ...@@ -557,7 +558,7 @@ static int __devinit hp100_probe1(struct net_device *dev, int ioaddr,
* Also, we can have EISA Busmaster cards (not tested), * Also, we can have EISA Busmaster cards (not tested),
* so beware !!! - Jean II */ * so beware !!! - Jean II */
if((bus == HP100_BUS_PCI) && if((bus == HP100_BUS_PCI) &&
(pci_set_dma_mask(pci_dev, 0xffffffff))) { (pci_set_dma_mask(pci_dev, DMA_32BIT_MASK))) {
/* Gracefully fallback to shared memory */ /* Gracefully fallback to shared memory */
goto busmasterfail; goto busmasterfail;
} }
......
...@@ -101,6 +101,7 @@ ...@@ -101,6 +101,7 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/delay.h> #include <linux/delay.h>
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
...@@ -4593,19 +4594,19 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre) ...@@ -4593,19 +4594,19 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
return ret; return ret;
} }
if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL)) { if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
DBG_PRINT(INIT_DBG, "s2io_init_nic: Using 64bit DMA\n"); DBG_PRINT(INIT_DBG, "s2io_init_nic: Using 64bit DMA\n");
dma_flag = TRUE; dma_flag = TRUE;
if (pci_set_consistent_dma_mask if (pci_set_consistent_dma_mask
(pdev, 0xffffffffffffffffULL)) { (pdev, DMA_64BIT_MASK)) {
DBG_PRINT(ERR_DBG, DBG_PRINT(ERR_DBG,
"Unable to obtain 64bit DMA for \ "Unable to obtain 64bit DMA for \
consistent allocations\n"); consistent allocations\n");
pci_disable_device(pdev); pci_disable_device(pdev);
return -ENOMEM; return -ENOMEM;
} }
} else if (!pci_set_dma_mask(pdev, 0xffffffffUL)) { } else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
DBG_PRINT(INIT_DBG, "s2io_init_nic: Using 32bit DMA\n"); DBG_PRINT(INIT_DBG, "s2io_init_nic: Using 32bit DMA\n");
} else { } else {
pci_disable_device(pdev); pci_disable_device(pdev);
......
...@@ -112,6 +112,7 @@ ...@@ -112,6 +112,7 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/dma-mapping.h>
#include "h/skdrv1st.h" #include "h/skdrv1st.h"
#include "h/skdrv2nd.h" #include "h/skdrv2nd.h"
...@@ -4912,8 +4913,8 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, ...@@ -4912,8 +4913,8 @@ static int __devinit skge_probe_one(struct pci_dev *pdev,
goto out; goto out;
/* Configure DMA attributes. */ /* Configure DMA attributes. */
if (pci_set_dma_mask(pdev, (u64) 0xffffffffffffffffULL) && if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) &&
pci_set_dma_mask(pdev, (u64) 0xffffffff)) pci_set_dma_mask(pdev, DMA_32BIT_MASK))
goto out_disable_device; goto out_disable_device;
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
...@@ -2989,10 +2990,10 @@ static int __devinit gem_init_one(struct pci_dev *pdev, ...@@ -2989,10 +2990,10 @@ static int __devinit gem_init_one(struct pci_dev *pdev,
*/ */
if (pdev->vendor == PCI_VENDOR_ID_SUN && if (pdev->vendor == PCI_VENDOR_ID_SUN &&
pdev->device == PCI_DEVICE_ID_SUN_GEM && pdev->device == PCI_DEVICE_ID_SUN_GEM &&
!pci_set_dma_mask(pdev, (u64) 0xffffffffffffffffULL)) { !pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
pci_using_dac = 1; pci_using_dac = 1;
} else { } else {
err = pci_set_dma_mask(pdev, (u64) 0xffffffff); err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
if (err) { if (err) {
printk(KERN_ERR PFX "No usable DMA configuration, " printk(KERN_ERR PFX "No usable DMA configuration, "
"aborting.\n"); "aborting.\n");
......
...@@ -171,6 +171,7 @@ ...@@ -171,6 +171,7 @@
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/eisa.h> #include <linux/eisa.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -566,7 +567,7 @@ static int __devinit TLan_probe1(struct pci_dev *pdev, ...@@ -566,7 +567,7 @@ static int __devinit TLan_probe1(struct pci_dev *pdev,
priv->adapter = &board_info[ent->driver_data]; priv->adapter = &board_info[ent->driver_data];
rc = pci_set_dma_mask(pdev, 0xFFFFFFFF); rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
if (rc) { if (rc) {
printk(KERN_ERR "TLAN: No suitable PCI mapping available.\n"); printk(KERN_ERR "TLAN: No suitable PCI mapping available.\n");
goto err_out_free_dev; goto err_out_free_dev;
......
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/version.h> #include <linux/version.h>
#include <linux/bitops.h> #include <linux/bitops.h>
...@@ -257,7 +258,7 @@ static int __devinit streamer_init_one(struct pci_dev *pdev, ...@@ -257,7 +258,7 @@ static int __devinit streamer_init_one(struct pci_dev *pdev,
#endif #endif
#endif #endif
rc = pci_set_dma_mask(pdev, 0xFFFFFFFFULL); rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
if (rc) { if (rc) {
printk(KERN_ERR "%s: No suitable PCI mapping available.\n", printk(KERN_ERR "%s: No suitable PCI mapping available.\n",
dev->name); dev->name);
......
...@@ -186,6 +186,7 @@ static const int multicast_filter_limit = 32; ...@@ -186,6 +186,7 @@ static const int multicast_filter_limit = 32;
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
...@@ -740,7 +741,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev, ...@@ -740,7 +741,7 @@ static int __devinit rhine_init_one(struct pci_dev *pdev,
goto err_out; goto err_out;
/* this should always be supported */ /* this should always be supported */
rc = pci_set_dma_mask(pdev, 0xffffffff); rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
if (rc) { if (rc) {
printk(KERN_ERR "32-bit PCI DMA addresses not supported by " printk(KERN_ERR "32-bit PCI DMA addresses not supported by "
"the card!?\n"); "the card!?\n");
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/hdlc.h> #include <linux/hdlc.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/delay.h> #include <asm/delay.h>
...@@ -624,8 +625,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev, ...@@ -624,8 +625,8 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
/* FIXME when PCI/DMA subsystems are fixed. /* FIXME when PCI/DMA subsystems are fixed.
We set both dma_mask and consistent_dma_mask back to 32 bits We set both dma_mask and consistent_dma_mask back to 32 bits
to indicate the card can do 32-bit DMA addressing */ to indicate the card can do 32-bit DMA addressing */
if (pci_set_consistent_dma_mask(pdev, 0xFFFFFFFF) || if (pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK) ||
pci_set_dma_mask(pdev, 0xFFFFFFFF)) { pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
printk(KERN_ERR "wanXL: No usable DMA configuration\n"); printk(KERN_ERR "wanXL: No usable DMA configuration\n");
wanxl_pci_remove_one(pdev); wanxl_pci_remove_one(pdev);
return -EIO; return -EIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment