tile PCI DMA: fix bug in non-page-aligned accessors
authorChris Metcalf <cmetcalf@tilera.com>
Mon, 5 Aug 2013 17:45:28 +0000 (13:45 -0400)
committerChris Metcalf <cmetcalf@tilera.com>
Tue, 6 Aug 2013 16:56:04 +0000 (12:56 -0400)
The code incorrectly masked with PAGE_OFFSET instead of
PAGE_SIZE-1.  This only matters when trying to do a
non page-aligned DMA; it was noticed during code inspection.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
arch/tile/kernel/pci-dma.c

index 9fef64d70c566e9c7ac48b122036f0a6bc66d535..d94f4872e94f36c3989768ee4731d74609f7e044 100644 (file)
@@ -257,7 +257,7 @@ static void tile_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
        BUG_ON(!valid_dma_direction(direction));
 
        __dma_complete_page(pfn_to_page(PFN_DOWN(dma_address)),
-                           dma_address & PAGE_OFFSET, size, direction);
+                           dma_address & (PAGE_SIZE - 1), size, direction);
 }
 
 static void tile_dma_sync_single_for_cpu(struct device *dev,
@@ -436,7 +436,7 @@ static void tile_pci_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
        dma_address -= get_dma_offset(dev);
 
        __dma_complete_page(pfn_to_page(PFN_DOWN(dma_address)),
-                           dma_address & PAGE_OFFSET, size, direction);
+                           dma_address & (PAGE_SIZE - 1), size, direction);
 }
 
 static void tile_pci_dma_sync_single_for_cpu(struct device *dev,