Skip to contentSkip to conversation

drivers/block/umem.c: Use the DMA_{64, 32}BIT_MASK constants

PATCH In review [email protected] 4 participants 4 messages Jun 21, 2005 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 11/12 drivers/block/umem.c: Use the DMA_{64, 32}BIT_MASK constants

From: Tobias Klauser <[email protected]>

Use the DMA_{64,32}BIT_MASK constants from dma-mapping.h when calling pci_set_dma_mask() or pci_set_consistent_dma_mask()
These patches include 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

---
 umem.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/block/umem.c +3 -2
Index: quilt/drivers/block/umem.c
===================================================================
@@ -50,6 +50,7 @@
 #include <linux/timer.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/dma-mapping.h>
 
 #include <linux/fcntl.h>        /* O_ACCMODE */
 #include <linux/hdreg.h>  /* HDIO_GETGEO */
@@ -892,8 +893,8 @@ static int __devinit mm_pci_probe(struct
 	printk(KERN_INFO "Micro Memory(tm) controller #%d found at %02x:%02x (PCI Mem Module (Battery Backup))\n",
 	       card->card_number, dev->bus->number, dev->devfn);
 
-	if (pci_set_dma_mask(dev, 0xffffffffffffffffLL) &&
-	    !pci_set_dma_mask(dev, 0xffffffffLL)) {
+	if (pci_set_dma_mask(dev, DMA_64BIT_MASK) &&
+	    !pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
 		printk(KERN_WARNING "MM%d: NO suitable DMA found\n",num_cards);
 		return  -ENOMEM;
 	}

--

#1 lore raw
Quoted 29 lines · On Mon, Jun 20 2005, [email protected] wrote:

From: Tobias Klauser <[email protected]>

Use the DMA_{64,32}BIT_MASK constants from dma-mapping.h when calling pci_set_dma_mask() or pci_set_consistent_dma_mask()
These patches include 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

---
 umem.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Index: quilt/drivers/block/umem.c
===================================================================

drivers/block/umem.c +1 -0
@@ -50,6 +50,7 @@
 #include <linux/timer.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/dma-mapping.h>
 
 #include <linux/fcntl.h>        /* O_ACCMODE */
 #include <linux/hdreg.h>  /* HDIO_GETGEO */

drivers/block/umem.c static int __devinit mm_pci_probe(struct · line 900

Quoted 10 lines
drivers/block/umem.c +2 -2
@@ -892,8 +893,8 @@ static int __devinit mm_pci_probe(struct
 	printk(KERN_INFO "Micro Memory(tm) controller #%d found at %02x:%02x (PCI Mem Module (Battery Backup))\n",
 	       card->card_number, dev->bus->number, dev->devfn);
 
-	if (pci_set_dma_mask(dev, 0xffffffffffffffffLL) &&
-	    !pci_set_dma_mask(dev, 0xffffffffLL)) {
+	if (pci_set_dma_mask(dev, DMA_64BIT_MASK) &&
+	    !pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
 		printk(KERN_WARNING "MM%d: NO suitable DMA found\n",num_cards);
 		return  -ENOMEM;
 	}

Not from your patch, but that code looks a little strange. We error if setting a 64-bit mask fails _but_ the 32-bit one succeeds? That can't be right.

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 33 lines · On Tuesday June 21, [email protected] wrote:
Quoted 32 lines · On Mon, Jun 20 2005, [email protected] wrote:

From: Tobias Klauser <[email protected]>

Use the DMA_{64,32}BIT_MASK constants from dma-mapping.h when calling pci_set_dma_mask() or pci_set_consistent_dma_mask()
These patches include 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

---
 umem.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Index: quilt/drivers/block/umem.c
===================================================================

drivers/block/umem.c +1 -0
@@ -50,6 +50,7 @@
 #include <linux/timer.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/dma-mapping.h>
 
 #include <linux/fcntl.h>        /* O_ACCMODE */
 #include <linux/hdreg.h>  /* HDIO_GETGEO */
@@ -892,8 +893,8 @@ static int __devinit mm_pci_probe(struct
 	printk(KERN_INFO "Micro Memory(tm) controller #%d found at %02x:%02x (PCI Mem Module (Battery Backup))\n",
 	       card->card_number, dev->bus->number, dev->devfn);
 
Quoted 11 lines

drivers/block/umem.c static int __devinit mm_pci_probe(struct · line 900

Quoted 7 lines
drivers/block/umem.c +2 -2
-	if (pci_set_dma_mask(dev, 0xffffffffffffffffLL) &&
-	    !pci_set_dma_mask(dev, 0xffffffffLL)) {
+	if (pci_set_dma_mask(dev, DMA_64BIT_MASK) &&
+	    !pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
 		printk(KERN_WARNING "MM%d: NO suitable DMA found\n",num_cards);
 		return  -ENOMEM;
 	}

Not from your patch, but that code looks a little strange. We error if setting a 64-bit mask fails _but_ the 32-bit one succeeds? That can't be right.

No, it can't be, can it.... I remember looking at that code in late 2001 (I think) and thought I could make sense of it, but I'm not so sure now.

Phap: (if you are still at umem.com) do you remember the rationale behind this??
If not, we should probably just remove that '!'...

Thanks Jens,

NeilBrown

#3 lore raw
In reply to Jens Axboe
Quoted 33 lines · Jens Axboe
Quoted 32 lines · On Mon, Jun 20 2005, [email protected] wrote:

From: Tobias Klauser <[email protected]>

Use the DMA_{64,32}BIT_MASK constants from dma-mapping.h when calling pci_set_dma_mask() or pci_set_consistent_dma_mask()
These patches include 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

---
 umem.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Index: quilt/drivers/block/umem.c
===================================================================

drivers/block/umem.c +1 -0
@@ -50,6 +50,7 @@
 #include <linux/timer.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/dma-mapping.h>
 
 #include <linux/fcntl.h>        /* O_ACCMODE */
 #include <linux/hdreg.h>  /* HDIO_GETGEO */
@@ -892,8 +893,8 @@ static int __devinit mm_pci_probe(struct
 	printk(KERN_INFO "Micro Memory(tm) controller #%d found at %02x:%02x (PCI Mem Module (Battery Backup))\n",
 	       card->card_number, dev->bus->number, dev->devfn);
 
Quoted 11 lines

drivers/block/umem.c static int __devinit mm_pci_probe(struct · line 900

Quoted 7 lines
drivers/block/umem.c +2 -2
-	if (pci_set_dma_mask(dev, 0xffffffffffffffffLL) &&
-	    !pci_set_dma_mask(dev, 0xffffffffLL)) {
+	if (pci_set_dma_mask(dev, DMA_64BIT_MASK) &&
+	    !pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
 		printk(KERN_WARNING "MM%d: NO suitable DMA found\n",num_cards);
 		return  -ENOMEM;
 	}

Not from your patch, but that code looks a little strange. We error if setting a 64-bit mask fails _but_ the 32-bit one succeeds? That can't be right.

Oh yes. I remember Alexey Dobriyan bringing this up some time ago on the kernel-janitor list:
http://lists.osdl.org/mailman/htdig/kernel-janitors/2005-May/004063.html

Thanks, Tobias