msm: camera: Add custom ratelimit logs and use for old blob type

Adding custom ratelimited log types and use it in generic blob
handler for isp and icp.

Change-Id: Iec6c94f41506839055c5e0036d2e343849dc12b5
Signed-off-by: Mukund Madhusudan Atre <matre@codeaurora.org>
Signed-off-by: Karthik Anantha Ram <kartanan@codeaurora.org>
This commit is contained in:
Mukund Madhusudan Atre 2019-05-23 07:16:09 -07:00 • committed by Gerrit - the friendly Code Review server
commit c28468e278
3 changed files with 82 additions and 4 deletions

View file

@ -4118,7 +4118,7 @@ static int cam_icp_packet_generic_blob_handler(void *user_data,
switch (blob_type) {
case CAM_ICP_CMD_GENERIC_BLOB_CLK:
CAM_WARN(CAM_ICP,
CAM_WARN_RATE_LIMIT_CUSTOM(CAM_ICP, 300, 1,
"Using deprecated blob type GENERIC_BLOB_CLK");
if (blob_size != sizeof(struct cam_icp_clk_bw_request)) {
CAM_ERR(CAM_ICP, "Mismatch blob size %d expected %lu",

View file

@ -4625,7 +4625,8 @@ static int cam_isp_packet_generic_blob_handler(void *user_data,
struct cam_isp_bw_config *bw_config;
struct cam_isp_prepare_hw_update_data *prepare_hw_data;
CAM_WARN(CAM_ISP, "Deprecated Blob TYPE_BW_CONFIG");
CAM_WARN_RATE_LIMIT_CUSTOM(CAM_ISP, 300, 1,
"Deprecated Blob TYPE_BW_CONFIG");
if (blob_size < sizeof(struct cam_isp_bw_config)) {
CAM_ERR(CAM_ISP, "Invalid blob size %u", blob_size);
return -EINVAL;

View file

@ -1,6 +1,6 @@
/* 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.
*/
#ifndef _CAM_DEBUG_UTIL_H_
@ -109,7 +109,7 @@ const char *cam_get_module_name(unsigned int module_id);
* @args : Arguments which needs to be print in log
*/
#define CAM_INFO_RATE_LIMIT(__module, fmt, args...) \
pr_err_ratelimited("CAM_INFO: %s: %s: %d " fmt "\n", \
pr_info_ratelimited("CAM_INFO: %s: %s: %d " fmt "\n", \
cam_get_module_name(__module), __func__, __LINE__, ##args)
/*
@ -130,5 +130,82 @@ const char *cam_get_module_name(unsigned int module_id);
#define CAM_ERR_RATE_LIMIT(__module, fmt, args...) \
pr_err_ratelimited("CAM_ERR: %s: %s: %d " fmt "\n", \
cam_get_module_name(__module), __func__, __LINE__, ##args)
/*
* CAM_WARN_RATE_LIMIT
* @brief : This Macro will print warning logs with ratelimit
*
* @__module : Respective module id which is been calling this Macro
* @fmt : Formatted string which needs to be print in log
* @args : Arguments which needs to be print in log
*/
#define CAM_WARN_RATE_LIMIT(__module, fmt, args...) \
pr_warn_ratelimited("CAM_WARN: %s: %s: %d " fmt "\n", \
cam_get_module_name(__module), __func__, __LINE__, ##args)
/*
* CAM_WARN_RATE_LIMIT_CUSTOM
* @brief : This Macro will print warn logs with custom ratelimit
*
* @__module : Respective module id which is been calling this Macro
* @interval : Time interval in seconds
* @burst : No of logs to print in interval time
* @fmt : Formatted string which needs to be print in log
* @args : Arguments which needs to be print in log
*/
#define CAM_WARN_RATE_LIMIT_CUSTOM(__module, interval, burst, fmt, args...) \
({ \
static DEFINE_RATELIMIT_STATE(_rs, \
(interval * HZ), \
burst); \
if (__ratelimit(&_rs)) \
pr_warn( \
"CAM_WARN: %s: %s: %d " fmt "\n", \
cam_get_module_name(__module), __func__, \
__LINE__, ##args); \
})
/*
* CAM_INFO_RATE_LIMIT_CUSTOM
* @brief : This Macro will print info logs with custom ratelimit
*
* @__module : Respective module id which is been calling this Macro
* @interval : Time interval in seconds
* @burst : No of logs to print in interval time
* @fmt : Formatted string which needs to be print in log
* @args : Arguments which needs to be print in log
*/
#define CAM_INFO_RATE_LIMIT_CUSTOM(__module, interval, burst, fmt, args...) \
({ \
static DEFINE_RATELIMIT_STATE(_rs, \
(interval * HZ), \
burst); \
if (__ratelimit(&_rs)) \
pr_info( \
"CAM_INFO: %s: %s: %d " fmt "\n", \
cam_get_module_name(__module), __func__, \
__LINE__, ##args); \
})
/*
* CAM_ERR_RATE_LIMIT_CUSTOM
* @brief : This Macro will print error logs with custom ratelimit
*
* @__module : Respective module id which is been calling this Macro
* @interval : Time interval in seconds
* @burst : No of logs to print in interval time
* @fmt : Formatted string which needs to be print in log
* @args : Arguments which needs to be print in log
*/
#define CAM_ERR_RATE_LIMIT_CUSTOM(__module, interval, burst, fmt, args...) \
({ \
static DEFINE_RATELIMIT_STATE(_rs, \
(interval * HZ), \
burst); \
if (__ratelimit(&_rs)) \
pr_err( \
"CAM_ERR: %s: %s: %d " fmt "\n", \
cam_get_module_name(__module), __func__, \
__LINE__, ##args); \
})
#endif /* _CAM_DEBUG_UTIL_H_ */