diff options
author | Tobias Klauser <tklauser@nuerscht.ch> | 2006-04-11 01:54:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-11 09:18:44 -0400 |
commit | 56b146d36db933844011d5026c6f55593037c7b8 (patch) | |
tree | e8b9bed7bf22f658f9b62bf13e512bf08f137efc | |
parent | 31cc48bfeef7a021d6e29f3454a4505edcfd6daa (diff) |
[PATCH] Last DMA_xBIT_MASK cleanups
These are the last conversions of pci_set_dma_mask(),
pci_set_consistent_dma_mask() and pci_dma_supported() to use DMA_xBIT_MASK
constants from linux/dma-mapping.h
Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | Documentation/DMA-mapping.txt | 4 | ||||
-rw-r--r-- | Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | 16 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-core.c | 3 | ||||
-rw-r--r-- | drivers/sn/ioc3.c | 5 | ||||
-rw-r--r-- | include/linux/dma-mapping.h | 2 | ||||
-rw-r--r-- | sound/oss/emu10k1/main.c | 3 | ||||
-rw-r--r-- | sound/pci/als300.c | 5 |
7 files changed, 21 insertions, 17 deletions
diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt index ee4bb73683cd..10bf4deb96aa 100644 --- a/Documentation/DMA-mapping.txt +++ b/Documentation/DMA-mapping.txt | |||
@@ -194,7 +194,7 @@ document for how to handle this case. | |||
194 | Finally, if your device can only drive the low 24-bits of | 194 | Finally, if your device can only drive the low 24-bits of |
195 | address during PCI bus mastering you might do something like: | 195 | address during PCI bus mastering you might do something like: |
196 | 196 | ||
197 | if (pci_set_dma_mask(pdev, 0x00ffffff)) { | 197 | if (pci_set_dma_mask(pdev, DMA_24BIT_MASK)) { |
198 | printk(KERN_WARNING | 198 | printk(KERN_WARNING |
199 | "mydev: 24-bit DMA addressing not available.\n"); | 199 | "mydev: 24-bit DMA addressing not available.\n"); |
200 | goto ignore_this_device; | 200 | goto ignore_this_device; |
@@ -212,7 +212,7 @@ functions (for example a sound card provides playback and record | |||
212 | functions) and the various different functions have _different_ | 212 | functions) and the various different functions have _different_ |
213 | DMA addressing limitations, you may wish to probe each mask and | 213 | DMA addressing limitations, you may wish to probe each mask and |
214 | only provide the functionality which the machine can handle. It | 214 | only provide the functionality which the machine can handle. It |
215 | is important that the last call to pci_set_dma_mask() be for the | 215 | is important that the last call to pci_set_dma_mask() be for the |
216 | most specific mask. | 216 | most specific mask. |
217 | 217 | ||
218 | Here is pseudo-code showing how this might be done: | 218 | Here is pseudo-code showing how this might be done: |
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index 6feef9e82b63..68eeebc17ff4 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -1123,8 +1123,8 @@ | |||
1123 | if ((err = pci_enable_device(pci)) < 0) | 1123 | if ((err = pci_enable_device(pci)) < 0) |
1124 | return err; | 1124 | return err; |
1125 | /* check PCI availability (28bit DMA) */ | 1125 | /* check PCI availability (28bit DMA) */ |
1126 | if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || | 1126 | if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || |
1127 | pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { | 1127 | pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) { |
1128 | printk(KERN_ERR "error to set 28bit mask DMA\n"); | 1128 | printk(KERN_ERR "error to set 28bit mask DMA\n"); |
1129 | pci_disable_device(pci); | 1129 | pci_disable_device(pci); |
1130 | return -ENXIO; | 1130 | return -ENXIO; |
@@ -1216,7 +1216,7 @@ | |||
1216 | The allocation of PCI resources is done in the | 1216 | The allocation of PCI resources is done in the |
1217 | <function>probe()</function> function, and usually an extra | 1217 | <function>probe()</function> function, and usually an extra |
1218 | <function>xxx_create()</function> function is written for this | 1218 | <function>xxx_create()</function> function is written for this |
1219 | purpose. | 1219 | purpose. |
1220 | </para> | 1220 | </para> |
1221 | 1221 | ||
1222 | <para> | 1222 | <para> |
@@ -1225,7 +1225,7 @@ | |||
1225 | allocating resources. Also, you need to set the proper PCI DMA | 1225 | allocating resources. Also, you need to set the proper PCI DMA |
1226 | mask to limit the accessed i/o range. In some cases, you might | 1226 | mask to limit the accessed i/o range. In some cases, you might |
1227 | need to call <function>pci_set_master()</function> function, | 1227 | need to call <function>pci_set_master()</function> function, |
1228 | too. | 1228 | too. |
1229 | </para> | 1229 | </para> |
1230 | 1230 | ||
1231 | <para> | 1231 | <para> |
@@ -1236,8 +1236,8 @@ | |||
1236 | <![CDATA[ | 1236 | <![CDATA[ |
1237 | if ((err = pci_enable_device(pci)) < 0) | 1237 | if ((err = pci_enable_device(pci)) < 0) |
1238 | return err; | 1238 | return err; |
1239 | if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || | 1239 | if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || |
1240 | pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { | 1240 | pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) { |
1241 | printk(KERN_ERR "error to set 28bit mask DMA\n"); | 1241 | printk(KERN_ERR "error to set 28bit mask DMA\n"); |
1242 | pci_disable_device(pci); | 1242 | pci_disable_device(pci); |
1243 | return -ENXIO; | 1243 | return -ENXIO; |
@@ -1256,13 +1256,13 @@ | |||
1256 | functions. Unlike ALSA ver.0.5.x., there are no helpers for | 1256 | functions. Unlike ALSA ver.0.5.x., there are no helpers for |
1257 | that. And these resources must be released in the destructor | 1257 | that. And these resources must be released in the destructor |
1258 | function (see below). Also, on ALSA 0.9.x, you don't need to | 1258 | function (see below). Also, on ALSA 0.9.x, you don't need to |
1259 | allocate (pseudo-)DMA for PCI like ALSA 0.5.x. | 1259 | allocate (pseudo-)DMA for PCI like ALSA 0.5.x. |
1260 | </para> | 1260 | </para> |
1261 | 1261 | ||
1262 | <para> | 1262 | <para> |
1263 | Now assume that this PCI device has an I/O port with 8 bytes | 1263 | Now assume that this PCI device has an I/O port with 8 bytes |
1264 | and an interrupt. Then struct <structname>mychip</structname> will have the | 1264 | and an interrupt. Then struct <structname>mychip</structname> will have the |
1265 | following fields: | 1265 | following fields: |
1266 | 1266 | ||
1267 | <informalexample> | 1267 | <informalexample> |
1268 | <programlisting> | 1268 | <programlisting> |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index c98571c9d5a6..13de05532e0a 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/interrupt.h> | 32 | #include <linux/interrupt.h> |
33 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | #include <linux/dma-mapping.h> | ||
35 | 36 | ||
36 | #include "saa7134-reg.h" | 37 | #include "saa7134-reg.h" |
37 | #include "saa7134.h" | 38 | #include "saa7134.h" |
@@ -870,7 +871,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
870 | pci_name(pci_dev), dev->pci_rev, pci_dev->irq, | 871 | pci_name(pci_dev), dev->pci_rev, pci_dev->irq, |
871 | dev->pci_lat,pci_resource_start(pci_dev,0)); | 872 | dev->pci_lat,pci_resource_start(pci_dev,0)); |
872 | pci_set_master(pci_dev); | 873 | pci_set_master(pci_dev); |
873 | if (!pci_dma_supported(pci_dev,0xffffffff)) { | 874 | if (!pci_dma_supported(pci_dev, DMA_32BIT_MASK)) { |
874 | printk("%s: Oops: no 32bit PCI DMA ???\n",dev->name); | 875 | printk("%s: Oops: no 32bit PCI DMA ???\n",dev->name); |
875 | err = -EIO; | 876 | err = -EIO; |
876 | goto fail1; | 877 | goto fail1; |
diff --git a/drivers/sn/ioc3.c b/drivers/sn/ioc3.c index 93449a1a0065..0b49ff78efc1 100644 --- a/drivers/sn/ioc3.c +++ b/drivers/sn/ioc3.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/pci.h> | 13 | #include <linux/pci.h> |
14 | #include <linux/dma-mapping.h> | ||
14 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
15 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
16 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
@@ -619,9 +620,9 @@ static int ioc3_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) | |||
619 | pci_set_master(pdev); | 620 | pci_set_master(pdev); |
620 | 621 | ||
621 | #ifdef USE_64BIT_DMA | 622 | #ifdef USE_64BIT_DMA |
622 | ret = pci_set_dma_mask(pdev, 0xffffffffffffffffULL); | 623 | ret = pci_set_dma_mask(pdev, DMA_64BIT_MASK); |
623 | if (!ret) { | 624 | if (!ret) { |
624 | ret = pci_set_consistent_dma_mask(pdev, 0xffffffffffffffffULL); | 625 | ret = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK); |
625 | if (ret < 0) { | 626 | if (ret < 0) { |
626 | printk(KERN_WARNING "%s: Unable to obtain 64 bit DMA " | 627 | printk(KERN_WARNING "%s: Unable to obtain 64 bit DMA " |
627 | "for consistent allocations\n", | 628 | "for consistent allocations\n", |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 9b4751aecc23..ff61817082fa 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -21,7 +21,7 @@ enum dma_data_direction { | |||
21 | #define DMA_30BIT_MASK 0x000000003fffffffULL | 21 | #define DMA_30BIT_MASK 0x000000003fffffffULL |
22 | #define DMA_29BIT_MASK 0x000000001fffffffULL | 22 | #define DMA_29BIT_MASK 0x000000001fffffffULL |
23 | #define DMA_28BIT_MASK 0x000000000fffffffULL | 23 | #define DMA_28BIT_MASK 0x000000000fffffffULL |
24 | #define DMA_24BIT_MASK 0x0000000000ffffffULL | 24 | #define DMA_24BIT_MASK 0x0000000000ffffffULL |
25 | 25 | ||
26 | #include <asm/dma-mapping.h> | 26 | #include <asm/dma-mapping.h> |
27 | 27 | ||
diff --git a/sound/oss/emu10k1/main.c b/sound/oss/emu10k1/main.c index 0cd44a6f7ac0..3721c5857b90 100644 --- a/sound/oss/emu10k1/main.c +++ b/sound/oss/emu10k1/main.c | |||
@@ -94,6 +94,7 @@ | |||
94 | #include <linux/init.h> | 94 | #include <linux/init.h> |
95 | #include <linux/delay.h> | 95 | #include <linux/delay.h> |
96 | #include <linux/proc_fs.h> | 96 | #include <linux/proc_fs.h> |
97 | #include <linux/dma-mapping.h> | ||
97 | 98 | ||
98 | #include "hwaccess.h" | 99 | #include "hwaccess.h" |
99 | #include "8010.h" | 100 | #include "8010.h" |
@@ -119,7 +120,7 @@ | |||
119 | 120 | ||
120 | 121 | ||
121 | /* the emu10k1 _seems_ to only supports 29 bit (512MiB) bit bus master */ | 122 | /* the emu10k1 _seems_ to only supports 29 bit (512MiB) bit bus master */ |
122 | #define EMU10K1_DMA_MASK 0x1fffffff /* DMA buffer mask for pci_alloc_consist */ | 123 | #define EMU10K1_DMA_MASK DMA_29BIT_MASK /* DMA buffer mask for pci_alloc_consist */ |
123 | 124 | ||
124 | #ifndef PCI_VENDOR_ID_CREATIVE | 125 | #ifndef PCI_VENDOR_ID_CREATIVE |
125 | #define PCI_VENDOR_ID_CREATIVE 0x1102 | 126 | #define PCI_VENDOR_ID_CREATIVE 0x1102 |
diff --git a/sound/pci/als300.c b/sound/pci/als300.c index 37b80570a5c6..91899f87f037 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/moduleparam.h> | 36 | #include <linux/moduleparam.h> |
37 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
38 | #include <linux/dma-mapping.h> | ||
38 | #include <linux/interrupt.h> | 39 | #include <linux/interrupt.h> |
39 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
40 | 41 | ||
@@ -691,8 +692,8 @@ static int __devinit snd_als300_create(snd_card_t *card, | |||
691 | if ((err = pci_enable_device(pci)) < 0) | 692 | if ((err = pci_enable_device(pci)) < 0) |
692 | return err; | 693 | return err; |
693 | 694 | ||
694 | if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || | 695 | if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || |
695 | pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { | 696 | pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) { |
696 | printk(KERN_ERR "error setting 28bit DMA mask\n"); | 697 | printk(KERN_ERR "error setting 28bit DMA mask\n"); |
697 | pci_disable_device(pci); | 698 | pci_disable_device(pci); |
698 | return -ENXIO; | 699 | return -ENXIO; |