]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - arch/ppc64/kernel/iommu.c
[PATCH] gfp flags annotations - part 1
[net-next-2.6.git] / arch / ppc64 / kernel / iommu.c
index 8316426ccaf60036c59d3cd45e18835d8e19c88a..4d9b4388918ba5f52f91c7e6b5efa26ec79a0db2 100644 (file)
@@ -242,7 +242,7 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
        dma_addr_t dma_next = 0, dma_addr;
        unsigned long flags;
        struct scatterlist *s, *outs, *segstart;
-       int outcount;
+       int outcount, incount;
        unsigned long handle;
 
        BUG_ON(direction == DMA_NONE);
@@ -252,6 +252,7 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
 
        outs = s = segstart = &sglist[0];
        outcount = 1;
+       incount = nelems;
        handle = 0;
 
        /* Init first segment length for backout at failure */
@@ -338,10 +339,10 @@ int iommu_map_sg(struct device *dev, struct iommu_table *tbl,
 
        DBG("mapped %d elements:\n", outcount);
 
-       /* For the sake of iommu_free_sg, we clear out the length in the
+       /* For the sake of iommu_unmap_sg, we clear out the length in the
         * next entry of the sglist if we didn't fill the list completely
         */
-       if (outcount < nelems) {
+       if (outcount < incount) {
                outs++;
                outs->dma_address = DMA_ERROR_CODE;
                outs->dma_length = 0;
@@ -437,7 +438,8 @@ struct iommu_table *iommu_init_table(struct iommu_table *tbl)
 
 void iommu_free_table(struct device_node *dn)
 {
-       struct iommu_table *tbl = dn->iommu_table;
+       struct pci_dn *pdn = dn->data;
+       struct iommu_table *tbl = pdn->iommu_table;
        unsigned long bitmap_sz, i;
        unsigned int order;
 
@@ -517,7 +519,7 @@ void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle,
  * to the dma address (mapping) of the first page.
  */
 void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
-               dma_addr_t *dma_handle, unsigned int __nocast flag)
+               dma_addr_t *dma_handle, gfp_t flag)
 {
        void *ret = NULL;
        dma_addr_t mapping;