.. | .. |
---|
297 | 297 | goto error; |
---|
298 | 298 | } |
---|
299 | 299 | |
---|
| 300 | + mc_adev->consumer_link = device_link_add(&mc_dev->dev, |
---|
| 301 | + &mc_adev->dev, |
---|
| 302 | + DL_FLAG_AUTOREMOVE_CONSUMER); |
---|
| 303 | + if (!mc_adev->consumer_link) { |
---|
| 304 | + error = -EINVAL; |
---|
| 305 | + goto error; |
---|
| 306 | + } |
---|
| 307 | + |
---|
300 | 308 | *new_mc_adev = mc_adev; |
---|
301 | 309 | return 0; |
---|
302 | 310 | error: |
---|
.. | .. |
---|
323 | 331 | return; |
---|
324 | 332 | |
---|
325 | 333 | fsl_mc_resource_free(resource); |
---|
| 334 | + |
---|
| 335 | + mc_adev->consumer_link = NULL; |
---|
326 | 336 | } |
---|
327 | 337 | EXPORT_SYMBOL_GPL(fsl_mc_object_free); |
---|
328 | 338 | |
---|
.. | .. |
---|
336 | 346 | * Initialize the interrupt pool associated with an fsl-mc bus. |
---|
337 | 347 | * It allocates a block of IRQs from the GIC-ITS. |
---|
338 | 348 | */ |
---|
339 | | -int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus, |
---|
| 349 | +int fsl_mc_populate_irq_pool(struct fsl_mc_device *mc_bus_dev, |
---|
340 | 350 | unsigned int irq_count) |
---|
341 | 351 | { |
---|
342 | 352 | unsigned int i; |
---|
.. | .. |
---|
344 | 354 | struct fsl_mc_device_irq *irq_resources; |
---|
345 | 355 | struct fsl_mc_device_irq *mc_dev_irq; |
---|
346 | 356 | int error; |
---|
347 | | - struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev; |
---|
| 357 | + struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev); |
---|
348 | 358 | struct fsl_mc_resource_pool *res_pool = |
---|
349 | 359 | &mc_bus->resource_pools[FSL_MC_POOL_IRQ]; |
---|
| 360 | + |
---|
| 361 | + /* do nothing if the IRQ pool is already populated */ |
---|
| 362 | + if (mc_bus->irq_resources) |
---|
| 363 | + return 0; |
---|
350 | 364 | |
---|
351 | 365 | if (irq_count == 0 || |
---|
352 | 366 | irq_count > FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS) |
---|
.. | .. |
---|
399 | 413 | * Teardown the interrupt pool associated with an fsl-mc bus. |
---|
400 | 414 | * It frees the IRQs that were allocated to the pool, back to the GIC-ITS. |
---|
401 | 415 | */ |
---|
402 | | -void fsl_mc_cleanup_irq_pool(struct fsl_mc_bus *mc_bus) |
---|
| 416 | +void fsl_mc_cleanup_irq_pool(struct fsl_mc_device *mc_bus_dev) |
---|
403 | 417 | { |
---|
404 | | - struct fsl_mc_device *mc_bus_dev = &mc_bus->mc_dev; |
---|
| 418 | + struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev); |
---|
405 | 419 | struct fsl_mc_resource_pool *res_pool = |
---|
406 | 420 | &mc_bus->resource_pools[FSL_MC_POOL_IRQ]; |
---|
407 | 421 | |
---|