Skip to contentSkip to conversation

drivers/block/cciss : Use the DMA_{32|64}_MASK constant

PATCH In review Christophe Lucas 2 participants 5 messages Apr 1, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/block/cciss : Use the DMA_{32|64}_MASK constant

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

drivers/block/cciss.c +4 -9
diff -urpN -X dontdiff a/drivers/block/cciss.c b/drivers/block/cciss.c
@@ -38,6 +38,7 @@
 #include <linux/hdreg.h>
 #include <linux/spinlock.h>
 #include <linux/compat.h>
+#include <linux/dma-mapping.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
@@ -125,9 +126,6 @@ static struct board_type products[] = {
 /* Originally cciss driver only supports 8 major numbers */
 #define MAX_CTLR_ORIG 	8
 
-
-#define CCISS_DMA_MASK	0xFFFFFFFF	/* 32 bit DMA */
-
 static ctlr_info_t *hba[MAX_CTLR];
 
 static void do_cciss_request(request_queue_t *q);
@@ -1542,9 +1540,6 @@ static int register_new_disk(ctlr_info_t
 
 	if( return_code == IO_OK)
 	{
-		
-		// printk("LUN Data\n--------------------------\n");
-
 		listlength |= (0xff & (unsigned int)(ld_buff->LUNListLength[0])) << 24;
 		listlength |= (0xff & (unsigned int)(ld_buff->LUNListLength[1])) << 16;
 		listlength |= (0xff & (unsigned int)(ld_buff->LUNListLength[2])) << 8;	
@@ -2393,7 +2388,7 @@ static int cciss_pci_init(ctlr_info_t *c
 		printk(KERN_ERR "cciss: Unable to Enable PCI device\n");
 		return( -1);
 	}
-	if (pci_set_dma_mask(pdev, CCISS_DMA_MASK ) != 0)
+	if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0)
 	{
 		printk(KERN_ERR "cciss:  Unable to set DMA mask\n");
 		return(-1);
@@ -2747,9 +2742,9 @@ static int __devinit cciss_init_one(stru
 	hba[i]->pdev = pdev;
 
 	/* configure PCI DMA stuff */
-	if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL))
+	if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK))
 		printk("cciss: using DAC cycles\n");
-	else if (!pci_set_dma_mask(pdev, 0xffffffff))
+	else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK))
 		printk("cciss: not using DAC cycles\n");
 	else {
 		printk("cciss: no suitable DMA available\n");

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

Re: [KJ] [PATCH] drivers/block/cciss : Use the DMA_{32|64}_MASK

On Fri, Apr 01, 2005 at 10:39:34AM +0200, Christophe Lucas wrote:

[...]

drivers/block/cciss.c static int __devinit cciss_init_one(stru · line 2745

Quoted 3 lines
drivers/block/cciss.c +1 -1
 	/* configure PCI DMA stuff */
-	if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL))
+	if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK))

This one is already covered by one of my patches.

drivers/block/cciss.c static int __devinit cciss_init_one(stru · line 2747

Quoted 3 lines
drivers/block/cciss.c +1 -1
 		printk("cciss: using DAC cycles\n");
-	else if (!pci_set_dma_mask(pdev, 0xffffffff))
+	else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK))

Ditto

drivers/block/cciss.c static int __devinit cciss_init_one(stru · line 2750

Quoted 3 lines
drivers/block/cciss.c +0 -0
 		printk("cciss: not using DAC cycles\n");
 	else {
 		printk("cciss: no suitable DMA available\n");

Cheers, Tobias

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#2 lore raw

Re: [KJ] [PATCH] drivers/block/cciss : Use the DMA_{32|64}_MASK

In reply to Christophe Lucas
Quoted 16 lines · Tobias Klauser

On Fri, Apr 01, 2005 at 10:39:34AM +0200, Christophe Lucas wrote:

[...]

drivers/block/cciss.c static int __devinit cciss_init_one(stru · line 2745

Quoted 3 lines
drivers/block/cciss.c +1 -1
 	/* configure PCI DMA stuff */
-	if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL))
+	if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK))

This one is already covered by one of my patches.

