/**
 * get the whole size of genpool
 */
static size_t hisi_iova_size(struct gen_pool *pool)
{
	size_t size;
	mutex_lock(&iova_pool_mutex);
	size = gen_pool_size(pool);
	mutex_unlock(&iova_pool_mutex);
	return size;
}
Example #2
0
/**
 * zynq_ocm_remove - Remove method for the OCM driver
 * @pdev:	Pointer to the platform_device structure
 *
 * This function is called if a device is physically removed from the system or
 * if the driver module is being unloaded. It frees all resources allocated to
 * the device.
 *
 * Return:	0 on success and error value on failure
 */
static int zynq_ocm_remove(struct platform_device *pdev)
{
	struct zynq_ocm_dev *zynq_ocm = platform_get_drvdata(pdev);

	if (gen_pool_avail(zynq_ocm->pool) < gen_pool_size(zynq_ocm->pool))
		dev_dbg(&pdev->dev, "removed while SRAM allocated\n");

	return 0;
}
Example #3
0
static int sram_remove(struct vmm_device *dev)
{
	struct sram_dev *sram = vmm_devdrv_get_data(dev);

	if (gen_pool_avail(sram->pool) < gen_pool_size(sram->pool))
		vmm_printf("%s: removed while SRAM allocated\n", dev->name);

	gen_pool_destroy(sram->pool);

	if (sram->clk)
		clk_disable_unprepare(sram->clk);

	return 0;
}
Example #4
0
static int sram_remove(struct platform_device *pdev)
{
	struct sram_dev *sram = platform_get_drvdata(pdev);

	if (gen_pool_avail(sram->pool) < gen_pool_size(sram->pool))
		dev_dbg(&pdev->dev, "removed while SRAM allocated\n");

	gen_pool_destroy(sram->pool);

	if (sram->clk)
		clk_disable_unprepare(sram->clk);

	return 0;
}
static int ghes_estatus_pool_expand(unsigned long len)
{
	unsigned long i, pages, size, addr;
	int ret;

	ghes_estatus_pool_size_request += PAGE_ALIGN(len);
	size = gen_pool_size(ghes_estatus_pool);
	if (size >= ghes_estatus_pool_size_request)
		return 0;
	pages = (ghes_estatus_pool_size_request - size) / PAGE_SIZE;
	for (i = 0; i < pages; i++) {
		addr = __get_free_page(GFP_KERNEL);
		if (!addr)
			return -ENOMEM;
		ret = gen_pool_add(ghes_estatus_pool, addr, PAGE_SIZE, -1);
		if (ret)
			return ret;
	}

	return 0;
}