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

Commit 7c65c0fa authored by Karthik Anantha Ram's avatar Karthik Anantha Ram
Browse files

msm: camera: common: Clean shutdown and page fault sequence



Avoid unnecessary logging during shutdown and pagefault
in camera drivers.

CRs-Fixed: 2500721
Change-Id: I2519d45da134306f906186dc25705fc1f84b1972
Signed-off-by: default avatarKarthik Anantha Ram <kartanan@codeaurora.org>
parent 9712baae
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -54,12 +54,15 @@ int cam_context_shutdown(struct cam_context *ctx)
		rc = -EINVAL;
	}

	if (ctx->dev_hdl != -1) {
		rc = cam_destroy_device_hdl(ctx->dev_hdl);
		if (rc)
		CAM_ERR(CAM_CORE, "destroy device hdl failed for node %s",
			CAM_ERR(CAM_CORE,
				"destroy device hdl failed for node %s",
				ctx->dev_name);
		else
			ctx->dev_hdl = -1;
	}

	return rc;
}
@@ -237,13 +240,16 @@ int cam_context_dump_pf_info(struct cam_context *ctx, unsigned long iova,
		return -EINVAL;
	}

	if ((ctx->state > CAM_CTX_AVAILABLE) &&
		(ctx->state < CAM_CTX_STATE_MAX)) {
		if (ctx->state_machine[ctx->state].pagefault_ops) {
		rc = ctx->state_machine[ctx->state].pagefault_ops(ctx, iova,
			buf_info);
			rc = ctx->state_machine[ctx->state].pagefault_ops(
				ctx, iova, buf_info);
		} else {
			CAM_WARN(CAM_CORE, "No dump ctx in dev %d, state %d",
				ctx->dev_hdl, ctx->state);
		}
	}

	return rc;
}
+11 −6
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ void cam_req_mgr_core_link_reset(struct cam_req_mgr_core_link *link)
	link->initial_sync_req = -1;
	link->in_msync_mode = false;
	link->retry_cnt = 0;
	link->is_shutdown = false;
}

void cam_req_mgr_handle_core_shutdown(void)
@@ -55,7 +56,7 @@ void cam_req_mgr_handle_core_shutdown(void)
			&g_crm_core_dev->session_head, entry) {
			ses_info.session_hdl =
				session->session_hdl;
			cam_req_mgr_destroy_session(&ses_info);
			cam_req_mgr_destroy_session(&ses_info, true);
		}
	}
}
@@ -2707,10 +2708,12 @@ static int __cam_req_mgr_unlink(struct cam_req_mgr_core_link *link)
	link->state = CAM_CRM_LINK_STATE_IDLE;
	spin_unlock_bh(&link->link_state_spin_lock);

	if (!link->is_shutdown) {
		rc = __cam_req_mgr_disconnect_link(link);
		if (rc)
			CAM_ERR(CAM_CORE,
				"Unlink for all devices was not successful");
	}

	mutex_lock(&link->lock);
	/* Destroy timer of link */
@@ -2738,7 +2741,8 @@ static int __cam_req_mgr_unlink(struct cam_req_mgr_core_link *link)
}

int cam_req_mgr_destroy_session(
		struct cam_req_mgr_session_info *ses_info)
		struct cam_req_mgr_session_info *ses_info,
		bool is_shutdown)
{
	int rc;
	int i;
@@ -2771,6 +2775,7 @@ int cam_req_mgr_destroy_session(
				continue;

			/* Ignore return value since session is going away */
			link->is_shutdown = is_shutdown;
			__cam_req_mgr_unlink(link);
			__cam_req_mgr_free_link(link);
		}
+6 −1
Original line number Diff line number Diff line
@@ -332,6 +332,8 @@ struct cam_req_mgr_connected_device {
 *                         other link
 * @retry_cnt            : Counter that tracks number of attempts to apply
 *                         the same req
 * @is_shutdown          : Flag to indicate if link needs to be disconnected
 *                         as part of shutdown.
 */
struct cam_req_mgr_core_link {
	int32_t                              link_hdl;
@@ -359,6 +361,7 @@ struct cam_req_mgr_core_link {
	bool                                 in_msync_mode;
	int64_t                              initial_sync_req;
	uint32_t                             retry_cnt;
	bool                                 is_shutdown;
};

/**
@@ -411,11 +414,13 @@ int cam_req_mgr_create_session(struct cam_req_mgr_session_info *ses_info);
 * cam_req_mgr_destroy_session()
 * @brief    : destroy session
 * @ses_info : session handle info, input param
 * @is_shutdown: To indicate if devices on link need to be disconnected.
 *
 * Called as part of session destroy
 * return success/failure
 */
int cam_req_mgr_destroy_session(struct cam_req_mgr_session_info *ses_info);
int cam_req_mgr_destroy_session(struct cam_req_mgr_session_info *ses_info,
	bool is_shutdown);

/**
 * cam_req_mgr_link()
+1 −1
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ static long cam_private_ioctl(struct file *file, void *fh,
			return -EFAULT;
		}

		rc = cam_req_mgr_destroy_session(&ses_info);
		rc = cam_req_mgr_destroy_session(&ses_info, false);
		}
		break;

+2 −2
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 */

#define pr_fmt(fmt) "CAM-REQ-MGR_UTIL %s:%d " fmt, __func__, __LINE__
@@ -94,7 +94,7 @@ int cam_req_mgr_util_free_hdls(void)

	for (i = 0; i < CAM_REQ_MGR_MAX_HANDLES; i++) {
		if (hdl_tbl->hdl[i].state == HDL_ACTIVE) {
			CAM_ERR(CAM_CRM, "Dev handle = %x session_handle = %x",
			CAM_WARN(CAM_CRM, "Dev handle = %x session_handle = %x",
				hdl_tbl->hdl[i].hdl_value,
				hdl_tbl->hdl[i].session_hdl);
			hdl_tbl->hdl[i].state = HDL_FREE;
Loading