Lines Matching refs:mc_dev

15 static bool __must_check fsl_mc_is_allocatable(struct fsl_mc_device *mc_dev)  in fsl_mc_is_allocatable()  argument
17 return is_fsl_mc_bus_dpbp(mc_dev) || in fsl_mc_is_allocatable()
18 is_fsl_mc_bus_dpmcp(mc_dev) || in fsl_mc_is_allocatable()
19 is_fsl_mc_bus_dpcon(mc_dev); in fsl_mc_is_allocatable()
35 *mc_dev) in fsl_mc_resource_pool_add_device()
39 struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev; in fsl_mc_resource_pool_add_device()
44 if (!fsl_mc_is_allocatable(mc_dev)) in fsl_mc_resource_pool_add_device()
46 if (mc_dev->resource) 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()
78 mc_dev->resource = resource; in fsl_mc_resource_pool_add_device()
98 *mc_dev) in fsl_mc_resource_pool_remove_device()
106 if (!fsl_mc_is_allocatable(mc_dev)) in fsl_mc_resource_pool_remove_device()
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()
113 mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); in fsl_mc_resource_pool_remove_device()
135 dev_name(&mc_dev->dev)); in fsl_mc_resource_pool_remove_device()
144 mc_dev->resource = NULL; in fsl_mc_resource_pool_remove_device()
181 struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev; in fsl_mc_resource_allocate()
268 int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev, in fsl_mc_object_allocate() argument
279 if (mc_dev->flags & FSL_MC_IS_DPRC) in fsl_mc_object_allocate()
282 if (!dev_is_fsl_mc(mc_dev->dev.parent)) in fsl_mc_object_allocate()
288 mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); in fsl_mc_object_allocate()
298 mc_adev->consumer_link = device_link_add(&mc_dev->dev, in fsl_mc_object_allocate()
355 struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev; in fsl_mc_populate_irq_pool()
412 struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev; in fsl_mc_cleanup_irq_pool()
436 int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev) in fsl_mc_allocate_irqs() argument
446 if (mc_dev->irqs) in fsl_mc_allocate_irqs()
449 irq_count = mc_dev->obj_desc.irq_count; in fsl_mc_allocate_irqs()
453 if (is_fsl_mc_bus_dprc(mc_dev)) in fsl_mc_allocate_irqs()
454 mc_bus = to_fsl_mc_bus(mc_dev); in fsl_mc_allocate_irqs()
456 mc_bus = to_fsl_mc_bus(to_fsl_mc_device(mc_dev->dev.parent)); in fsl_mc_allocate_irqs()
463 dev_err(&mc_dev->dev, in fsl_mc_allocate_irqs()
468 irqs = devm_kcalloc(&mc_dev->dev, irq_count, sizeof(irqs[0]), in fsl_mc_allocate_irqs()
484 irqs[i]->mc_dev = mc_dev; in fsl_mc_allocate_irqs()
488 mc_dev->irqs = irqs; in fsl_mc_allocate_irqs()
493 irqs[i]->mc_dev = NULL; in fsl_mc_allocate_irqs()
504 void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev) in fsl_mc_free_irqs() argument
509 struct fsl_mc_device_irq **irqs = mc_dev->irqs; in fsl_mc_free_irqs()
514 irq_count = mc_dev->obj_desc.irq_count; in fsl_mc_free_irqs()
516 if (is_fsl_mc_bus_dprc(mc_dev)) in fsl_mc_free_irqs()
517 mc_bus = to_fsl_mc_bus(mc_dev); in fsl_mc_free_irqs()
519 mc_bus = to_fsl_mc_bus(to_fsl_mc_device(mc_dev->dev.parent)); in fsl_mc_free_irqs()
525 irqs[i]->mc_dev = NULL; in fsl_mc_free_irqs()
529 mc_dev->irqs = NULL; in fsl_mc_free_irqs()
579 static int fsl_mc_allocator_probe(struct fsl_mc_device *mc_dev) in fsl_mc_allocator_probe() argument
586 if (!fsl_mc_is_allocatable(mc_dev)) in fsl_mc_allocator_probe()
589 mc_bus_dev = to_fsl_mc_device(mc_dev->dev.parent); in fsl_mc_allocator_probe()
594 error = object_type_to_pool_type(mc_dev->obj_desc.type, &pool_type); in fsl_mc_allocator_probe()
598 error = fsl_mc_resource_pool_add_device(mc_bus, pool_type, mc_dev); in fsl_mc_allocator_probe()
602 dev_dbg(&mc_dev->dev, in fsl_mc_allocator_probe()
611 static int fsl_mc_allocator_remove(struct fsl_mc_device *mc_dev) in fsl_mc_allocator_remove() argument
615 if (!fsl_mc_is_allocatable(mc_dev)) in fsl_mc_allocator_remove()
618 if (mc_dev->resource) { in fsl_mc_allocator_remove()
619 error = fsl_mc_resource_pool_remove_device(mc_dev); in fsl_mc_allocator_remove()
624 dev_dbg(&mc_dev->dev, in fsl_mc_allocator_remove()