]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] skge: fix dma mask setup.
authorStephen Hemminger <shemminger@osdl.org>
Fri, 6 Jan 2006 00:26:05 +0000 (16:26 -0800)
committerJeff Garzik <jgarzik@pobox.com>
Wed, 18 Jan 2006 00:52:56 +0000 (19:52 -0500)
There are a couple of problems in the DMA setup code for skge.
* In the 64 bit case, it doesn't set the consistent mask.
* In the 32 bit case, the error check is backwards!
It likely will only be visible as a bug on 64 bit platforms.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
drivers/net/skge.c

index b538e3038058a7afe022a83fbadf9876dac0ffbb..bf55a4cfb3d25e6a8c401f7518b98bb5e9b74f56 100644 (file)
@@ -3243,12 +3243,22 @@ static int __devinit skge_probe(struct pci_dev *pdev,
 
        pci_set_master(pdev);
 
-       if (!(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK)))
+       if (sizeof(dma_addr_t) > sizeof(u32) &&
+           !(err = pci_set_dma_mask(pdev, DMA_64BIT_MASK))) {
                using_dac = 1;
-       else if (!(err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
-               printk(KERN_ERR PFX "%s no usable DMA configuration\n",
-                      pci_name(pdev));
-               goto err_out_free_regions;
+               err = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);
+               if (err < 0) {
+                       printk(KERN_ERR PFX "%s unable to obtain 64 bit DMA "
+                              "for consistent allocations\n", pci_name(pdev));
+                       goto err_out_free_regions;
+               }
+       } else {
+               err = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
+               if (err) {
+                       printk(KERN_ERR PFX "%s no usable DMA configuration\n",
+                              pci_name(pdev));
+                       goto err_out_free_regions;
+               }
        }
 
 #ifdef __BIG_ENDIAN