drivers/block/cciss.c static int __devinit cciss_init_one(stru · line 2747

Quoted 3 lines
drivers/block/cciss.c +1 -1
 		printk("cciss: using DAC cycles\n");
-	else if (!pci_set_dma_mask(pdev, 0xffffffff))
+	else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK))

Ditto

Quoted 5 lines

drivers/block/cciss.c static int __devinit cciss_init_one(stru · line 2750

Quoted 3 lines
drivers/block/cciss.c +0 -0
 		printk("cciss: not using DAC cycles\n");
 	else {
 		printk("cciss: no suitable DMA available\n");

Cheers, Tobias

Sorry, I have surely searched so quickly ;)

Have a nice day,

~Christophe

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#3 lore raw

Re: [KJ] [PATCH] drivers/block/cciss : Use the DMA_{32|64}_MASK

In reply to Christophe Lucas
Quoted 16 lines · Tobias Klauser

On Fri, Apr 01, 2005 at 10:39:34AM +0200, Christophe Lucas wrote:

[...]

drivers/block/cciss.c static int __devinit cciss_init_one(stru · line 2745

Quoted 3 lines
drivers/block/cciss.c +1 -1
 	/* configure PCI DMA stuff */
-	if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL))
+	if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK))

This one is already covered by one of my patches.

drivers/block/cciss.c static int __devinit cciss_init_one(stru · line 2747

Quoted 3 lines
drivers/block/cciss.c +1 -1
 		printk("cciss: using DAC cycles\n");
-	else if (!pci_set_dma_mask(pdev, 0xffffffff))
+	else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK))

Ditto

Quoted 5 lines

drivers/block/cciss.c static int __devinit cciss_init_one(stru · line 2750

Quoted 3 lines
drivers/block/cciss.c +0 -0
 		printk("cciss: not using DAC cycles\n");
 	else {
 		printk("cciss: no suitable DMA available\n");

Cheers, Tobias

Perhaps, could you update your patch about block/cciss.c to include the first part of the previous patch ?

~Christophe

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors

#4 lore raw

PATCH 1/1 drivers/block/cciss : Use the DMA_{32,

In reply to Christophe Lucas
Quoted 2 lines · Christophe Lucas

Perhaps, could you update your patch about block/cciss.c to include the first part of the previous patch ?

Sure, Here it is. Christophe, you may want to add your "Signed-off-by" line too.

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

drivers/block/cciss.c +4 -5
diff -urpN linux-2.6.11.orig/drivers/block/cciss.c linux-2.6.11/drivers/block/cciss.c
@@ -38,6 +38,7 @@
 #include <linux/hdreg.h>
 #include <linux/spinlock.h>
 #include <linux/compat.h>
+#include <linux/dma-mapping.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
@@ -116,8 +117,6 @@ static struct board_type products[] = {
 #define NR_CMDS		 384 /* #commands that can be outstanding */
 #define MAX_CTLR 8
 
-#define CCISS_DMA_MASK	0xFFFFFFFF	/* 32 bit DMA */
-
 static ctlr_info_t *hba[MAX_CTLR];
 
 static void do_cciss_request(request_queue_t *q);
@@ -2339,7 +2338,7 @@ static int cciss_pci_init(ctlr_info_t *c
 		printk(KERN_ERR "cciss: Unable to Enable PCI device\n");
 		return( -1);
 	}
-	if (pci_set_dma_mask(pdev, CCISS_DMA_MASK ) != 0)
+	if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) != 0)
 	{
 		printk(KERN_ERR "cciss:  Unable to set DMA mask\n");
 		return(-1);
@@ -2692,9 +2691,9 @@ static int __devinit cciss_init_one(stru
 	hba[i]->pdev = pdev;
 
 	/* configure PCI DMA stuff */
-	if (!pci_set_dma_mask(pdev, 0xffffffffffffffffULL))
+	if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK))
 		printk("cciss: using DAC cycles\n");
-	else if (!pci_set_dma_mask(pdev, 0xffffffff))
+	else if (!pci_set_dma_mask(pdev, DMA_32BIT_MASK))
 		printk("cciss: not using DAC cycles\n");
 	else {
 		printk("cciss: no suitable DMA available\n");

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors