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

This commit is contained in:
qctecmdr 2020-04-26 02:46:25 -07:00 committed by Gerrit - the friendly Code Review server
commit e85bd7e098
2 changed files with 35 additions and 36 deletions

View File

@ -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 */
@ -984,6 +981,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;
@ -1094,7 +1092,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);
}

View File

@ -50,6 +50,7 @@ struct uci_dev {
bool enabled;
u32 tiocm;
void *ipc_log;
enum MHI_DEBUG_LEVEL *ipc_log_lvl;
};
struct mhi_uci_drv {
@ -64,30 +65,26 @@ static enum MHI_DEBUG_LEVEL msg_lvl = MHI_MSG_LVL_ERROR;
#ifdef CONFIG_MHI_DEBUG
#define IPC_LOG_LVL (MHI_MSG_LVL_VERBOSE)
#define MHI_UCI_IPC_LOG_PAGES (25)
#else
#define IPC_LOG_LVL (MHI_MSG_LVL_ERROR)
#define MHI_UCI_IPC_LOG_PAGES (1)
#endif
#ifdef CONFIG_MHI_DEBUG
#define MSG_VERB(fmt, ...) do { \
if (msg_lvl <= MHI_MSG_LVL_VERBOSE) \
printk("%s[D][%s] " fmt, KERN_ERR, __func__, \
##__VA_ARGS__); \
if (IPC_LOG_LVL <= MHI_MSG_LVL_VERBOSE) \
if (uci_dev->ipc_log && uci_dev->ipc_log_lvl && \
(*uci_dev->ipc_log_lvl <= MHI_MSG_LVL_VERBOSE)) \
ipc_log_string(uci_dev->ipc_log, "%s[D][%s] " fmt, \
"", __func__, ##__VA_ARGS__); \
} while (0)
#else
#define MSG_VERB(fmt, ...)
#define MHI_UCI_IPC_LOG_PAGES (1)
#define MSG_VERB(fmt, ...) do { \
if (uci_dev->ipc_log && uci_dev->ipc_log_lvl && \
(*uci_dev->ipc_log_lvl <= MHI_MSG_LVL_VERBOSE)) \
ipc_log_string(uci_dev->ipc_log, "%s[D][%s] " fmt, \
"", __func__, ##__VA_ARGS__); \
} while (0)
#endif
@ -95,7 +92,8 @@ static enum MHI_DEBUG_LEVEL msg_lvl = MHI_MSG_LVL_ERROR;
if (msg_lvl <= MHI_MSG_LVL_INFO) \
printk("%s[I][%s] " fmt, KERN_ERR, __func__, \
##__VA_ARGS__); \
if (IPC_LOG_LVL <= MHI_MSG_LVL_INFO) \
if (uci_dev->ipc_log && uci_dev->ipc_log_lvl && \
(*uci_dev->ipc_log_lvl <= MHI_MSG_LVL_INFO)) \
ipc_log_string(uci_dev->ipc_log, "%s[I][%s] " fmt, \
"", __func__, ##__VA_ARGS__); \
} while (0)
@ -104,7 +102,8 @@ static enum MHI_DEBUG_LEVEL msg_lvl = MHI_MSG_LVL_ERROR;
if (msg_lvl <= MHI_MSG_LVL_ERROR) \
printk("%s[E][%s] " fmt, KERN_ERR, __func__, \
##__VA_ARGS__); \
if (IPC_LOG_LVL <= MHI_MSG_LVL_ERROR) \
if (uci_dev->ipc_log && uci_dev->ipc_log_lvl && \
(*uci_dev->ipc_log_lvl <= MHI_MSG_LVL_ERROR)) \
ipc_log_string(uci_dev->ipc_log, "%s[E][%s] " fmt, \
"", __func__, ##__VA_ARGS__); \
} while (0)
@ -574,6 +573,7 @@ static int mhi_uci_probe(struct mhi_device *mhi_dev,
const struct mhi_device_id *id)
{
struct uci_dev *uci_dev;
struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl;
int minor;
char node_name[32];
int dir;
@ -609,6 +609,7 @@ static int mhi_uci_probe(struct mhi_device *mhi_dev,
mhi_dev->ul_chan_id);
uci_dev->ipc_log = ipc_log_context_create(MHI_UCI_IPC_LOG_PAGES,
node_name, 0);
uci_dev->ipc_log_lvl = &mhi_cntrl->log_lvl;
for (dir = 0; dir < 2; dir++) {
struct uci_chan *uci_chan = (dir) ?