Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0e191b2 authored by Joerg Roedel's avatar Joerg Roedel
Browse files

iommu/amd: Remove map_sg_no_iommu()



This function was intended as a fall-back if the map_sg
function is called for a device not mapped by the IOMMU.
Since the AMD IOMMU driver uses per-device dma_ops this can
never happen. So this function isn't needed anymore.

Reviewed-by: default avatarShuah Khan <shuahkhan@gmail.com>
Signed-off-by: default avatarJoerg Roedel <joro@8bytes.org>
parent 925fe08b
Loading
Loading
Loading
Loading
+1 −21
Original line number Original line Diff line number Diff line
@@ -2841,24 +2841,6 @@ static void unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size,
	spin_unlock_irqrestore(&domain->lock, flags);
	spin_unlock_irqrestore(&domain->lock, flags);
}
}


/*
 * This is a special map_sg function which is used if we should map a
 * device which is not handled by an AMD IOMMU in the system.
 */
static int map_sg_no_iommu(struct device *dev, struct scatterlist *sglist,
			   int nelems, int dir)
{
	struct scatterlist *s;
	int i;

	for_each_sg(sglist, s, nelems, i) {
		s->dma_address = (dma_addr_t)sg_phys(s);
		s->dma_length  = s->length;
	}

	return nelems;
}

/*
/*
 * The exported map_sg function for dma_ops (handles scatter-gather
 * The exported map_sg function for dma_ops (handles scatter-gather
 * lists).
 * lists).
@@ -2878,9 +2860,7 @@ static int map_sg(struct device *dev, struct scatterlist *sglist,
	INC_STATS_COUNTER(cnt_map_sg);
	INC_STATS_COUNTER(cnt_map_sg);


	domain = get_domain(dev);
	domain = get_domain(dev);
	if (PTR_ERR(domain) == -EINVAL)
	if (IS_ERR(domain))
		return map_sg_no_iommu(dev, sglist, nelems, dir);
	else if (IS_ERR(domain))
		return 0;
		return 0;


	dma_mask = *dev->dma_mask;
	dma_mask = *dev->dma_mask;