[PATCH] Use DMA_*BIT_MASK

From: Matthias Gehre <M.Gehre@gmx.de>

Signed-off-by: Matthias Gehre <M.Gehre@gmx.de>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

Index: linux-kj/Documentation/DMA-mapping.txt
===================================================================
--- linux-kj.orig/Documentation/DMA-mapping.txt	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/Documentation/DMA-mapping.txt	2006-01-18 16:47:11.000000000 +0300
@@ -199,6 +199,8 @@ address during PCI bus mastering you mig
 		       "mydev: 24-bit DMA addressing not available.\n");
 		goto ignore_this_device;
 	}
+[Better use DMA_24BIT_MASK instead of 0x00ffffff.
+See linux/include/dma-mapping.h for reference.]
 
 When pci_set_dma_mask() is successful, and returns zero, the PCI layer
 saves away this mask you have provided.  The PCI layer will use this
Index: linux-kj/drivers/atm/lanai.c
===================================================================
--- linux-kj.orig/drivers/atm/lanai.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/drivers/atm/lanai.c	2006-01-18 16:47:11.000000000 +0300
@@ -1972,7 +1972,7 @@ static int __devinit lanai_pci_start(str
 		    "(itf %d): No suitable DMA available.\n", lanai->number);
 		return -EBUSY;
 	}
