diff options
Diffstat (limited to 'drivers/cam_req_mgr/cam_req_mgr_core.c')
-rw-r--r-- | drivers/cam_req_mgr/cam_req_mgr_core.c | 69 |
1 files changed, 28 insertions, 41 deletions
diff --git a/drivers/cam_req_mgr/cam_req_mgr_core.c b/drivers/cam_req_mgr/cam_req_mgr_core.c index d9dfa9b..7911255 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_core.c +++ b/drivers/cam_req_mgr/cam_req_mgr_core.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/module.h> @@ -2661,9 +2662,7 @@ static int cam_req_mgr_cb_add_req(struct cam_req_mgr_add_request *add_req) return -EINVAL; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(add_req->link_hdl); - + link = cam_get_link_priv(add_req->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", add_req->link_hdl); return -EINVAL; @@ -2740,8 +2739,7 @@ static int cam_req_mgr_cb_notify_err( goto end; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(err_info->link_hdl); + link = cam_get_link_priv(err_info->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", err_info->link_hdl); rc = -EINVAL; @@ -2827,8 +2825,7 @@ static int cam_req_mgr_cb_notify_timer( goto end; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(timer_data->link_hdl); + link = cam_get_link_priv(timer_data->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", timer_data->link_hdl); rc = -EINVAL; @@ -2874,8 +2871,7 @@ static int cam_req_mgr_cb_notify_stop( goto end; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(stop_info->link_hdl); + link = cam_get_link_priv(stop_info->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", stop_info->link_hdl); rc = -EINVAL; @@ -2936,8 +2932,7 @@ static int cam_req_mgr_cb_notify_trigger( goto end; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(trigger_data->link_hdl); + link = cam_get_link_priv(trigger_data->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", trigger_data->link_hdl); rc = -EINVAL; @@ -3292,7 +3287,7 @@ static int __cam_req_mgr_unlink(struct cam_req_mgr_core_link *link) __cam_req_mgr_destroy_subdev(link->l_dev); /* Destroy the link handle */ - rc = cam_destroy_device_hdl(link->link_hdl); + rc = cam_destroy_link_hdl(link->link_hdl); if (rc < 0) { CAM_ERR(CAM_CRM, "error destroying link hdl %x rc %d", link->link_hdl, rc); @@ -3318,8 +3313,7 @@ int cam_req_mgr_destroy_session( } mutex_lock(&g_crm_core_dev->crm_lock); - cam_session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(ses_info->session_hdl); + cam_session = cam_get_session_priv(ses_info->session_hdl); if (!cam_session) { CAM_ERR(CAM_CRM, "failed to get session priv"); rc = -ENOENT; @@ -3379,8 +3373,8 @@ int cam_req_mgr_link(struct cam_req_mgr_ver_info *link_info) mutex_lock(&g_crm_core_dev->crm_lock); /* session hdl's priv data is cam session struct */ - cam_session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(link_info->u.link_info_v1.session_hdl); + cam_session = + cam_get_session_priv(link_info->u.link_info_v1.session_hdl); if (!cam_session) { CAM_DBG(CAM_CRM, "NULL pointer"); mutex_unlock(&g_crm_core_dev->crm_lock); @@ -3401,8 +3395,8 @@ int cam_req_mgr_link(struct cam_req_mgr_ver_info *link_info) root_dev.priv = (void *)link; mutex_lock(&link->lock); - /* Create unique dev handle for link */ - link->link_hdl = cam_create_device_hdl(&root_dev); + /* Create unique handle for link */ + link->link_hdl = cam_create_link_hdl(&root_dev); if (link->link_hdl < 0) { CAM_ERR(CAM_CRM, "Insufficient memory to create new device handle"); @@ -3488,8 +3482,8 @@ int cam_req_mgr_link_v2(struct cam_req_mgr_ver_info *link_info) mutex_lock(&g_crm_core_dev->crm_lock); /* session hdl's priv data is cam session struct */ - cam_session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(link_info->u.link_info_v2.session_hdl); + cam_session = + cam_get_session_priv(link_info->u.link_info_v2.session_hdl); if (!cam_session) { CAM_DBG(CAM_CRM, "NULL pointer"); mutex_unlock(&g_crm_core_dev->crm_lock); @@ -3510,8 +3504,8 @@ int cam_req_mgr_link_v2(struct cam_req_mgr_ver_info *link_info) root_dev.priv = (void *)link; mutex_lock(&link->lock); - /* Create unique dev handle for link */ - link->link_hdl = cam_create_device_hdl(&root_dev); + /* Create unique handle for link */ + link->link_hdl = cam_create_link_hdl(&root_dev); if (link->link_hdl < 0) { CAM_ERR(CAM_CRM, "Insufficient memory to create new device handle"); @@ -3590,8 +3584,7 @@ int cam_req_mgr_unlink(struct cam_req_mgr_unlink_info *unlink_info) CAM_DBG(CAM_CRM, "link_hdl %x", unlink_info->link_hdl); /* session hdl's priv data is cam session struct */ - cam_session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(unlink_info->session_hdl); + cam_session = cam_get_session_priv(unlink_info->session_hdl); if (!cam_session) { CAM_ERR(CAM_CRM, "NULL pointer"); mutex_unlock(&g_crm_core_dev->crm_lock); @@ -3599,7 +3592,7 @@ int cam_req_mgr_unlink(struct cam_req_mgr_unlink_info *unlink_info) } /* link hdl's priv data is core_link struct */ - link = cam_get_device_priv(unlink_info->link_hdl); + link = cam_get_link_priv(unlink_info->link_hdl); if (!link) { CAM_ERR(CAM_CRM, "NULL pointer"); rc = -EINVAL; @@ -3631,8 +3624,7 @@ int cam_req_mgr_schedule_request( } mutex_lock(&g_crm_core_dev->crm_lock); - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(sched_req->link_hdl); + link = cam_get_link_priv(sched_req->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", sched_req->link_hdl); rc = -EINVAL; @@ -3744,8 +3736,8 @@ int cam_req_mgr_sync_config( mutex_lock(&g_crm_core_dev->crm_lock); /* session hdl's priv data is cam session struct */ - cam_session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(sync_info->session_hdl); + cam_session = + cam_get_session_priv(sync_info->session_hdl); if (!cam_session) { CAM_ERR(CAM_CRM, "NULL pointer"); mutex_unlock(&g_crm_core_dev->crm_lock); @@ -3758,14 +3750,14 @@ int cam_req_mgr_sync_config( sync_info->link_hdls[0], sync_info->link_hdls[1]); /* only two links existing per session in dual cam use case*/ - link1 = cam_get_device_priv(sync_info->link_hdls[0]); + link1 = cam_get_link_priv(sync_info->link_hdls[0]); if (!link1) { CAM_ERR(CAM_CRM, "link1 NULL pointer"); rc = -EINVAL; goto done; } - link2 = cam_get_device_priv(sync_info->link_hdls[1]); + link2 = cam_get_link_priv(sync_info->link_hdls[1]); if (!link2) { CAM_ERR(CAM_CRM, "link2 NULL pointer"); rc = -EINVAL; @@ -3835,8 +3827,7 @@ int cam_req_mgr_flush_requests( mutex_lock(&g_crm_core_dev->crm_lock); /* session hdl's priv data is cam session struct */ - session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(flush_info->session_hdl); + session = cam_get_session_priv(flush_info->session_hdl); if (!session) { CAM_ERR(CAM_CRM, "Invalid session %x", flush_info->session_hdl); rc = -EINVAL; @@ -3848,8 +3839,7 @@ int cam_req_mgr_flush_requests( goto end; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(flush_info->link_hdl); + link = cam_get_link_priv(flush_info->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", flush_info->link_hdl); rc = -EINVAL; @@ -3906,8 +3896,7 @@ int cam_req_mgr_link_control(struct cam_req_mgr_link_control *control) mutex_lock(&g_crm_core_dev->crm_lock); for (i = 0; i < control->num_links; i++) { - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(control->link_hdls[i]); + link = cam_get_link_priv(control->link_hdls[i]); if (!link) { CAM_ERR(CAM_CRM, "Link(%d) is NULL on session 0x%x", i, control->session_hdl); @@ -3983,8 +3972,7 @@ int cam_req_mgr_dump_request(struct cam_dump_req_cmd *dump_req) mutex_lock(&g_crm_core_dev->crm_lock); /* session hdl's priv data is cam session struct */ - session = (struct cam_req_mgr_core_session *) - cam_get_device_priv(dump_req->session_handle); + session = cam_get_session_priv(dump_req->session_handle); if (!session) { CAM_ERR(CAM_CRM, "Invalid session %x", dump_req->session_handle); @@ -3997,8 +3985,7 @@ int cam_req_mgr_dump_request(struct cam_dump_req_cmd *dump_req) goto end; } - link = (struct cam_req_mgr_core_link *) - cam_get_device_priv(dump_req->link_hdl); + link = cam_get_link_priv(dump_req->link_hdl); if (!link) { CAM_DBG(CAM_CRM, "link ptr NULL %x", dump_req->link_hdl); rc = -EINVAL; |