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

Commit c568b803 authored by Yuanyuan Liu's avatar Yuanyuan Liu
Browse files

icnss: Consolidate logging message



Currently the code makes liberal use of macros that print a log message
(with pr_err or pr_debug) and then passes the same string on to the
IPC logging mechanism. The problem is that it doesn't actually end up
being the same string in the binary. Using pr_err or one of its friends
appends the KERN_* code to the front of the string with the pre-processor
and the IPC logger just uses the passed in string. Every string used by
the macros ends up appearing twice in the binary, once with KERN_*
prepended and the other not.

This change fix this duplication issue by appending KERN_* to the front
of the IPC logger.

Change-Id: Ibfdf9edf6e243d13cacf1a45838a88e287a684be
Signed-off-by: default avatarYuanyuan Liu <yuanliu@codeaurora.org>
parent 55c935b0
Loading
Loading
Loading
Loading
+39 −15
Original line number Original line Diff line number Diff line
@@ -84,34 +84,58 @@ module_param(qmi_timeout, ulong, 0600);
	} while (0)
	} while (0)


#define icnss_pr_err(_fmt, ...) do {					\
#define icnss_pr_err(_fmt, ...) do {					\
		pr_err(_fmt, ##__VA_ARGS__);				\
	printk("%s" pr_fmt(_fmt), KERN_ERR, ##__VA_ARGS__);		\
		icnss_ipc_log_string("ERR: " pr_fmt(_fmt),		\
	icnss_ipc_log_string("%s" pr_fmt(_fmt), "",			\
			     ##__VA_ARGS__);				\
			     ##__VA_ARGS__);				\
	} while (0)
	} while (0)


#define icnss_pr_warn(_fmt, ...) do {					\
#define icnss_pr_warn(_fmt, ...) do {					\
		pr_warn(_fmt, ##__VA_ARGS__);				\
	printk("%s" pr_fmt(_fmt), KERN_WARNING, ##__VA_ARGS__);		\
		icnss_ipc_log_string("WRN: " pr_fmt(_fmt),		\
	icnss_ipc_log_string("%s" pr_fmt(_fmt), "",			\
			     ##__VA_ARGS__);				\
			     ##__VA_ARGS__);				\
	} while (0)
	} while (0)


#define icnss_pr_info(_fmt, ...) do {					\
#define icnss_pr_info(_fmt, ...) do {					\
		pr_info(_fmt, ##__VA_ARGS__);				\
	printk("%s" pr_fmt(_fmt), KERN_INFO, ##__VA_ARGS__);		\
		icnss_ipc_log_string("INF: " pr_fmt(_fmt),		\
	icnss_ipc_log_string("%s" pr_fmt(_fmt), "",			\
			     ##__VA_ARGS__);				\
			     ##__VA_ARGS__);				\
	} while (0)
	} while (0)


#if defined(CONFIG_DYNAMIC_DEBUG)
#define icnss_pr_dbg(_fmt, ...) do {					\
#define icnss_pr_dbg(_fmt, ...) do {					\
	pr_debug(_fmt, ##__VA_ARGS__);					\
	pr_debug(_fmt, ##__VA_ARGS__);					\
		icnss_ipc_log_string("DBG: " pr_fmt(_fmt),		\
	icnss_ipc_log_string(pr_fmt(_fmt), ##__VA_ARGS__);		\
				     ##__VA_ARGS__);			\
	} while (0)
	} while (0)


#define icnss_pr_vdbg(_fmt, ...) do {					\
#define icnss_pr_vdbg(_fmt, ...) do {					\
	pr_debug(_fmt, ##__VA_ARGS__);					\
	pr_debug(_fmt, ##__VA_ARGS__);					\
		icnss_ipc_log_long_string("DBG: " pr_fmt(_fmt),		\
	icnss_ipc_log_long_string(pr_fmt(_fmt), ##__VA_ARGS__);		\
	} while (0)
#elif defined(DEBUG)
#define icnss_pr_dbg(_fmt, ...) do {					\
	printk("%s" pr_fmt(_fmt), KERN_DEBUG, ##__VA_ARGS__);		\
	icnss_ipc_log_string("%s" pr_fmt(_fmt), "",			\
			     ##__VA_ARGS__);				\
	} while (0)

#define icnss_pr_vdbg(_fmt, ...) do {					\
	printk("%s" pr_fmt(_fmt), KERN_DEBUG, ##__VA_ARGS__);		\
	icnss_ipc_log_long_string("%s" pr_fmt(_fmt), "",		\
				  ##__VA_ARGS__);			\
	} while (0)
#else
#define icnss_pr_dbg(_fmt, ...) do {					\
	no_printk("%s" pr_fmt(_fmt), KERN_DEBUG, ##__VA_ARGS__);	\
	icnss_ipc_log_string("%s" pr_fmt(_fmt), "",			\
		     ##__VA_ARGS__);					\
	} while (0)

#define icnss_pr_vdbg(_fmt, ...) do {					\
	no_printk("%s" pr_fmt(_fmt), KERN_DEBUG, ##__VA_ARGS__);	\
	icnss_ipc_log_long_string("%s" pr_fmt(_fmt), "",		\
				  ##__VA_ARGS__);			\
				  ##__VA_ARGS__);			\
	} while (0)
	} while (0)
#endif


#ifdef CONFIG_ICNSS_DEBUG
#ifdef CONFIG_ICNSS_DEBUG
#define ICNSS_ASSERT(_condition) do {					\
#define ICNSS_ASSERT(_condition) do {					\