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()
131 if (list_empty(&resource->node)) { in fsl_mc_resource_pool_remove_device()
139 list_del_init(&resource->node); in fsl_mc_resource_pool_remove_device()
143 devm_kfree(&mc_bus_dev->dev, resource); in fsl_mc_resource_pool_remove_device()
144 mc_dev->resource = NULL; in fsl_mc_resource_pool_remove_device()
180 struct fsl_mc_resource *resource; in fsl_mc_resource_allocate() local
196 resource = list_first_entry_or_null(&res_pool->free_list, in fsl_mc_resource_allocate()
199 if (!resource) { in fsl_mc_resource_allocate()
207 if (resource->type != pool_type) in fsl_mc_resource_allocate()
209 if (resource->parent_pool != res_pool) in fsl_mc_resource_allocate()
215 list_del_init(&resource->node); in fsl_mc_resource_allocate()
221 *new_resource = resource; in fsl_mc_resource_allocate()
227 void fsl_mc_resource_free(struct fsl_mc_resource *resource) in fsl_mc_resource_free() argument
231 res_pool = resource->parent_pool; in fsl_mc_resource_free()
232 if (resource->type != res_pool->type) in fsl_mc_resource_free()
240 if (!list_empty(&resource->node)) in fsl_mc_resource_free()
243 list_add_tail(&resource->node, &res_pool->free_list); in fsl_mc_resource_free()
276 struct fsl_mc_resource *resource = NULL; in fsl_mc_object_allocate() local
290 error = fsl_mc_resource_allocate(mc_bus, pool_type, &resource); in fsl_mc_object_allocate()
294 mc_adev = resource->data; in fsl_mc_object_allocate()
311 if (resource) in fsl_mc_object_allocate()
312 fsl_mc_resource_free(resource); in fsl_mc_object_allocate()
325 struct fsl_mc_resource *resource; in fsl_mc_object_free() local
327 resource = mc_adev->resource; in fsl_mc_object_free()
328 if (resource->type == FSL_MC_POOL_DPMCP) in fsl_mc_object_free()
330 if (resource->data != mc_adev) in fsl_mc_object_free()
333 fsl_mc_resource_free(resource); in fsl_mc_object_free()
388 mc_dev_irq->resource.type = res_pool->type; in fsl_mc_populate_irq_pool()
389 mc_dev_irq->resource.data = mc_dev_irq; in fsl_mc_populate_irq_pool()
390 mc_dev_irq->resource.parent_pool = res_pool; in fsl_mc_populate_irq_pool()
391 INIT_LIST_HEAD(&mc_dev_irq->resource.node); in fsl_mc_populate_irq_pool()
392 list_add_tail(&mc_dev_irq->resource.node, &res_pool->free_list); in fsl_mc_populate_irq_pool()
398 mc_dev_irq->resource.id = msi_desc->irq; in fsl_mc_populate_irq_pool()
480 struct fsl_mc_resource *resource; in fsl_mc_allocate_irqs() local
483 &resource); in fsl_mc_allocate_irqs()
487 irqs[i] = to_fsl_mc_irq(resource); in fsl_mc_allocate_irqs()
500 fsl_mc_resource_free(&irqs[i]->resource); in fsl_mc_allocate_irqs()
532 fsl_mc_resource_free(&irqs[i]->resource); in fsl_mc_free_irqs()
560 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()
569 devm_kfree(&mc_bus_dev->dev, resource); in fsl_mc_cleanup_resource_pool()
624 if (mc_dev->resource) { in fsl_mc_allocator_remove()