Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b39c9dcc authored by Jeyaprakash Soundrapandian's avatar Jeyaprakash Soundrapandian Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: crm: Clean up the handle struct on unlink" into dev/msm-4.9-camx

parents 60b01cab a606d18c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -134,8 +134,8 @@ int cam_context_handle_crm_unlink(struct cam_context *ctx,
		rc = ctx->state_machine[ctx->state].crm_ops.unlink(
			ctx, unlink);
	} else {
		CAM_ERR(CAM_CORE, "No crm unlink in dev %d, state %d",
			ctx->dev_hdl, ctx->state);
		CAM_ERR(CAM_CORE, "No crm unlink in dev %d, name %s, state %d",
			ctx->dev_hdl, ctx->dev_name, ctx->state);
		rc = -EPROTO;
	}
	mutex_unlock(&ctx->ctx_mutex);
+15 −4
Original line number Diff line number Diff line
@@ -882,12 +882,14 @@ static void __cam_req_mgr_destroy_subdev(
 * @brief    : Cleans up the mem allocated while linking
 * @link     : pointer to link, mem associated with this link is freed
 *
 * @return   : returns if unlink for any device was success or failure
 */
static void __cam_req_mgr_destroy_link_info(struct cam_req_mgr_core_link *link)
static int __cam_req_mgr_destroy_link_info(struct cam_req_mgr_core_link *link)
{
	int32_t                                 i = 0;
	struct cam_req_mgr_connected_device    *dev;
	struct cam_req_mgr_core_dev_link_setup  link_data;
	int                                     rc = 0;

	link_data.link_enable = 0;
	link_data.link_hdl = link->link_hdl;
@@ -900,7 +902,11 @@ static void __cam_req_mgr_destroy_link_info(struct cam_req_mgr_core_link *link)
		if (dev != NULL) {
			link_data.dev_hdl = dev->dev_hdl;
			if (dev->ops && dev->ops->link_setup)
				dev->ops->link_setup(&link_data);
				rc = dev->ops->link_setup(&link_data);
				if (rc)
					CAM_ERR(CAM_CRM,
						"Unlink failed dev_hdl %d",
						dev->dev_hdl);
			dev->dev_hdl = 0;
			dev->parent = NULL;
			dev->ops = NULL;
@@ -915,6 +921,7 @@ static void __cam_req_mgr_destroy_link_info(struct cam_req_mgr_core_link *link)
	link->num_devs = 0;
	link->max_delay = 0;

	return rc;
}

/**
@@ -2043,8 +2050,12 @@ int cam_req_mgr_unlink(struct cam_req_mgr_unlink_info *unlink_info)

	cam_req_mgr_workq_destroy(&link->workq);

	/* Cleanuprequest tables */
	__cam_req_mgr_destroy_link_info(link);
	/* Cleanup request tables and unlink devices */
	rc = __cam_req_mgr_destroy_link_info(link);
	if (rc) {
		CAM_ERR(CAM_CORE, "Unlink failed. Cannot proceed");
		return rc;
	}

	/* Free memory holding data of linked devs */
	__cam_req_mgr_destroy_subdev(link->l_dev);
+2 −0
Original line number Diff line number Diff line
@@ -317,6 +317,8 @@ static int cam_destroy_hdl(int32_t dev_hdl, int dev_hdl_type)
	}

	hdl_tbl->hdl[idx].state = HDL_FREE;
	hdl_tbl->hdl[idx].ops   = NULL;
	hdl_tbl->hdl[idx].priv  = NULL;
	clear_bit(idx, hdl_tbl->bitmap);
	spin_unlock_bh(&hdl_tbl_lock);