Ejemplo n.º 1
0
static void ispstat_bufs_free(struct ispstat *stat)
{
	struct isp_device *isp = dev_get_drvdata(stat->isp->dev);
	int i;

	for (i = 0; i < STAT_MAX_BUFS; i++) {
		struct ispstat_buffer *buf = &stat->buf[i];

		if (!IS_COHERENT_BUF(stat)) {
			if (IS_ERR_OR_NULL((void *)buf->iommu_addr))
				continue;
			if (buf->iovm)
				dma_unmap_sg(isp->dev, buf->iovm->sgt->sgl,
					     buf->iovm->sgt->nents,
					     DMA_FROM_DEVICE);
			iommu_vfree(isp->iommu, buf->iommu_addr);
		} else {
			if (!buf->virt_addr)
				continue;
			dma_free_coherent(stat->isp->dev, stat->buf_alloc_size,
					  buf->virt_addr, buf->dma_addr);
		}
		buf->iommu_addr = 0;
		buf->iovm = NULL;
		buf->dma_addr = 0;
		buf->virt_addr = NULL;
		buf->empty = 1;
	}

	dev_dbg(stat->isp->dev, "%s: all buffers were freed.\n",
		stat->subdev.name);

	stat->buf_alloc_size = 0;
	stat->active_buf = NULL;
}
Ejemplo n.º 2
0
void ispstat_bufs_free(struct ispstat *stat)
{
	struct isp_device *isp = dev_get_drvdata(stat->dev);
	int i;

	for (i = 0; i < stat->nbufs; i++) {
		struct ispstat_buffer *buf = &stat->buf[i];

		if (!stat->dma_buf) {
			if (!buf->iommu_addr)
				continue;

			iommu_vfree(isp->iommu, buf->iommu_addr);
		} else {
			if (!buf->virt_addr)
				continue;

			dma_free_coherent(stat->dev, stat->buf_alloc_size,
					  buf->virt_addr, buf->dma_addr);
		}
		buf->iommu_addr = 0;
		buf->dma_addr = 0;
		buf->virt_addr = NULL;
	}

	stat->buf_alloc_size = 0;
}
Ejemplo n.º 3
0
static void ispdss_tmp_buf_free(void)
{
	struct isp_device *isp_res = dev_get_drvdata(dev_ctx.isp);
	if (dev_ctx.tmp_buf) {
		iommu_vfree(isp_res->iommu, dev_ctx.tmp_buf);
		dev_ctx.tmp_buf = 0;
		dev_ctx.tmp_buf_size = 0;
	}
}
Ejemplo n.º 4
0
void ispmmu_vfree(const dma_addr_t da)
{
	iommu_vfree(isp_iommu, (u32)da);
}