|
@@ -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_ */
|