Commit 91a60edd authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: mhi_dev: Clean up logs in mhi-dev driver"

parents d3723681 455fd0af
This diff is collapsed.
......@@ -673,7 +673,9 @@ enum mhi_msg_level {
extern uint32_t bhi_imgtxdb;
extern enum mhi_msg_level mhi_msg_lvl;
extern enum mhi_msg_level mhi_ipc_msg_lvl;
extern enum mhi_msg_level mhi_ipc_err_msg_lvl;
extern void *mhi_ipc_log;
extern void *mhi_ipc_err_log;
#define mhi_log(_msg_lvl, _msg, ...) do { \
if (_msg_lvl >= mhi_msg_lvl) { \
......@@ -682,7 +684,11 @@ extern void *mhi_ipc_log;
} \
if (mhi_ipc_log && (_msg_lvl >= mhi_ipc_msg_lvl)) { \
ipc_log_string(mhi_ipc_log, \
"[0x%x %s] " _msg, bhi_imgtxdb, __func__, ##__VA_ARGS__); \
"[0x%x %s] " _msg, bhi_imgtxdb, __func__, ##__VA_ARGS__); \
} \
if (mhi_ipc_err_log && (_msg_lvl >= mhi_ipc_err_msg_lvl)) { \
ipc_log_string(mhi_ipc_err_log, \
"[0x%x %s] " _msg, bhi_imgtxdb, __func__, ##__VA_ARGS__); \
} \
} while (0)
......
......@@ -43,7 +43,7 @@ enum mhi_dev_net_dbg_lvl {
MSG_NET_reserved = 0x80000000
};
static enum mhi_dev_net_dbg_lvl mhi_net_msg_lvl = MHI_CRITICAL;
static enum mhi_dev_net_dbg_lvl mhi_net_msg_lvl = MHI_ERROR;
static enum mhi_dev_net_dbg_lvl mhi_net_ipc_log_lvl = MHI_VERBOSE;
static void *mhi_net_ipc_log;
......@@ -144,7 +144,7 @@ static void mhi_dev_net_process_queue_packets(struct work_struct *work)
struct mhi_req *wreq = NULL;
if (mhi_dev_channel_isempty(client->in_handle)) {
mhi_dev_net_log(MHI_INFO, "%s stop network xmmit\n", __func__);
mhi_dev_net_log(MHI_INFO, "stop network xmmit\n");
netif_stop_queue(client->dev);
return;
}
......@@ -176,8 +176,9 @@ static void mhi_dev_net_process_queue_packets(struct work_struct *work)
spin_unlock_irqrestore(&client->wrt_lock, flags);
xfer_data = mhi_dev_write_channel(wreq);
if (xfer_data <= 0) {
pr_err("%s(): Failed to write skb len %d\n",
__func__, skb->len);
mhi_dev_net_log(MHI_ERROR,
"Failed to write skb len %d\n",
skb->len);
kfree_skb(skb);
return;
}
......@@ -186,8 +187,7 @@ static void mhi_dev_net_process_queue_packets(struct work_struct *work)
/* Check if free buffers are available*/
if (mhi_dev_channel_isempty(client->in_handle)) {
mhi_dev_net_log(MHI_INFO,
"%s buffers are full stop xmit\n",
__func__);
"buffers are full stop xmit\n");
netif_stop_queue(client->dev);
break;
}
......@@ -281,7 +281,7 @@ static ssize_t mhi_dev_net_client_read(struct mhi_dev_net_client *mhi_handle)
spin_unlock_irqrestore(&mhi_handle->rd_lock, flags);
skb = alloc_skb(MHI_NET_DEFAULT_MTU, GFP_KERNEL);
if (skb == NULL) {
pr_err("%s(): skb alloc failed\n", __func__);
mhi_dev_net_log(MHI_ERROR, "skb alloc failed\n");
spin_lock_irqsave(&mhi_handle->rd_lock, flags);
list_add_tail(&req->list, &mhi_handle->rx_buffers);
spin_unlock_irqrestore(&mhi_handle->rd_lock, flags);
......@@ -298,7 +298,8 @@ static ssize_t mhi_dev_net_client_read(struct mhi_dev_net_client *mhi_handle)
bytes_avail = mhi_dev_read_channel(req);
if (bytes_avail < 0) {
pr_err("Failed to read chan %d bytes_avail = %d\n",
mhi_dev_net_log(MHI_ERROR,
"Failed to read chan %d bytes_avail = %d\n",
chan, bytes_avail);
spin_lock_irqsave(&mhi_handle->rd_lock, flags);
kfree_skb(skb);
......@@ -473,7 +474,8 @@ static int mhi_dev_net_enable_iface(struct mhi_dev_net_client *mhi_dev_net_ptr)
mhi_dev_net_ether_setup :
mhi_dev_net_rawip_setup);
if (!netdev) {
pr_err("Failed to allocate netdev for mhi_dev_net\n");
mhi_dev_net_log(MHI_ERROR,
"Failed to allocate netdev for mhi_dev_net\n");
goto net_dev_alloc_fail;
}
......@@ -488,7 +490,8 @@ static int mhi_dev_net_enable_iface(struct mhi_dev_net_client *mhi_dev_net_ptr)
*mhi_dev_net_ctxt = mhi_dev_net_ptr;
ret = register_netdev(mhi_dev_net_ptr->dev);
if (ret) {
pr_err("Failed to register mhi_dev_net device\n");
mhi_dev_net_log(MHI_ERROR,
"Failed to register mhi_dev_net device\n");
goto net_dev_reg_fail;
}
mhi_dev_net_log(MHI_INFO, "Successfully registred mhi_dev_net\n");
......@@ -546,12 +549,14 @@ static int mhi_dev_net_open_chan_create_netif(struct mhi_dev_net_client *client)
ret = mhi_dev_net_alloc_read_reqs(client);
if (ret) {
pr_err("failed to allocate rx req buffers\n");
mhi_dev_net_log(MHI_ERROR,
"failed to allocate rx req buffers\n");
goto rx_req_failed;
}
ret = mhi_dev_net_alloc_write_reqs(client);
if (ret) {
pr_err("failed to allocate write req buffers\n");
mhi_dev_net_log(MHI_ERROR,
"failed to allocate write req buffers\n");
goto tx_req_failed;
}
if (atomic_read(&client->tx_enabled)) {
......
......@@ -101,7 +101,7 @@ static int mhi_dev_mmio_mask_set_chdb_int_a7(struct mhi_dev *dev,
chid_idx = chdb_id/32;
if (chid_idx >= MHI_MASK_ROWS_CH_EV_DB) {
pr_err("Invalid channel id:%d\n", chid_idx);
mhi_log(MHI_MSG_ERROR, "Invalid channel id:%d\n", chid_idx);
return -EINVAL;
}
......@@ -633,7 +633,7 @@ int mhi_dev_restore_mmio(struct mhi_dev *dev)
rc = mhi_dev_mmio_write(dev, MHI_CHDB_INT_MASK_A7_n(i),
dev->chdb[i].mask);
if (rc) {
mhi_log(MHI_MSG_VERBOSE,
mhi_log(MHI_MSG_ERROR,
"Error writing enable for A7\n");
return rc;
}
......
......@@ -143,7 +143,7 @@ int mhi_dev_update_wr_offset(struct mhi_dev_ring *ring)
case RING_TYPE_CMD:
rc = mhi_dev_mmio_get_cmd_db(ring, &wr_offset);
if (rc) {
pr_err("%s: CMD DB read failed\n", __func__);
mhi_log(MHI_MSG_ERROR, "CMD DB read failed\n");
return rc;
}
mhi_log(MHI_MSG_VERBOSE,
......@@ -153,14 +153,14 @@ int mhi_dev_update_wr_offset(struct mhi_dev_ring *ring)
case RING_TYPE_ER:
rc = mhi_dev_mmio_get_erc_db(ring, &wr_offset);
if (rc) {
pr_err("%s: EVT DB read failed\n", __func__);
mhi_log(MHI_MSG_ERROR, "EVT DB read failed\n");
return rc;
}
break;
case RING_TYPE_CH:
rc = mhi_dev_mmio_get_ch_db(ring, &wr_offset);
if (rc) {
pr_err("%s: CH DB read failed\n", __func__);
mhi_log(MHI_MSG_ERROR, "CH DB read failed\n");
return rc;
}
mhi_log(MHI_MSG_VERBOSE,
......@@ -237,7 +237,7 @@ int mhi_dev_process_ring(struct mhi_dev_ring *ring)
/* notify the clients that there are elements in the ring */
rc = mhi_dev_process_ring_element(ring, ring->rd_offset);
if (rc)
pr_err("Error fetching elements\n");
mhi_log(MHI_MSG_ERROR, "Error fetching elements\n");
return rc;
}
mhi_log(MHI_MSG_VERBOSE,
......@@ -490,19 +490,6 @@ int mhi_ring_start(struct mhi_dev_ring *ring, union mhi_dev_ring_ctx *ctx,
ring->ring_shadow.device_va = mhi->ctrl_base.device_va + offset;
ring->ring_shadow.host_pa = mhi->ctrl_base.host_pa + offset;
if (ring->type == RING_TYPE_ER)
ring->ring_ctx_shadow =
(union mhi_dev_ring_ctx *) (mhi->ev_ctx_shadow.device_va +
(ring->id - mhi->ev_ring_start) *
sizeof(union mhi_dev_ring_ctx));
else if (ring->type == RING_TYPE_CMD)
ring->ring_ctx_shadow =
(union mhi_dev_ring_ctx *) mhi->cmd_ctx_shadow.device_va;
else if (ring->type == RING_TYPE_CH)
ring->ring_ctx_shadow =
(union mhi_dev_ring_ctx *) (mhi->ch_ctx_shadow.device_va +
(ring->id - mhi->ch_ring_start)*sizeof(union mhi_dev_ring_ctx));
ring->ring_ctx_shadow = ring->ring_ctx;
if (ring->type != RING_TYPE_ER || ring->type != RING_TYPE_CH) {
......@@ -574,7 +561,7 @@ void mhi_ring_set_state(struct mhi_dev_ring *ring,
return;
if (state > RING_STATE_PENDING) {
pr_err("%s: Invalid ring state\n", __func__);
mhi_log(MHI_MSG_ERROR, "Invalid ring state\n");
return;
}
......
......@@ -55,7 +55,7 @@ enum uci_dbg_level {
UCI_DBG_reserved = 0x80000000
};
static enum uci_dbg_level mhi_uci_msg_lvl = UCI_DBG_CRITICAL;
static enum uci_dbg_level mhi_uci_msg_lvl = UCI_DBG_ERROR;
static enum uci_dbg_level mhi_uci_ipc_log_lvl = UCI_DBG_INFO;
static void *mhi_uci_ipc_log;
......@@ -944,7 +944,7 @@ static int mhi_uci_read_sync(struct uci_client *uci_handle, int *bytes_avail)
struct mhi_req ureq;
struct mhi_dev_client *client_handle;
uci_log(UCI_DBG_ERROR,
uci_log(UCI_DBG_INFO,
"Sync read for ch %d\n", uci_handle->in_chan);
client_handle = uci_handle->in_handle;
......@@ -985,8 +985,7 @@ static int open_client_mhi_channels(struct uci_client *uci_client)
int rc = 0;
if (!mhi_uci_are_channels_connected(uci_client)) {
uci_log(UCI_DBG_ERROR, "%s:Channels are not connected\n",
__func__);
uci_log(UCI_DBG_ERROR, "Channels are not connected\n");
return -ENODEV;
}
......@@ -1247,7 +1246,7 @@ static int mhi_state_uevent(struct device *dev, struct kobj_uevent_env *env)
rc = mhi_ctrl_state_info(MHI_DEV_UEVENT_CTRL, &info);
if (rc) {
pr_err("Failed to obtain MHI_STATE\n");
uci_log(UCI_DBG_ERROR, "Failed to obtain MHI_STATE\n");
return -EINVAL;
}
......@@ -1257,12 +1256,13 @@ static int mhi_state_uevent(struct device *dev, struct kobj_uevent_env *env)
for (i = 0; i < ARRAY_SIZE(mhi_chan_attr_table); i++) {
chan_attrib = &mhi_chan_attr_table[i];
if (chan_attrib->state_bcast) {
uci_log(UCI_DBG_ERROR, "Calling notify for ch %d\n",
uci_log(UCI_DBG_INFO, "Calling notify for ch %d\n",
chan_attrib->chan_id);
rc = mhi_ctrl_state_info(chan_attrib->chan_id, &info);
if (rc) {
pr_err("Failed to obtain channel %d state\n",
chan_attrib->chan_id);
uci_log(UCI_DBG_ERROR,
"Failed to obtain channel %d state\n",
chan_attrib->chan_id);
return -EINVAL;
}
nbytes = 0;
......@@ -1307,7 +1307,7 @@ static ssize_t mhi_uci_ctrl_client_read(struct file *file,
"MHI_STATE=DISCONNECTED");
break;
default:
pr_err("invalid info:%d\n", info);
uci_log(UCI_DBG_ERROR, "invalid info:%d\n", info);
return -EINVAL;
}
......@@ -1329,8 +1329,7 @@ static int __mhi_uci_client_read(struct uci_client *uci_handle,
do {
if (!mhi_uci_are_channels_connected(uci_handle)) {
uci_log(UCI_DBG_ERROR,
"%s:Channels are not connected\n", __func__);
uci_log(UCI_DBG_ERROR, "Channels are not connected\n");
return -ENODEV;
}
......@@ -1481,8 +1480,7 @@ static ssize_t mhi_uci_client_write(struct file *file,
}
if (!mhi_uci_are_channels_connected(uci_handle)) {
uci_log(UCI_DBG_ERROR, "%s:Channels are not connected\n",
__func__);
uci_log(UCI_DBG_ERROR, "Channels are not connected\n");
return -ENODEV;
}
......@@ -1541,8 +1539,7 @@ static ssize_t mhi_uci_client_write_iter(struct kiocb *iocb,
}
if (!mhi_uci_are_channels_connected(uci_handle)) {
uci_log(UCI_DBG_ERROR, "%s:Channels are not connected\n",
__func__);
uci_log(UCI_DBG_ERROR, "Channels are not connected\n");
return -ENODEV;
}
......@@ -1651,7 +1648,7 @@ void uci_ctrl_update(struct mhi_dev_client_cb_reason *reason)
if (reason->reason == MHI_DEV_CTRL_UPDATE) {
uci_ctrl_handle = &uci_ctxt.ctrl_handle;
if (!uci_ctrl_handle) {
pr_err("Invalid uci ctrl handle\n");
uci_log(UCI_DBG_ERROR, "Invalid uci ctrl handle\n");
return;
}
......@@ -2254,7 +2251,7 @@ int mhi_uci_init(void)
/* Control node */
uci_ctxt.cdev_ctrl = cdev_alloc();
if (uci_ctxt.cdev_ctrl == NULL) {
pr_err("%s: ctrl cdev alloc failed\n", __func__);
uci_log(UCI_DBG_ERROR, "ctrl cdev alloc failed\n");
return 0;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment