/** * get the available size of genpool */ static size_t hisi_iova_available(struct gen_pool *pool) { size_t avail; mutex_lock(&iova_pool_mutex); avail = gen_pool_avail(pool); mutex_unlock(&iova_pool_mutex); return avail; }
/** * 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; }
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; }
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; }