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

Commit 0ddedbe5 authored by Bhaumik Bhatt's avatar Bhaumik Bhatt Committed by Hemant Kumar
Browse files

mhi: dev: netdev: inherit IPC log level from controller



Make network interface devices inherit log levels from the
controller to allow level switches to reflect across MHI
clients.

Change-Id: I2412a738ba297031740d10570478c42f83b45c25
Signed-off-by: default avatarBhaumik Bhatt <bbhatt@codeaurora.org>
parent db949d93
Loading
Loading
Loading
Loading
+19 −21
Original line number Diff line number Diff line
@@ -24,42 +24,33 @@

#ifdef CONFIG_MHI_DEBUG

#define IPC_LOG_LVL (MHI_MSG_LVL_VERBOSE)

#define MHI_ASSERT(cond, msg) do { \
	if (cond) \
		panic(msg); \
} while (0)

#define MSG_VERB(fmt, ...) do { \
	if (mhi_netdev->msg_lvl <= MHI_MSG_LVL_VERBOSE) \
		printk("%s[D][%s] " fmt, KERN_ERR, __func__, \
				##__VA_ARGS__); \
	if (mhi_netdev->ipc_log_lvl <= MHI_MSG_LVL_VERBOSE) \
	if (mhi_netdev->ipc_log && (*mhi_netdev->ipc_log_lvl <= \
				    MHI_MSG_LVL_VERBOSE)) \
		ipc_log_string(mhi_netdev->ipc_log, "%s[D][%s] " fmt, \
				"", __func__, ##__VA_ARGS__); \
} while (0)

#else

#define IPC_LOG_LVL (MHI_MSG_LVL_ERROR)

#define MHI_ASSERT(cond, msg) do { \
	if (cond) { \
		MSG_ERR(msg); \
		WARN_ON(cond); \
	} \
#define MSG_VERB(fmt, ...) do { \
	if (mhi_netdev->ipc_log && (*mhi_netdev->ipc_log_lvl <= \
				    MHI_MSG_LVL_VERBOSE)) \
		ipc_log_string(mhi_netdev->ipc_log, "%s[D][%s] " fmt, \
			      "",  __func__, ##__VA_ARGS__); \
} while (0)

#define MSG_VERB(fmt, ...)

#endif

#define MSG_LOG(fmt, ...) do { \
	if (mhi_netdev->msg_lvl <= MHI_MSG_LVL_INFO) \
		printk("%s[I][%s] " fmt, KERN_ERR, __func__, \
				##__VA_ARGS__); \
	if (mhi_netdev->ipc_log_lvl <= MHI_MSG_LVL_INFO) \
	if (mhi_netdev->ipc_log && (*mhi_netdev->ipc_log_lvl <= \
				    MHI_MSG_LVL_INFO)) \
		ipc_log_string(mhi_netdev->ipc_log, "%s[D][%s] " fmt, \
				"", __func__, ##__VA_ARGS__); \
} while (0)
@@ -68,11 +59,17 @@
	if (mhi_netdev->msg_lvl <= MHI_MSG_LVL_ERROR) \
		printk("%s[E][%s] " fmt, KERN_ERR, __func__, \
				##__VA_ARGS__); \
	if (mhi_netdev->ipc_log_lvl <= MHI_MSG_LVL_ERROR) \
	if (mhi_netdev->ipc_log && (*mhi_netdev->ipc_log_lvl <= \
				    MHI_MSG_LVL_ERROR)) \
		ipc_log_string(mhi_netdev->ipc_log, "%s[E][%s] " fmt, \
				"", __func__, ##__VA_ARGS__); \
} while (0)

#define MHI_ASSERT(cond, msg) do { \
	if (cond) \
		panic(msg); \
} while (0)

struct mhi_net_chain {
	struct sk_buff *head, *tail; /* chained skb */
};
@@ -106,7 +103,7 @@ struct mhi_netdev {

	struct dentry *dentry;
	enum MHI_DEBUG_LEVEL msg_lvl;
	enum MHI_DEBUG_LEVEL ipc_log_lvl;
	enum MHI_DEBUG_LEVEL *ipc_log_lvl;
	void *ipc_log;

	/* debug stats */
@@ -978,6 +975,7 @@ static int mhi_netdev_probe(struct mhi_device *mhi_dev,
	int ret;
	struct mhi_netdev *mhi_netdev, *p_netdev = NULL;
	struct device_node *of_node = mhi_dev->dev.of_node;
	struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl;
	int nr_tre;
	char node_name[32];
	struct device_node *phandle;
@@ -1088,7 +1086,7 @@ static int mhi_netdev_probe(struct mhi_device *mhi_dev,
			 mhi_netdev->alias);
		mhi_netdev->ipc_log = ipc_log_context_create(IPC_LOG_PAGES,
							     node_name, 0);
		mhi_netdev->ipc_log_lvl = IPC_LOG_LVL;
		mhi_netdev->ipc_log_lvl = &mhi_cntrl->log_lvl;

		mhi_netdev_create_debugfs(mhi_netdev);
	}