bitmap: introduce bitmap_set, bitmap_clear, bitmap_find_next_zero_area
[safe/jmp/linux-2.6] / lib / swiotlb.c
index 0c12d7c..437eedb 100644 (file)
@@ -111,6 +111,7 @@ setup_io_tlb_npages(char *str)
                ++str;
        if (!strcmp(str, "force"))
                swiotlb_force = 1;
+
        return 1;
 }
 __setup("swiotlb=", setup_io_tlb_npages);
@@ -484,7 +485,7 @@ do_unmap_single(struct device *hwdev, char *dma_addr, size_t size, int dir)
 
        /*
         * Return the buffer to the free list by setting the corresponding
-        * entries to indicate the number of contigous entries available.
+        * entries to indicate the number of contiguous entries available.
         * While returning the entries to the free list, we merge the entries
         * with slots below and above the pool being returned.
         */
@@ -548,7 +549,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
                dma_mask = hwdev->coherent_dma_mask;
 
        ret = (void *)__get_free_pages(flags, order);
-       if (ret && swiotlb_virt_to_bus(hwdev, ret) + size > dma_mask) {
+       if (ret && swiotlb_virt_to_bus(hwdev, ret) + size - 1 > dma_mask) {
                /*
                 * The allocated memory isn't reachable by the device.
                 */
@@ -570,7 +571,7 @@ swiotlb_alloc_coherent(struct device *hwdev, size_t size,
        dev_addr = swiotlb_virt_to_bus(hwdev, ret);
 
        /* Confirm address can be DMA'd by device */
-       if (dev_addr + size > dma_mask) {
+       if (dev_addr + size - 1 > dma_mask) {
                printk("hwdev DMA mask = 0x%016Lx, dev_addr = 0x%016Lx\n",
                       (unsigned long long)dma_mask,
                       (unsigned long long)dev_addr);