netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [KJ] [PATCH] Use pci_set_dma_mask() instead of direct assignment of DMA mask
@ 2005-05-16 17:15 Tobias Klauser
  0 siblings, 0 replies; only message in thread
From: Tobias Klauser @ 2005-05-16 17:15 UTC (permalink / raw)
  To: kernel-janitors; +Cc: akpm, netdev, jgarzik

[-- Attachment #1: Type: text/plain, Size: 1253 bytes --]

The amd8111e driver directly assigns the DMA mask to the dma_mask
member of the struct pci_dev instead of using pci_set_dma_mask(). This
makes the call to pci_dma_supported() redundant as pci_set_dma_mask()
does this check.

I do not own this device so I only compile-tested this patch.

Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>

diff -urpN -X dontdiff linux-2.6.12-rc4/drivers/net/amd8111e.c linux-2.6.12-rc4~dma_mask/drivers/net/amd8111e.c
--- linux-2.6.12-rc4/drivers/net/amd8111e.c	2005-05-07 21:53:51.000000000 +0200
+++ linux-2.6.12-rc4~dma_mask/drivers/net/amd8111e.c	2005-05-16 19:11:30.349802984 +0200
@@ -87,6 +87,7 @@ Revision History:
 #include <linux/if_vlan.h>
 #include <linux/ctype.h>	
 #include <linux/crc32.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -2002,12 +2003,11 @@ static int __devinit amd8111e_probe_one(
 	}
 
 	/* Initialize DMA */
-	if(!pci_dma_supported(pdev, 0xffffffff)){
+	if (pci_set_dma_mask(pdev, DMA_32BIT_MASK) < 0) {
 		printk(KERN_ERR "amd8111e: DMA not supported,"
 			"exiting.\n");
-		goto  err_free_reg;
-	} else
-		pdev->dma_mask = 0xffffffff;
+		goto err_free_reg;
+	}
 	
 	reg_addr = pci_resource_start(pdev, 0);
 	reg_len = pci_resource_len(pdev, 0);

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-05-16 17:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-16 17:15 [KJ] [PATCH] Use pci_set_dma_mask() instead of direct assignment of DMA mask Tobias Klauser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).