drivers/bus/fsl-mc/mc-io.c

Source file repositories/reference/linux-study-clean/drivers/bus/fsl-mc/mc-io.c

File Facts

System
Linux kernel
Corpus path
drivers/bus/fsl-mc/mc-io.c
Extension
.c
Size
6799 bytes
Lines
273
Domain
Driver Families
Bucket
drivers/bus
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (!dpmcp_dev->consumer_link) {
			error = -EINVAL;
			goto error_cleanup_mc_io;
		}
	}

	*new_mc_io = mc_io;
	return 0;

error_cleanup_mc_io:
	fsl_destroy_mc_io(mc_io);
error_cleanup_resource:
	fsl_mc_resource_free(resource);
	return error;
}
EXPORT_SYMBOL_GPL(fsl_mc_portal_allocate);

/**
 * fsl_mc_portal_free - Returns an MC portal to the pool of free MC portals
 * of a given MC bus
 *
 * @mc_io: Pointer to the fsl_mc_io object that wraps the MC portal to free
 */
void fsl_mc_portal_free(struct fsl_mc_io *mc_io)
{
	struct fsl_mc_device *dpmcp_dev;
	struct fsl_mc_resource *resource;

	/*
	 * Every mc_io obtained by calling fsl_mc_portal_allocate() is supposed
	 * to have a DPMCP object associated with.
	 */
	dpmcp_dev = mc_io->dpmcp_dev;

	resource = dpmcp_dev->resource;
	if (!resource || resource->type != FSL_MC_POOL_DPMCP)
		return;

	if (resource->data != dpmcp_dev)
		return;

	fsl_destroy_mc_io(mc_io);
	fsl_mc_resource_free(resource);

	dpmcp_dev->consumer_link = NULL;
}
EXPORT_SYMBOL_GPL(fsl_mc_portal_free);

Annotation

Implementation Notes