msm: camera: common: memset usage optimization

Remove unnecessary memsets of the structure variables
whose fields are assigned prior to their usage or they
are dynamically allocated with calls that set the memory
to 0. This memset usage optimization is to improve
performance.

CRs-Fixed: 3228092
Change-Id: Iec68c6d072863627959ce603cff28afd26a1c408
Signed-off-by: Sokchetra Eung <quic_eung@quicinc.com>
Esse commit está contido em:
Sokchetra Eung
2022-06-22 16:10:27 -07:00
commit de Camera Software Integration
commit d2a1f0c968
20 arquivos alterados com 20 adições e 72 exclusões

Ver arquivo

@@ -2406,7 +2406,7 @@ static int __cam_isp_ctx_apply_pending_req(
struct cam_isp_context *ctx_isp = priv;
struct cam_ctx_request *req;
struct cam_isp_ctx_req *req_isp;
struct cam_hw_config_args cfg;
struct cam_hw_config_args cfg = {0};
if (!ctx_isp) {
CAM_ERR(CAM_ISP, "Invalid ctx_isp:%pK", ctx);
@@ -2447,14 +2447,11 @@ static int __cam_isp_ctx_apply_pending_req(
req->request_id, ctx_isp->substate_activated, ctx->ctx_id);
req_isp = (struct cam_isp_ctx_req *) req->req_priv;
memset(&cfg, 0, sizeof(cfg));
cfg.ctxt_to_hw_map = ctx_isp->hw_ctx;
cfg.request_id = req->request_id;
cfg.hw_update_entries = req_isp->cfg;
cfg.num_hw_update_entries = req_isp->num_cfg;
cfg.priv = &req_isp->hw_update_data;
cfg.init_packet = 0;
cfg.priv = &req_isp->hw_update_data;
/*
* Offline mode may receive the SOF and REG_UPD earlier than

Ver arquivo

@@ -9860,8 +9860,6 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
prepare_hw_data = (struct cam_isp_prepare_hw_update_data *) prepare->priv;
memset(&prepare_hw_data->bw_clk_config.bw_config_v2, 0,
sizeof(prepare_hw_data->bw_clk_config.bw_config_v2));
prepare_hw_data->bw_clk_config.bw_config_v2.usage_type = bw_config->usage_type;
prepare_hw_data->bw_clk_config.bw_config_v2.num_paths = bw_config->num_paths;
@@ -9930,8 +9928,7 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
}
prepare_hw_data = (struct cam_isp_prepare_hw_update_data *) prepare->priv;
memset(&prepare_hw_data->bw_clk_config.bw_config_v2, 0,
sizeof(prepare_hw_data->bw_clk_config.bw_config_v2));
prepare_hw_data->bw_clk_config.bw_config_v2.usage_type = bw_config->usage_type;
prepare_hw_data->bw_clk_config.bw_config_v2.num_paths = bw_config->num_paths;
@@ -10837,7 +10834,6 @@ static int cam_isp_sfe_send_scratch_buf_upd(
struct cam_isp_hw_get_wm_update wm_update;
dma_addr_t io_addr[CAM_PACKET_MAX_PLANES];
memset(io_addr, 0, sizeof(io_addr));
update_buf.res = hw_res;
update_buf.cmd_type = cmd_type;
update_buf.cmd.cmd_buf_addr = cpu_addr;
@@ -14755,8 +14751,6 @@ int cam_ife_hw_mgr_init(struct cam_hw_mgr_intf *hw_mgr_intf, int *iommu_hdl)
atomic_set(&g_ife_hw_mgr.active_ctx_cnt, 0);
for (i = 0; i < CAM_IFE_CTX_MAX; i++) {
memset(&g_ife_hw_mgr.ctx_pool[i], 0,
sizeof(g_ife_hw_mgr.ctx_pool[i]));
INIT_LIST_HEAD(&g_ife_hw_mgr.ctx_pool[i].list);
INIT_LIST_HEAD(&g_ife_hw_mgr.ctx_pool[i].res_list_ife_in.list);

Ver arquivo

@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <media/cam_defs.h>
@@ -1758,7 +1759,7 @@ int cam_isp_add_csid_reg_update(
(kmd_buf_info->used_bytes +
reg_update_size);
memset(&rup_args->cmd, 0, sizeof(struct cam_isp_hw_cmd_buf_update));
rup_args->cmd.used_bytes = 0;
rup_args->cmd.cmd_buf_addr = kmd_buf_info->cpu_addr +
kmd_buf_info->used_bytes/4 +
reg_update_size/4;
@@ -1919,7 +1920,6 @@ int cam_isp_get_cmd_buf_count(
((uint8_t *)&prepare->packet->payload +
prepare->packet->cmd_buf_offset);
memset(cmd_buf_count, 0, sizeof(struct cam_isp_cmd_buf_count));
for (i = 0; i < prepare->packet->num_cmd_buf; i++) {
if (!cmd_desc[i].length)
continue;

Ver arquivo

@@ -1134,7 +1134,7 @@ static int cam_ife_csid_ver2_rx_err_bottom_half(
data_idx = csid_hw->rx_cfg.phy_sel -1;
log_buf = csid_hw->log_buf;
memset(log_buf, 0, sizeof(csid_hw->log_buf));
log_buf[0] = '\0';
csid_reg = (struct cam_ife_csid_ver2_reg_info *)
csid_hw->core_info->csid_reg;
@@ -1532,7 +1532,6 @@ static int cam_ife_csid_ver2_parse_path_irq_status(
csid_hw->core_info->csid_reg;
log_buf = csid_hw->log_buf;
memset(log_buf, 0, sizeof(csid_hw->log_buf));
irq_reg_tag = cam_ife_csid_get_irq_reg_tag_ptr();

Ver arquivo

@@ -91,7 +91,6 @@ int cam_ife_csid_init_soc_resources(struct cam_hw_soc_info *soc_info,
goto free_soc_private;
}
memset(&cpas_register_param, 0, sizeof(cpas_register_param));
if (is_custom)
strlcpy(cpas_register_param.identifier, "csid-custom",
CAM_HW_IDENTIFIER_LENGTH);

Ver arquivo

@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/slab.h>
@@ -107,7 +108,6 @@ int cam_sfe_init_soc_resources(struct cam_hw_soc_info *soc_info,
goto free_soc_private;
}
memset(&cpas_register_param, 0, sizeof(cpas_register_param));
strlcpy(cpas_register_param.identifier, "sfe",
CAM_HW_IDENTIFIER_LENGTH);
cpas_register_param.cell_index = soc_info->index;

Ver arquivo

@@ -245,7 +245,6 @@ static void cam_sfe_top_check_module_status(
i, log_buf);
len = 0;
found = false;
memset(log_buf, 0, sizeof(uint8_t)*1024);
}
}
@@ -1944,14 +1943,7 @@ int cam_sfe_top_init(
goto free_top_priv;
}
top_priv->applied_clk_rate = 0;
top_priv->reserve_cnt = 0;
top_priv->start_stop_cnt = 0;
top_priv->priv_per_stream = NULL;
top_priv->event_cb = NULL;
top_priv->num_in_ports = sfe_top_hw_info->num_inputs;
memset(&top_priv->core_cfg, 0x0,
sizeof(struct cam_sfe_core_cfg));
CAM_DBG(CAM_SFE,
"Initializing SFE [%u] top with hw_version: 0x%x",

Ver arquivo

@@ -180,7 +180,6 @@ int cam_vfe_init_soc_resources(struct cam_hw_soc_info *soc_info,
goto free_soc_private;
}
memset(&cpas_register_param, 0, sizeof(cpas_register_param));
strlcpy(cpas_register_param.identifier, "ife",
CAM_HW_IDENTIFIER_LENGTH);
cpas_register_param.cell_index = soc_info->index;

Ver arquivo

@@ -1054,9 +1054,7 @@ static int cam_vfe_bus_ver3_acquire_wm(
{
int32_t wm_idx = 0, rc;
struct cam_vfe_bus_ver3_wm_resource_data *rsrc_data = NULL;
char wm_mode[50];
memset(wm_mode, '\0', sizeof(wm_mode));
char wm_mode[50] = {'\0'};
if (wm_res->res_state != CAM_ISP_RESOURCE_STATE_AVAILABLE) {
CAM_ERR(CAM_ISP, "WM:%d not available state:%d",

Ver arquivo

@@ -446,7 +446,6 @@ static void cam_vfe_top_ver4_print_debug_reg_status(
}
CAM_INFO(CAM_ISP, "VFE[%u]: Top Debug Status: %s", soc_info->index, log_buf);
len = 0;
memset(log_buf, 0, sizeof(uint8_t)*CAM_VFE_LEN_LOG_BUF);
}
cam_vfe_top_ver4_check_module_status(num_reg, reg_val,