Browse Source

msm: camera: isp: Remove redundant code

Remove the redundant copying of the callback
function for all the events in ife and tfe
driver because all the events uses same function
to send out the information.

CRs-Fixed: 2915318
Change-Id: I5b43a0ef4844a6f3258ff94ce8810c65a51d8fe9
Signed-off-by: Jigar Agrawal <[email protected]>
Jigar Agrawal 4 năm trước cách đây
mục cha
commit
2872da83e2

+ 10 - 20
drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

@@ -1484,7 +1484,7 @@ static int cam_ife_hw_mgr_release_hw_for_ctx(
 
 	/* clean up the callback function */
 	ife_ctx->common.cb_priv = NULL;
-	memset(ife_ctx->common.event_cb, 0, sizeof(ife_ctx->common.event_cb));
+	ife_ctx->common.event_cb = NULL;
 
 	ife_ctx->flags.need_csid_top_cfg = false;
 
@@ -4710,9 +4710,7 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)
 
 	ife_ctx->common.cb_priv = acquire_args->context_data;
 	ife_ctx->flags.internal_cdm = false;
-	for (i = 0; i < CAM_ISP_HW_EVENT_MAX; i++)
-		ife_ctx->common.event_cb[i] = acquire_args->event_cb;
-
+	ife_ctx->common.event_cb = acquire_args->event_cb;
 	ife_ctx->hw_mgr = ife_hw_mgr;
 	ife_ctx->cdm_ops =  cam_cdm_publish_ops();
 
@@ -5019,8 +5017,7 @@ static int cam_ife_mgr_acquire_dev(void *hw_mgr_priv, void *acquire_hw_args)
 
 	ife_ctx->cdm_handle = 0;
 	ife_ctx->common.cb_priv = acquire_args->context_data;
-	for (i = 0; i < CAM_ISP_HW_EVENT_MAX; i++)
-		ife_ctx->common.event_cb[i] = acquire_args->event_cb;
+	ife_ctx->common.event_cb = acquire_args->event_cb;
 
 	ife_ctx->hw_mgr = ife_hw_mgr;
 	ife_ctx->cdm_ops = cam_cdm_publish_ops();
