msm: camera: common: Reduce data section size with logging optimized

Current logic of logging passes the strings as arguments to
logging Macros. This converts them into string literals and
increase the data section size.
This commit changes the logic to convert the tags into
strings inside a function, thus optimizing the data section size.
Top level estimations shows the reduction of 1.5MB .ko size.

CRs-Fixed: 3470008
Change-Id: Ifcd5bedc374e8c5f36b8c0be5ae050959b432666
Signed-off-by: Gaurav Jindal <quic_gjindal@quicinc.com>
This commit is contained in:
Gaurav Jindal
2023-03-27 14:53:56 +05:30
committed by Camera Software Integration
parent 9b3cea0734
commit 42108eab32
2 changed files with 29 additions and 14 deletions

View File

@@ -1,7 +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.
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/io.h>
@@ -259,10 +259,11 @@ void cam_print_to_buffer(char *buf, const size_t buf_size, size_t *len, unsigned
va_end(args);
}
static void __cam_print_log(int type, const char *fmt, va_list args)
static void __cam_print_log(int type, const char *fmt, ...)
{
va_list args1, args2;
va_list args1, args2, args;
va_start(args, fmt);
va_copy(args1, args);
va_copy(args2, args1);
if ((type & CAM_PRINT_LOG) && (debug_type != 1))
@@ -273,16 +274,24 @@ static void __cam_print_log(int type, const char *fmt, va_list args)
}
va_end(args2);
va_end(args1);
va_end(args);
}
void cam_print_log(int type, const char *fmt, ...)
void cam_print_log(int type, int module, int tag, const char *func,
int line, const char *fmt, ...)
{
char buf[CAM_LOG_BUF_LEN] = {0,};
int len = 0;
va_list args;
if (!type)
return;
va_start(args, fmt);
__cam_print_log(type, fmt, args);
len = vscnprintf(buf, CAM_LOG_BUF_LEN, fmt, args);
__cam_print_log(type, __CAM_LOG_FMT,
CAM_LOG_TAG_NAME(tag), CAM_DBG_MOD_NAME(module), func,
line, buf);
va_end(args);
}