<varname>/sys/class/uio/uioX/maps/mapY/*</varname>.
The dynmaic memory regions will be freed when the UIO device file is
closed. When no processes are holding the device file open, the address
- returned to userspace is DMA_ERROR_CODE.
+ returned to userspace is ~0.
</para>
</sect1>
#include <linux/of_address.h>
#define DRIVER_NAME "uio_dmem_genirq"
+#define DMEM_MAP_ERROR (~0)
struct uio_dmem_genirq_platdata {
struct uio_info *uioinfo;
addr = dma_alloc_coherent(&priv->pdev->dev, uiomem->size,
(dma_addr_t *)&uiomem->addr, GFP_KERNEL);
if (!addr) {
+ uiomem->addr = DMEM_MAP_ERROR;
ret = -ENOMEM;
break;
}
dma_free_coherent(&priv->pdev->dev, uiomem->size,
priv->dmem_region_vaddr[dmem_region++],
uiomem->addr);
- uiomem->addr = DMA_ERROR_CODE;
+ uiomem->addr = DMEM_MAP_ERROR;
++uiomem;
}
break;
}
uiomem->memtype = UIO_MEM_PHYS;
- uiomem->addr = DMA_ERROR_CODE;
+ uiomem->addr = DMEM_MAP_ERROR;
uiomem->size = pdata->dynamic_region_sizes[i];
++uiomem;
}