@@ -10421,7 +10418,6 @@ static int  cam_ife_hw_mgr_find_affected_ctx(
 	struct cam_ife_hw_mgr_ctx   *ife_hwr_mgr_ctx = NULL;
 	cam_hw_event_cb_func         notify_err_cb;
 	struct cam_ife_hw_mgr       *ife_hwr_mgr = NULL;
-	enum cam_isp_hw_event_type   event_type = CAM_ISP_HW_EVENT_ERROR;
 	uint32_t i = 0;
 
 	if (!recovery_data) {
@@ -10450,7 +10446,7 @@ static int  cam_ife_hw_mgr_find_affected_ctx(
 		}
 
 		atomic_set(&ife_hwr_mgr_ctx->overflow_pending, 1);
-		notify_err_cb = ife_hwr_mgr_ctx->common.event_cb[event_type];
+		notify_err_cb = ife_hwr_mgr_ctx->common.event_cb;
 
 		/* Add affected_context in list of recovery data */
 		CAM_DBG(CAM_ISP, "Add affected ctx %d to list",
@@ -10535,8 +10531,7 @@ static int cam_ife_hw_mgr_handle_csid_rup(
 	cam_hw_event_cb_func                     ife_hwr_irq_rup_cb;
 	struct cam_isp_hw_reg_update_event_data  rup_event_data;
 
-	ife_hwr_irq_rup_cb =
-		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_REG_UPDATE];
+	ife_hwr_irq_rup_cb = ife_hw_mgr_ctx->common.event_cb;
 
 	switch (event_info->res_id) {
 	case CAM_IFE_PIX_PATH_RES_IPP:
@@ -10756,8 +10751,7 @@ static int cam_ife_hw_mgr_handle_hw_rup(
 	cam_hw_event_cb_func                     ife_hwr_irq_rup_cb;
 	struct cam_isp_hw_reg_update_event_data  rup_event_data;
 
-	ife_hwr_irq_rup_cb =
-		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_REG_UPDATE];
+	ife_hwr_irq_rup_cb = ife_hw_mgr_ctx->common.event_cb;
 
 	switch (event_info->res_id) {
 	case CAM_ISP_HW_VFE_IN_CAMIF:
@@ -10809,8 +10803,7 @@ static int cam_ife_hw_mgr_handle_hw_epoch(
 	cam_hw_event_cb_func                  ife_hw_irq_epoch_cb;
 	struct cam_isp_hw_epoch_event_data    epoch_done_event_data;
 
-	ife_hw_irq_epoch_cb =
-		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_EPOCH];
+	ife_hw_irq_epoch_cb = ife_hw_mgr_ctx->common.event_cb;
 
 	switch (event_info->res_id) {
 	case CAM_ISP_HW_VFE_IN_CAMIF:
@@ -10855,8 +10848,7 @@ static int cam_ife_hw_mgr_handle_hw_sof(
 
 	memset(&sof_done_event_data, 0, sizeof(sof_done_event_data));
 
-	ife_hw_irq_sof_cb =
-		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_SOF];
+	ife_hw_irq_sof_cb = ife_hw_mgr_ctx->common.event_cb;
 
 	switch (event_info->res_id) {
 	case CAM_ISP_HW_VFE_IN_CAMIF:
@@ -10931,8 +10923,7 @@ static int cam_ife_hw_mgr_handle_hw_eof(
 	cam_hw_event_cb_func                  ife_hw_irq_eof_cb;
 	struct cam_isp_hw_eof_event_data      eof_done_event_data;
 
-	ife_hw_irq_eof_cb =
-		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_EOF];
+	ife_hw_irq_eof_cb = ife_hw_mgr_ctx->common.event_cb;
 
 	switch (event_info->res_id) {
 	case CAM_ISP_HW_VFE_IN_CAMIF:
@@ -11023,8 +11014,7 @@ static int cam_ife_hw_mgr_handle_hw_buf_done(
 	struct cam_isp_hw_event_info        *event_info = evt_info;
 	int32_t                              rc = 0;
 
-	ife_hwr_irq_wm_done_cb =
-		ife_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_DONE];
+	ife_hwr_irq_wm_done_cb = ife_hw_mgr_ctx->common.event_cb;
 
 	buf_done_event_data.num_handles = 1;
 	buf_done_event_data.resource_handle[0] = event_info->res_id;

+ 2 - 2
drivers/cam_isp/isp_hw_mgr/cam_isp_hw_mgr.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  */
 
 #ifndef _CAM_ISP_HW_MGR_H_
@@ -25,7 +25,7 @@
  */
 struct cam_isp_hw_mgr_ctx {
 	void                           *tasklet_info;
-	cam_hw_event_cb_func            event_cb[CAM_ISP_HW_EVENT_MAX];
+	cam_hw_event_cb_func            event_cb;
 	void                           *cb_priv;
 };
 

+ 9 - 17
drivers/cam_isp/isp_hw_mgr/cam_tfe_hw_mgr.c

@@ -664,7 +664,7 @@ static int cam_tfe_hw_mgr_release_hw_for_ctx(
 
 	/* clean up the callback function */
 	tfe_ctx->common.cb_priv = NULL;
-	memset(tfe_ctx->common.event_cb, 0, sizeof(tfe_ctx->common.event_cb));
+	tfe_ctx->common.event_cb = NULL;
 
 	CAM_DBG(CAM_ISP, "release context completed ctx id:%d",
 		tfe_ctx->ctx_index);
@@ -1870,8 +1870,7 @@ static int cam_tfe_mgr_acquire_hw(void *hw_mgr_priv, void *acquire_hw_args)
 	}
 
 	tfe_ctx->common.cb_priv = acquire_args->context_data;
-	for (i = 0; i < CAM_ISP_HW_EVENT_MAX; i++)
-		tfe_ctx->common.event_cb[i] = acquire_args->event_cb;
+	tfe_ctx->common.event_cb = acquire_args->event_cb;
 
 	tfe_ctx->hw_mgr = tfe_hw_mgr;
 
@@ -2108,8 +2107,7 @@ static int cam_tfe_mgr_acquire_dev(void *hw_mgr_priv, void *acquire_hw_args)
 	}
 
 	tfe_ctx->common.cb_priv = acquire_args->context_data;
-	for (i = 0; i < CAM_ISP_HW_EVENT_MAX; i++)
-		tfe_ctx->common.event_cb[i] = acquire_args->event_cb;
+	tfe_ctx->common.event_cb = acquire_args->event_cb;
 
 	tfe_ctx->hw_mgr = tfe_hw_mgr;
 
@@ -5137,7 +5135,6 @@ static int  cam_tfe_hw_mgr_find_affected_ctx(
 	struct cam_tfe_hw_mgr_ctx   *tfe_hwr_mgr_ctx = NULL;
 	cam_hw_event_cb_func         notify_err_cb;
 	struct cam_tfe_hw_mgr       *tfe_hwr_mgr = NULL;
-	enum cam_isp_hw_event_type   event_type = CAM_ISP_HW_EVENT_ERROR;
 	uint32_t i = 0;
 
 	if (!recovery_data) {
@@ -5166,7 +5163,7 @@ static int  cam_tfe_hw_mgr_find_affected_ctx(
 		}
 
 		atomic_set(&tfe_hwr_mgr_ctx->overflow_pending, 1);
-		notify_err_cb = tfe_hwr_mgr_ctx->common.event_cb[event_type];
+		notify_err_cb = tfe_hwr_mgr_ctx->common.event_cb;
 
 		/* Add affected_context in list of recovery data */
 		CAM_DBG(CAM_ISP, "Add affected ctx %d to list",
@@ -5292,8 +5289,7 @@ static int cam_tfe_hw_mgr_handle_hw_rup(
 	cam_hw_event_cb_func                     tfe_hwr_irq_rup_cb;
 	struct cam_isp_hw_reg_update_event_data  rup_event_data;
 
-	tfe_hwr_irq_rup_cb =
-		tfe_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_REG_UPDATE];
+	tfe_hwr_irq_rup_cb = tfe_hw_mgr_ctx->common.event_cb;
 
 	switch (event_info->res_id) {
 	case CAM_ISP_HW_TFE_IN_CAMIF:
@@ -5340,8 +5336,7 @@ static int cam_tfe_hw_mgr_handle_hw_epoch(
 	cam_hw_event_cb_func                  tfe_hw_irq_epoch_cb;
 	struct cam_isp_hw_epoch_event_data    epoch_done_event_data;
 
-	tfe_hw_irq_epoch_cb =
-		tfe_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_EPOCH];
+	tfe_hw_irq_epoch_cb = tfe_hw_mgr_ctx->common.event_cb;
 
 	switch (event_info->res_id) {
 	case CAM_ISP_HW_TFE_IN_CAMIF:
@@ -5377,8 +5372,7 @@ static int cam_tfe_hw_mgr_handle_hw_sof(
 	cam_hw_event_cb_func                  tfe_hw_irq_sof_cb;
 	struct cam_isp_hw_sof_event_data      sof_done_event_data;
 
-	tfe_hw_irq_sof_cb =
-		tfe_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_SOF];
+	tfe_hw_irq_sof_cb = tfe_hw_mgr_ctx->common.event_cb;
 
 	switch (event_info->res_id) {
 	case CAM_ISP_HW_TFE_IN_CAMIF:
@@ -5428,8 +5422,7 @@ static int cam_tfe_hw_mgr_handle_hw_eof(
 	cam_hw_event_cb_func                  tfe_hw_irq_eof_cb;
 	struct cam_isp_hw_eof_event_data      eof_done_event_data;
 
-	tfe_hw_irq_eof_cb =
-		tfe_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_EOF];
+	tfe_hw_irq_eof_cb = tfe_hw_mgr_ctx->common.event_cb;
 
 	switch (event_info->res_id) {
 	case CAM_ISP_HW_TFE_IN_CAMIF:
@@ -5466,8 +5459,7 @@ static int cam_tfe_hw_mgr_handle_hw_buf_done(
 	struct cam_isp_hw_done_event_data    buf_done_event_data = {0};
 	struct cam_isp_hw_event_info        *event_info = evt_info;
 
-	tfe_hwr_irq_wm_done_cb =
-		tfe_hw_mgr_ctx->common.event_cb[CAM_ISP_HW_EVENT_DONE];
+	tfe_hwr_irq_wm_done_cb = tfe_hw_mgr_ctx->common.event_cb;
 
 	buf_done_event_data.num_handles = 1;
 	buf_done_event_data.resource_handle[0] = event_info->res_id;