Lines Matching refs:resource
38 struct fsl_mc_resource *resource; in fsl_mc_resource_pool_add_device() local
46 if (mc_dev->resource) in fsl_mc_resource_pool_add_device()
63 resource = devm_kzalloc(&mc_bus_dev->dev, sizeof(*resource), in fsl_mc_resource_pool_add_device()
65 if (!resource) { in fsl_mc_resource_pool_add_device()
72 resource->type = pool_type; in fsl_mc_resource_pool_add_device()
73 resource->id = mc_dev->obj_desc.id; in fsl_mc_resource_pool_add_device()
74 resource->data = mc_dev; in fsl_mc_resource_pool_add_device()
75 resource->parent_pool = res_pool; in fsl_mc_resource_pool_add_device()
76 INIT_LIST_HEAD(&resource->node); in fsl_mc_resource_pool_add_device()
77 list_add_tail(&resource->node, &res_pool->free_list); in fsl_mc_resource_pool_add_device()
78 mc_dev->resource = resource; in fsl_mc_resource_pool_add_device()
103 struct fsl_mc_resource *resource; in fsl_mc_resource_pool_remove_device() local
109 resource = mc_dev->resource; in fsl_mc_resource_pool_remove_device()
110 if (!resource || resource->data != mc_dev) { in fsl_mc_resource_pool_remove_device()
115 res_pool = resource->parent_pool; in fsl_mc_resource_pool_remove_device()
116 if (res_pool != &mc_bus->resource_pools[resource->type]) { in fsl_mc_resource_pool_remove_device()
137 if (list_empty(&resource->node)) { in fsl_mc_resource_pool_remove_device()
145 list_del_init(&resource->node); in fsl_mc_resource_pool_remove_device()
149 devm_kfree(&mc_bus_dev->dev, resource); in fsl_mc_resource_pool_remove_device()
150 mc_dev->resource = NULL; in fsl_mc_resource_pool_remove_device()
186 struct fsl_mc_resource *resource; in fsl_mc_resource_allocate() local
202 resource = list_first_entry_or_null(&res_pool->free_list, in fsl_mc_resource_allocate()
205 if (!resource) { in fsl_mc_resource_allocate()
213 if (resource->type != pool_type) in fsl_mc_resource_allocate()
215 if (resource->parent_pool != res_pool) in fsl_mc_resource_allocate()
221 list_del_init(&resource->node); in fsl_mc_resource_allocate()
227 *new_resource = resource; in fsl_mc_resource_allocate()
233 void fsl_mc_resource_free(struct fsl_mc_resource *resource) in fsl_mc_resource_free() argument
237 res_pool = resource->parent_pool; in fsl_mc_resource_free()
238 if (resource->type != res_pool->type) in fsl_mc_resource_free()
246 if (!list_empty(&resource->node)) in fsl_mc_resource_free()
249 list_add_tail(&resource->node, &res_pool->free_list); in fsl_mc_resource_free()
282 struct fsl_mc_resource *resource = NULL; in fsl_mc_object_allocate() local
296 error = fsl_mc_resource_allocate(mc_bus, pool_type, &resource); in fsl_mc_object_allocate()
300 mc_adev = resource->data; in fsl_mc_object_allocate()
317 if (resource) in fsl_mc_object_allocate()
318 fsl_mc_resource_free(resource); in fsl_mc_object_allocate()
331 struct fsl_mc_resource *resource; in fsl_mc_object_free() local
333 resource = mc_adev->resource; in fsl_mc_object_free()
334 if (resource->type == FSL_MC_POOL_DPMCP) in fsl_mc_object_free()
336 if (resource->data != mc_adev) in fsl_mc_object_free()
339 fsl_mc_resource_free(resource); in fsl_mc_object_free()
393 mc_dev_irq->resource.type = res_pool->type; in fsl_mc_populate_irq_pool()
394 mc_dev_irq->resource.data = mc_dev_irq; in fsl_mc_populate_irq_pool()
395 mc_dev_irq->resource.parent_pool = res_pool; in fsl_mc_populate_irq_pool()
397 mc_dev_irq->resource.id = mc_dev_irq->virq; in fsl_mc_populate_irq_pool()
398 INIT_LIST_HEAD(&mc_dev_irq->resource.node); in fsl_mc_populate_irq_pool()
399 list_add_tail(&mc_dev_irq->resource.node, &res_pool->free_list); in fsl_mc_populate_irq_pool()
481 struct fsl_mc_resource *resource; in fsl_mc_allocate_irqs() local
484 &resource); in fsl_mc_allocate_irqs()
488 irqs[i] = to_fsl_mc_irq(resource); in fsl_mc_allocate_irqs()
501 fsl_mc_resource_free(&irqs[i]->resource); in fsl_mc_allocate_irqs()
533 fsl_mc_resource_free(&irqs[i]->resource); in fsl_mc_free_irqs()
561 struct fsl_mc_resource *resource; in fsl_mc_cleanup_resource_pool() local
567 list_for_each_entry_safe(resource, next, &res_pool->free_list, node) in fsl_mc_cleanup_resource_pool()
568 devm_kfree(&mc_bus_dev->dev, resource); in fsl_mc_cleanup_resource_pool()
619 if (mc_dev->resource) { in fsl_mc_allocator_remove()