-	if (pci_set_consistent_dma_mask(pci, 0xFFFFFFFF) != 0) {
+	if (pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) != 0) {
 		printk(KERN_WARNING DEV_LABEL
 		    "(itf %d): No suitable DMA available.\n", lanai->number);
 		return -EBUSY;
Index: linux-kj/drivers/net/forcedeth.c
===================================================================
--- linux-kj.orig/drivers/net/forcedeth.c	2006-01-18 16:42:19.000000000 +0300
+++ linux-kj/drivers/net/forcedeth.c	2006-01-18 16:47:11.000000000 +0300
@@ -131,6 +131,7 @@
 #include <linux/random.h>
 #include <linux/init.h>
 #include <linux/if_vlan.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/irq.h>
 #include <asm/io.h>
@@ -2467,7 +2468,7 @@ static int __devinit nv_probe(struct pci
 	if (id->driver_data & DEV_HAS_HIGH_DMA) {
 		/* packet format 3: supports 40-bit addressing */
 		np->desc_ver = DESC_VER_3;
-		if (pci_set_dma_mask(pci_dev, 0x0000007fffffffffULL)) {
+		if (pci_set_dma_mask(pci_dev, DMA_39BIT_MASK)) {
 			printk(KERN_INFO "forcedeth: 64-bit DMA failed, using 32-bit addressing for device %s.\n",
 					pci_name(pci_dev));
 		} else {
Index: linux-kj/drivers/net/wan/wanxl.c
===================================================================
--- linux-kj.orig/drivers/net/wan/wanxl.c	2006-01-18 16:42:35.000000000 +0300
+++ linux-kj/drivers/net/wan/wanxl.c	2006-01-18 16:47:11.000000000 +0300
@@ -577,8 +577,8 @@ static int __devinit wanxl_pci_init_one(
 	   We set both dma_mask and consistent_dma_mask to 28 bits
 	   and pray pci_alloc_consistent() will use this info. It should
 	   work on most platforms */
-	if (pci_set_consistent_dma_mask(pdev, 0x0FFFFFFF) ||
-	    pci_set_dma_mask(pdev, 0x0FFFFFFF)) {
+	if (pci_set_consistent_dma_mask(pdev, DMA_28BIT_MASK) ||
+	    pci_set_dma_mask(pdev, DMA_28BIT_MASK)) {
 		printk(KERN_ERR "wanXL: No usable DMA configuration\n");
 		return -EIO;
 	}
Index: linux-kj/drivers/net/wireless/prism54/islpci_hotplug.c
===================================================================
--- linux-kj.orig/drivers/net/wireless/prism54/islpci_hotplug.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/drivers/net/wireless/prism54/islpci_hotplug.c	2006-01-18 16:47:11.000000000 +0300
@@ -22,6 +22,7 @@
 #include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/init.h> /* For __init, __exit */
+#include <linux/dma-mapping.h>
 
 #include "prismcompat.h"
 #include "islpci_dev.h"
@@ -124,7 +125,7 @@ prism54_probe(struct pci_dev *pdev, cons
 	}
 
 	/* enable PCI DMA */
-	if (pci_set_dma_mask(pdev, 0xffffffff)) {
+	if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
 		printk(KERN_ERR "%s: 32-bit PCI DMA not supported", DRV_NAME);
 		goto do_pci_disable_device;
         }
Index: linux-kj/include/linux/dma-mapping.h
===================================================================
--- linux-kj.orig/include/linux/dma-mapping.h	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/include/linux/dma-mapping.h	2006-01-18 16:47:11.000000000 +0300
@@ -20,6 +20,8 @@ enum dma_data_direction {
 #define DMA_31BIT_MASK	0x000000007fffffffULL
 #define DMA_30BIT_MASK	0x000000003fffffffULL
 #define DMA_29BIT_MASK	0x000000001fffffffULL
+#define DMA_28BIT_MASK 0x000000000fffffffULL
+#define DMA_24BIT_MASK 0x0000000000ffffffULL
 
 #include <asm/dma-mapping.h>
 
Index: linux-kj/sound/oss/esssolo1.c
===================================================================
--- linux-kj.orig/sound/oss/esssolo1.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/oss/esssolo1.c	2006-01-18 16:47:11.000000000 +0300
@@ -2346,7 +2346,7 @@ static int __devinit solo1_probe(struct 
 	/* Recording requires 24-bit DMA, so attempt to set dma mask
 	 * to 24 bits first, then 32 bits (playback only) if that fails.
 	 */
-	if (pci_set_dma_mask(pcidev, 0x00ffffff) &&
+	if (pci_set_dma_mask(pcidev, DMA_24BIT_MASK) &&
 	    pci_set_dma_mask(pcidev, DMA_32BIT_MASK)) {
 		printk(KERN_WARNING "solo1: architecture does not support 24bit or 32bit PCI busmaster DMA\n");
 		return -ENODEV;
Index: linux-kj/sound/oss/sonicvibes.c
===================================================================
--- linux-kj.orig/sound/oss/sonicvibes.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/oss/sonicvibes.c	2006-01-18 16:47:11.000000000 +0300
@@ -116,6 +116,7 @@
 #include <linux/spinlock.h>
 #include <linux/smp_lock.h>
 #include <linux/gameport.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -2551,7 +2552,7 @@ static int __devinit sv_probe(struct pci
 		return -ENODEV;
 	if (pcidev->irq == 0)
 		return -ENODEV;
-	if (pci_set_dma_mask(pcidev, 0x00ffffff)) {
+	if (pci_set_dma_mask(pcidev, DMA_24BIT_MASK)) {
 		printk(KERN_WARNING "sonicvibes: architecture does not support 24bit PCI busmaster DMA\n");
 		return -ENODEV;
 	}
Index: linux-kj/sound/pci/ad1889.c
===================================================================
--- linux-kj.orig/sound/pci/ad1889.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/ad1889.c	2006-01-18 16:47:11.000000000 +0300
@@ -38,6 +38,7 @@
 #include <linux/interrupt.h>
 #include <linux/compiler.h>
 #include <linux/delay.h>
+#include <linux/dma-mapping.h>
 
 #include <sound/driver.h>
 #include <sound/core.h>
@@ -911,8 +912,8 @@ snd_ad1889_create(struct snd_card *card,
 		return err;
 	
 	/* check PCI availability (32bit DMA) */
-	if (pci_set_dma_mask(pci, 0xffffffff) < 0 ||
-	    pci_set_consistent_dma_mask(pci, 0xffffffff) < 0) {
+	if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0 ||
+	    pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) < 0) {
 		printk(KERN_ERR PFX "error setting 32-bit DMA mask.\n");
 		pci_disable_device(pci);
 		return -ENXIO;
Index: linux-kj/sound/pci/ali5451/ali5451.c
===================================================================
--- linux-kj.orig/sound/pci/ali5451/ali5451.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/ali5451/ali5451.c	2006-01-18 16:47:11.000000000 +0300
@@ -33,6 +33,7 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/info.h>
@@ -2220,8 +2221,8 @@ static int __devinit snd_ali_create(stru
 	if ((err = pci_enable_device(pci)) < 0)
 		return err;
 	/* check, if we can restrict PCI DMA transfers to 31 bits */
-	if (pci_set_dma_mask(pci, 0x7fffffff) < 0 ||
-	    pci_set_consistent_dma_mask(pci, 0x7fffffff) < 0) {
+	if (pci_set_dma_mask(pci, DMA_31BIT_MASK) < 0 ||
+	    pci_set_consistent_dma_mask(pci, DMA_31BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "architecture does not support 31bit PCI busmaster DMA\n");
 		pci_disable_device(pci);
 		return -ENXIO;
Index: linux-kj/sound/pci/als4000.c
===================================================================
--- linux-kj.orig/sound/pci/als4000.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/als4000.c	2006-01-18 16:47:11.000000000 +0300
@@ -70,6 +70,7 @@
 #include <linux/slab.h>
 #include <linux/gameport.h>
 #include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/rawmidi.h>
@@ -688,8 +689,8 @@ static int __devinit snd_card_als4000_pr
 		return err;
 	}
 	/* check, if we can restrict PCI DMA transfers to 24 bits */
-	if (pci_set_dma_mask(pci, 0x00ffffff) < 0 ||
-	    pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) {
+	if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
+	    pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
 		pci_disable_device(pci);
 		return -ENXIO;
Index: linux-kj/sound/pci/azt3328.c
===================================================================
--- linux-kj.orig/sound/pci/azt3328.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/azt3328.c	2006-01-18 16:47:11.000000000 +0300
@@ -104,6 +104,7 @@
 #include <linux/slab.h>
 #include <linux/gameport.h>
 #include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -1669,8 +1670,8 @@ snd_azf3328_create(struct snd_card *card
 	chip->irq = -1;
 
 	/* check if we can restrict PCI DMA transfers to 24 bits */
-	if (pci_set_dma_mask(pci, 0x00ffffff) < 0 ||
-	    pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) {
+	if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
+	    pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
 		err = -ENXIO;
 		goto out_err;
Index: linux-kj/sound/pci/emu10k1/emu10k1x.c
===================================================================
--- linux-kj.orig/sound/pci/emu10k1/emu10k1x.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/emu10k1/emu10k1x.c	2006-01-18 16:47:11.000000000 +0300
@@ -35,6 +35,7 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>
 #include <sound/core.h>
 #include <sound/initval.h>
 #include <sound/pcm.h>
@@ -898,8 +899,8 @@ static int __devinit snd_emu10k1x_create
   
 	if ((err = pci_enable_device(pci)) < 0)
 		return err;
-	if (pci_set_dma_mask(pci, 0x0fffffff) < 0 ||
-	    pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) {
+	if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 ||
+	    pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "error to set 28bit mask DMA\n");
 		pci_disable_device(pci);
 		return -ENXIO;
Index: linux-kj/sound/pci/es1938.c
===================================================================
--- linux-kj.orig/sound/pci/es1938.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/es1938.c	2006-01-18 16:47:11.000000000 +0300
@@ -55,6 +55,7 @@
 #include <linux/gameport.h>
 #include <linux/moduleparam.h>
 #include <linux/delay.h>
+#include <linux/dma-mapping.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -1517,8 +1518,8 @@ static int __devinit snd_es1938_create(s
 	if ((err = pci_enable_device(pci)) < 0)
 		return err;
         /* check, if we can restrict PCI DMA transfers to 24 bits */
-	if (pci_set_dma_mask(pci, 0x00ffffff) < 0 ||
-	    pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) {
+	if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
+	    pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
 		pci_disable_device(pci);
                 return -ENXIO;
Index: linux-kj/sound/pci/es1968.c
===================================================================
--- linux-kj.orig/sound/pci/es1968.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/es1968.c	2006-01-18 16:47:11.000000000 +0300
@@ -103,6 +103,7 @@
 #include <linux/slab.h>
 #include <linux/gameport.h>
 #include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/mpu401.h>
@@ -2559,8 +2560,8 @@ static int __devinit snd_es1968_create(s
 	if ((err = pci_enable_device(pci)) < 0)
 		return err;
 	/* check, if we can restrict PCI DMA transfers to 28 bits */
-	if (pci_set_dma_mask(pci, 0x0fffffff) < 0 ||
-	    pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) {
+	if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 ||
+	    pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n");
 		pci_disable_device(pci);
 		return -ENXIO;
Index: linux-kj/sound/pci/ice1712/ice1712.c
===================================================================
--- linux-kj.orig/sound/pci/ice1712/ice1712.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/ice1712/ice1712.c	2006-01-18 16:47:11.000000000 +0300
@@ -55,6 +55,7 @@
 #include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>
 #include <sound/core.h>
 #include <sound/cs8427.h>
 #include <sound/info.h>
@@ -2538,8 +2539,8 @@ static int __devinit snd_ice1712_create(
 	if ((err = pci_enable_device(pci)) < 0)
 		return err;
 	/* check, if we can restrict PCI DMA transfers to 28 bits */
-	if (pci_set_dma_mask(pci, 0x0fffffff) < 0 ||
-	    pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) {
+	if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 ||
+	    pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n");
 		pci_disable_device(pci);
 		return -ENXIO;
Index: linux-kj/sound/pci/maestro3.c
===================================================================
--- linux-kj.orig/sound/pci/maestro3.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/maestro3.c	2006-01-18 16:47:11.000000000 +0300
@@ -40,6 +40,7 @@
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>
 #include <sound/core.h>
 #include <sound/info.h>
 #include <sound/control.h>
@@ -2657,8 +2658,8 @@ snd_m3_create(struct snd_card *card, str
 		return -EIO;
 
 	/* check, if we can restrict PCI DMA transfers to 28 bits */
-	if (pci_set_dma_mask(pci, 0x0fffffff) < 0 ||
-	    pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) {
+	if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 ||
+	    pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n");
 		pci_disable_device(pci);
 		return -ENXIO;
Index: linux-kj/sound/pci/mixart/mixart.c
===================================================================
--- linux-kj.orig/sound/pci/mixart/mixart.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/mixart/mixart.c	2006-01-18 16:47:11.000000000 +0300
@@ -26,6 +26,7 @@
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>
 #include <sound/core.h>
 #include <sound/initval.h>
 #include <sound/info.h>
@@ -1288,7 +1289,7 @@ static int __devinit snd_mixart_probe(st
 	pci_set_master(pci);
 
 	/* check if we can restrict PCI DMA transfers to 32 bits */
-	if (pci_set_dma_mask(pci, 0xffffffff) < 0) {
+	if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "architecture does not support 32bit PCI busmaster DMA\n");
 		pci_disable_device(pci);
 		return -ENXIO;
Index: linux-kj/sound/pci/pcxhr/pcxhr.c
===================================================================
--- linux-kj.orig/sound/pci/pcxhr/pcxhr.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/pcxhr/pcxhr.c	2006-01-18 16:47:12.000000000 +0300
@@ -28,6 +28,7 @@
 #include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>
 #include <sound/core.h>
 #include <sound/initval.h>
 #include <sound/info.h>
@@ -1214,7 +1215,7 @@ static int __devinit pcxhr_probe(struct 
 	pci_set_master(pci);
 
 	/* check if we can restrict PCI DMA transfers to 32 bits */
-	if (pci_set_dma_mask(pci, 0xffffffff) < 0) {
+	if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "architecture does not support 32bit PCI busmaster DMA\n");
 		pci_disable_device(pci);
 		return -ENXIO;
Index: linux-kj/sound/pci/sonicvibes.c
===================================================================
--- linux-kj.orig/sound/pci/sonicvibes.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/sonicvibes.c	2006-01-18 16:47:12.000000000 +0300
@@ -30,6 +30,7 @@
 #include <linux/slab.h>
 #include <linux/gameport.h>
 #include <linux/moduleparam.h>
+#include <linux/dma-mapping.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -1227,8 +1228,8 @@ static int __devinit snd_sonicvibes_crea
 	if ((err = pci_enable_device(pci)) < 0)
 		return err;
 	/* check, if we can restrict PCI DMA transfers to 24 bits */
-        if (pci_set_dma_mask(pci, 0x00ffffff) < 0 ||
-	    pci_set_consistent_dma_mask(pci, 0x00ffffff) < 0) {
+        if (pci_set_dma_mask(pci, DMA_24BIT_MASK) < 0 ||
+	    pci_set_consistent_dma_mask(pci, DMA_24BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n");
 		pci_disable_device(pci);
                 return -ENXIO;
Index: linux-kj/sound/pci/trident/trident_main.c
===================================================================
--- linux-kj.orig/sound/pci/trident/trident_main.c	2006-01-18 02:21:13.000000000 +0300
+++ linux-kj/sound/pci/trident/trident_main.c	2006-01-18 16:47:12.000000000 +0300
@@ -35,6 +35,7 @@
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/gameport.h>
+#include <linux/dma-mapping.h>
 
 #include <sound/core.h>
 #include <sound/info.h>
@@ -3554,8 +3555,8 @@ int __devinit snd_trident_create(struct 
 	if ((err = pci_enable_device(pci)) < 0)
 		return err;
 	/* check, if we can restrict PCI DMA transfers to 30 bits */
-	if (pci_set_dma_mask(pci, 0x3fffffff) < 0 ||
-	    pci_set_consistent_dma_mask(pci, 0x3fffffff) < 0) {
+	if (pci_set_dma_mask(pci, DMA_30BIT_MASK) < 0 ||
+	    pci_set_consistent_dma_mask(pci, DMA_30BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "architecture does not support 30bit PCI busmaster DMA\n");
 		pci_disable_device(pci);
 		return -ENXIO;
