Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 536c8d23 authored by Suresh Vankadara's avatar Suresh Vankadara Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: Improves logging infrastructure" into dev/msm-4.14-camx

parents 54824ffd c0f6d996
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -322,7 +322,7 @@ int cam_sync_get_obj_ref(int32_t sync_obj)

	if (row->state != CAM_SYNC_STATE_ACTIVE) {
		spin_unlock(&sync_dev->row_spinlocks[sync_obj]);
		CAM_ERR(CAM_SYNC,
		CAM_ERR_RATE_LIMIT_CUSTOM(CAM_SYNC, 1, 5,
			"accessing an uninitialized sync obj = %d state = %d",
			sync_obj, row->state);
		return -EINVAL;
+43 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -119,6 +119,27 @@ const char *cam_get_module_name(unsigned int module_id);
	pr_err_ratelimited("CAM_INFO: %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_DBG
 * @brief    :  This Macro will print debug logs when enabled using GROUP
@@ -138,4 +159,25 @@ const char *cam_get_module_name(unsigned int module_id);
	pr_err_ratelimited("CAM_ERR: %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_ */