aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/iommu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/iommu.c')
-rw-r--r--arch/sparc/kernel/iommu.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
index 47977a77f6c6..6f01e8c83197 100644
--- a/arch/sparc/kernel/iommu.c
+++ b/arch/sparc/kernel/iommu.c
@@ -255,10 +255,9 @@ static inline iopte_t *alloc_npages(struct device *dev, struct iommu *iommu,
255static int iommu_alloc_ctx(struct iommu *iommu) 255static int iommu_alloc_ctx(struct iommu *iommu)
256{ 256{
257 int lowest = iommu->ctx_lowest_free; 257 int lowest = iommu->ctx_lowest_free;
258 int sz = IOMMU_NUM_CTXS - lowest; 258 int n = find_next_zero_bit(iommu->ctx_bitmap, IOMMU_NUM_CTXS, lowest);
259 int n = find_next_zero_bit(iommu->ctx_bitmap, sz, lowest);
260 259
261 if (unlikely(n == sz)) { 260 if (unlikely(n == IOMMU_NUM_CTXS)) {
262 n = find_next_zero_bit(iommu->ctx_bitmap, lowest, 1); 261 n = find_next_zero_bit(iommu->ctx_bitmap, lowest, 1);
263 if (unlikely(n == lowest)) { 262 if (unlikely(n == lowest)) {
264 printk(KERN_WARNING "IOMMU: Ran out of contexts.\n"); 263 printk(KERN_WARNING "IOMMU: Ran out of contexts.\n");
@@ -334,13 +333,10 @@ static void dma_4u_free_coherent(struct device *dev, size_t size,
334 void *cpu, dma_addr_t dvma) 333 void *cpu, dma_addr_t dvma)
335{ 334{
336 struct iommu *iommu; 335 struct iommu *iommu;
337 iopte_t *iopte;
338 unsigned long flags, order, npages; 336 unsigned long flags, order, npages;
339 337
340 npages = IO_PAGE_ALIGN(size) >> IO_PAGE_SHIFT; 338 npages = IO_PAGE_ALIGN(size) >> IO_PAGE_SHIFT;
341 iommu = dev->archdata.iommu; 339 iommu = dev->archdata.iommu;
342 iopte = iommu->page_table +
343 ((dvma - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
344 340
345 spin_lock_irqsave(&iommu->lock, flags); 341 spin_lock_irqsave(&iommu->lock, flags);
346 342