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

Commit 21690279 authored by Mangalaram ARCHANA's avatar Mangalaram ARCHANA Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: Adding device type to track device handles



Adding device type for each driver to track how
many device handles are created and freed.

Change-Id: I97bae8c3d816ce0a6764731f1efb275fd5df09fb
Signed-off-by: default avatarMangalaram ARCHANA <mangar@codeaurora.org>
parent f08671a6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -578,7 +578,7 @@ int32_t cam_context_acquire_dev_to_hw(struct cam_context *ctx,
	req_hdl_param.media_entity_flag = 0;
	req_hdl_param.priv = ctx;
	req_hdl_param.ops = ctx->crm_ctx_intf;

	req_hdl_param.dev_id = ctx->dev_id;
	ctx->dev_hdl = cam_create_device_hdl(&req_hdl_param);
	if (ctx->dev_hdl <= 0) {
		rc = -EFAULT;
+1 −1
Original line number Diff line number Diff line
@@ -2875,7 +2875,7 @@ static int __cam_isp_ctx_acquire_dev_in_available(struct cam_context *ctx,
	req_hdl_param.media_entity_flag = 0;
	req_hdl_param.ops = ctx->crm_ctx_intf;
	req_hdl_param.priv = ctx;

	req_hdl_param.dev_id = CAM_ISP;
	CAM_DBG(CAM_ISP, "get device handle form bridge");
	ctx->dev_hdl = cam_create_device_hdl(&req_hdl_param);
	if (ctx->dev_hdl <= 0) {
+1 −1
Original line number Diff line number Diff line
@@ -2700,7 +2700,7 @@ int cam_req_mgr_link(struct cam_req_mgr_ver_info *link_info)
	memset(&root_dev, 0, sizeof(struct cam_create_dev_hdl));
	root_dev.session_hdl = link_info->u.link_info_v1.session_hdl;
	root_dev.priv = (void *)link;

	root_dev.dev_id = CAM_CRM;
	mutex_lock(&link->lock);
	/* Create unique dev handle for link */
	link->link_hdl = cam_create_device_hdl(&root_dev);
+19 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -128,6 +128,21 @@ static int32_t cam_get_free_handle_index(void)
	return idx;
}

void cam_dump_tbl_info(void)
{
	int i;

	for (i = 0; i < CAM_REQ_MGR_MAX_HANDLES; i++)
		CAM_INFO(CAM_CRM, "session_hdl=%x hdl_value=%x\n"
			"type=%d state=%d dev_id=%lld",
			hdl_tbl->hdl[i].session_hdl,
			hdl_tbl->hdl[i].hdl_value,
			hdl_tbl->hdl[i].type,
			hdl_tbl->hdl[i].state,
			hdl_tbl->hdl[i].dev_id);

}

int32_t cam_create_session_hdl(void *priv)
{
	int idx;
@@ -144,6 +159,7 @@ int32_t cam_create_session_hdl(void *priv)
	idx = cam_get_free_handle_index();
	if (idx < 0) {
		CAM_ERR(CAM_CRM, "Unable to create session handle");
		cam_dump_tbl_info();
		spin_unlock_bh(&hdl_tbl_lock);
		return idx;
	}
@@ -177,6 +193,7 @@ int32_t cam_create_device_hdl(struct cam_create_dev_hdl *hdl_data)
	idx = cam_get_free_handle_index();
	if (idx < 0) {
		CAM_ERR(CAM_CRM, "Unable to create device handle");
		cam_dump_tbl_info();
		spin_unlock_bh(&hdl_tbl_lock);
		return idx;
	}
@@ -189,6 +206,7 @@ int32_t cam_create_device_hdl(struct cam_create_dev_hdl *hdl_data)
	hdl_tbl->hdl[idx].state = HDL_ACTIVE;
	hdl_tbl->hdl[idx].priv = hdl_data->priv;
	hdl_tbl->hdl[idx].ops = hdl_data->ops;
	hdl_tbl->hdl[idx].dev_id = hdl_data->dev_id;
	spin_unlock_bh(&hdl_tbl_lock);

	pr_debug("%s: handle = %x", __func__, handle);
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -50,6 +50,7 @@ struct handle {
	uint32_t hdl_value;
	enum hdl_type type;
	enum hdl_state state;
	uint64_t dev_id;
	void *ops;
	void *priv;
};
@@ -80,6 +81,7 @@ struct cam_create_dev_hdl {
	int32_t v4l2_sub_dev_flag;
	int32_t media_entity_flag;
	int32_t reserved;
	uint64_t dev_id;
	void *ops;
	void *priv;
};
Loading