コード例 #1
0
ファイル: mc-allocator.c プロジェクト: 19Dan01/linux
/**
 * fsl_mc_portal_reset - Resets the dpmcp object for a given fsl_mc_io object
 *
 * @mc_io: Pointer to the fsl_mc_io object that wraps the MC portal to free
 */
int fsl_mc_portal_reset(struct fsl_mc_io *mc_io)
{
	int error;
	uint16_t token;
	struct fsl_mc_resource *resource = mc_io->resource;
	struct fsl_mc_device *mc_dev = resource->data;

	if (WARN_ON(resource->type != FSL_MC_POOL_DPMCP))
		return -EINVAL;

	if (WARN_ON(!mc_dev))
		return -EINVAL;

	error = dpmcp_open(mc_io, mc_dev->obj_desc.id, &token);
	if (error < 0) {
		dev_err(&mc_dev->dev, "dpmcp_open() failed: %d\n", error);
		return error;
	}

	error = dpmcp_reset(mc_io, token);
	if (error < 0) {
		dev_err(&mc_dev->dev, "dpmcp_reset() failed: %d\n", error);
		return error;
	}

	error = dpmcp_close(mc_io, token);
	if (error < 0) {
		dev_err(&mc_dev->dev, "dpmcp_close() failed: %d\n", error);
		return error;
	}

	return 0;
}
コード例 #2
0
ファイル: mc-sys.c プロジェクト: AK101111/linux
void fsl_mc_io_unset_dpmcp(struct fsl_mc_io *mc_io)
{
	int error;
	struct fsl_mc_device *dpmcp_dev = mc_io->dpmcp_dev;

	if (WARN_ON(!dpmcp_dev))
		return;

	if (WARN_ON(dpmcp_dev->mc_io != mc_io))
		return;

	error = dpmcp_close(mc_io,
			    0,
			    dpmcp_dev->mc_handle);
	if (error < 0) {
		dev_err(&dpmcp_dev->dev, "dpmcp_close() failed: %d\n",
			error);
	}

	mc_io->dpmcp_dev = NULL;
	dpmcp_dev->mc_io = NULL;
}