Skip to content
This repository has been archived by the owner on Dec 28, 2020. It is now read-only.

Commit

Permalink
Revert "treewide: make every ipc_loggings a no-op"
Browse files Browse the repository at this point in the history
This is at best overkill, and at worst completely useless as ipc_logging
functions are inherently no-op'ed when CONFIG_IPC_LOGGING is unset and
optimized out by the compiler.

This reverts commit 008e985.

Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
  • Loading branch information
0ctobot committed Apr 6, 2019
1 parent 3034774 commit 0b3a140
Show file tree
Hide file tree
Showing 34 changed files with 560 additions and 74 deletions.
6 changes: 5 additions & 1 deletion drivers/char/msm_smd_pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ enum {

#ifdef DEBUG

#define SMD_PKT_LOG_STRING(x...) ((void)0)
#define SMD_PKT_LOG_STRING(x...) \
do { \
if (smd_pkt_ilctxt) \
ipc_log_string(smd_pkt_ilctxt, "<SMD_PKT>: "x); \
} while (0)

#define D_STATUS(x...) \
do { \
Expand Down
6 changes: 5 additions & 1 deletion drivers/devfreq/devfreq_spdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ static void *spdm_ipc_log_ctxt;
#define DEVFREQ_SPDM_DEFAULT_WINDOW_MS 100
#define SPDM_IPC_LOG_PAGES 5

#define SPDM_IPC_LOG(x...) ((void)0)
#define SPDM_IPC_LOG(x...) do { \
pr_debug(x); \
if (spdm_ipc_log_ctxt) \
ipc_log_string(spdm_ipc_log_ctxt, x); \
} while (0)

#define COPY_SIZE(x, y) ((x) <= (y) ? (x) : (y))

Expand Down
26 changes: 26 additions & 0 deletions drivers/dma/qcom/gpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,45 @@
#define GPI_LOG(gpi_dev, fmt, ...) do { \
if (gpi_dev->klog_lvl != LOG_LVL_MASK_ALL) \
dev_dbg(gpi_dev->dev, "%s: " fmt, __func__, ##__VA_ARGS__); \
if (gpi_dev->ilctxt && gpi_dev->ipc_log_lvl != LOG_LVL_MASK_ALL) \
ipc_log_string(gpi_dev->ilctxt, \
"%s: " fmt, __func__, ##__VA_ARGS__); \
} while (0)
#define GPI_ERR(gpi_dev, fmt, ...) do { \
if (gpi_dev->klog_lvl >= LOG_LVL_ERROR) \
dev_err(gpi_dev->dev, "%s: " fmt, __func__, ##__VA_ARGS__); \
if (gpi_dev->ilctxt && gpi_dev->ipc_log_lvl >= LOG_LVL_ERROR) \
ipc_log_string(gpi_dev->ilctxt, \
"%s: " fmt, __func__, ##__VA_ARGS__); \
} while (0)

/* gpii specific logging macros */
#define GPII_INFO(gpii, ch, fmt, ...) do { \
if (gpii->klog_lvl >= LOG_LVL_INFO) \
pr_info("%s:%u:%s: " fmt, gpii->label, ch, \
__func__, ##__VA_ARGS__); \
if (gpii->ilctxt && gpii->ipc_log_lvl >= LOG_LVL_INFO) \
ipc_log_string(gpii->ilctxt, \
"ch:%u %s: " fmt, ch, \
__func__, ##__VA_ARGS__); \
} while (0)
#define GPII_ERR(gpii, ch, fmt, ...) do { \
if (gpii->klog_lvl >= LOG_LVL_ERROR) \
pr_err("%s:%u:%s: " fmt, gpii->label, ch, \
__func__, ##__VA_ARGS__); \
if (gpii->ilctxt && gpii->ipc_log_lvl >= LOG_LVL_ERROR) \
ipc_log_string(gpii->ilctxt, \
"ch:%u %s: " fmt, ch, \
__func__, ##__VA_ARGS__); \
} while (0)
#define GPII_CRITIC(gpii, ch, fmt, ...) do { \
if (gpii->klog_lvl >= LOG_LVL_CRITICAL) \
pr_err("%s:%u:%s: " fmt, gpii->label, ch, \
__func__, ##__VA_ARGS__); \
if (gpii->ilctxt && gpii->ipc_log_lvl >= LOG_LVL_CRITICAL) \
ipc_log_string(gpii->ilctxt, \
"ch:%u %s: " fmt, ch, \
__func__, ##__VA_ARGS__); \
} while (0)

enum DEBUG_LOG_LVL {
Expand Down Expand Up @@ -91,11 +109,19 @@ enum EV_PRIORITY {
if (gpii->klog_lvl >= LOG_LVL_REG_ACCESS) \
pr_info("%s:%u:%s: " fmt, gpii->label, \
ch, __func__, ##__VA_ARGS__); \
if (gpii->ilctxt && gpii->ipc_log_lvl >= LOG_LVL_REG_ACCESS) \
ipc_log_string(gpii->ilctxt, \
"ch:%u %s: " fmt, ch, \
__func__, ##__VA_ARGS__); \
} while (0)
#define GPII_VERB(gpii, ch, fmt, ...) do { \
if (gpii->klog_lvl >= LOG_LVL_VERBOSE) \
pr_info("%s:%u:%s: " fmt, gpii->label, \
ch, __func__, ##__VA_ARGS__); \
if (gpii->ilctxt && gpii->ipc_log_lvl >= LOG_LVL_VERBOSE) \
ipc_log_string(gpii->ilctxt, \
"ch:%u %s: " fmt, ch, \
__func__, ##__VA_ARGS__); \
} while (0)

#else
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/wireless/cnss2/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@

extern void *cnss_ipc_log_context;

#define cnss_ipc_log_string(_x...) ((void)0)
#define cnss_ipc_log_string(_x...) do { \
if (cnss_ipc_log_context) \
ipc_log_string(cnss_ipc_log_context, _x); \
} while (0)

#define cnss_pr_err(_fmt, ...) do { \
printk("%scnss: " _fmt, KERN_ERR, ##__VA_ARGS__); \
Expand Down
28 changes: 27 additions & 1 deletion drivers/pci/host/pci-msm.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,31 +235,57 @@
} while (0)

#define PCIE_DBG(dev, fmt, arg...) do { \
if ((dev) && (dev)->ipc_log_long) \
ipc_log_string((dev)->ipc_log_long, \
"DBG1:%s: " fmt, __func__, arg); \
if ((dev) && (dev)->ipc_log) \
ipc_log_string((dev)->ipc_log, "%s: " fmt, __func__, arg); \
if (msm_pcie_debug_mask) \
pr_alert("%s: " fmt, __func__, arg); \
} while (0)

#define PCIE_DBG2(dev, fmt, arg...) do { \
if ((dev) && (dev)->ipc_log) \
ipc_log_string((dev)->ipc_log, "DBG2:%s: " fmt, __func__, arg);\
if (msm_pcie_debug_mask) \
pr_alert("%s: " fmt, __func__, arg); \
} while (0)

#define PCIE_DBG3(dev, fmt, arg...) do { \
if ((dev) && (dev)->ipc_log) \
ipc_log_string((dev)->ipc_log, "DBG3:%s: " fmt, __func__, arg);\
if (msm_pcie_debug_mask) \
pr_alert("%s: " fmt, __func__, arg); \
} while (0)

#define PCIE_DUMP(dev, fmt, arg...) ((void)0)
#define PCIE_DUMP(dev, fmt, arg...) do { \
if ((dev) && (dev)->ipc_log_dump) \
ipc_log_string((dev)->ipc_log_dump, \
"DUMP:%s: " fmt, __func__, arg); \
} while (0)

#define PCIE_DBG_FS(dev, fmt, arg...) do { \
if ((dev) && (dev)->ipc_log_dump) \
ipc_log_string((dev)->ipc_log_dump, \
"DBG_FS:%s: " fmt, __func__, arg); \
pr_alert("%s: " fmt, __func__, arg); \
} while (0)

#define PCIE_INFO(dev, fmt, arg...) do { \
if ((dev) && (dev)->ipc_log_long) \
ipc_log_string((dev)->ipc_log_long, \
"INFO:%s: " fmt, __func__, arg); \
if ((dev) && (dev)->ipc_log) \
ipc_log_string((dev)->ipc_log, "%s: " fmt, __func__, arg); \
pr_info("%s: " fmt, __func__, arg); \
} while (0)

#define PCIE_ERR(dev, fmt, arg...) do { \
if ((dev) && (dev)->ipc_log_long) \
ipc_log_string((dev)->ipc_log_long, \
"ERR:%s: " fmt, __func__, arg); \
if ((dev) && (dev)->ipc_log) \
ipc_log_string((dev)->ipc_log, "%s: " fmt, __func__, arg); \
pr_err("%s: " fmt, __func__, arg); \
} while (0)

Expand Down
21 changes: 21 additions & 0 deletions drivers/platform/msm/ep_pcie/ep_pcie_com.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,27 +181,48 @@
} while (0)

#define EP_PCIE_DBG(dev, fmt, arg...) do { \
if ((dev)->ipc_log_ful) \
ipc_log_string((dev)->ipc_log_ful, "%s: " fmt, __func__, arg); \
if (ep_pcie_get_debug_mask()) \
pr_alert("%s: " fmt, __func__, arg); \
} while (0)

#define EP_PCIE_DBG2(dev, fmt, arg...) do { \
if ((dev)->ipc_log_sel) \
ipc_log_string((dev)->ipc_log_sel, \
"DBG1:%s: " fmt, __func__, arg); \
if ((dev)->ipc_log_ful) \
ipc_log_string((dev)->ipc_log_ful, \
"DBG2:%s: " fmt, __func__, arg); \
if (ep_pcie_get_debug_mask()) \
pr_alert("%s: " fmt, __func__, arg); \
} while (0)

#define EP_PCIE_DBG_FS(fmt, arg...) pr_alert("%s: " fmt, __func__, arg)

#define EP_PCIE_DUMP(dev, fmt, arg...) do { \
if ((dev)->ipc_log_dump) \
ipc_log_string((dev)->ipc_log_dump, \
"DUMP:%s: " fmt, __func__, arg); \
if (ep_pcie_get_debug_mask()) \
pr_alert("%s: " fmt, __func__, arg); \
} while (0)

#define EP_PCIE_INFO(dev, fmt, arg...) do { \
if ((dev)->ipc_log_sel) \
ipc_log_string((dev)->ipc_log_sel, \
"INFO:%s: " fmt, __func__, arg); \
if ((dev)->ipc_log_ful) \
ipc_log_string((dev)->ipc_log_ful, "%s: " fmt, __func__, arg); \
pr_info("%s: " fmt, __func__, arg); \
} while (0)

#define EP_PCIE_ERR(dev, fmt, arg...) do { \
if ((dev)->ipc_log_sel) \
ipc_log_string((dev)->ipc_log_sel, \
"ERR:%s: " fmt, __func__, arg); \
if ((dev)->ipc_log_ful) \
ipc_log_string((dev)->ipc_log_ful, "%s: " fmt, __func__, arg); \
pr_err("%s: " fmt, __func__, arg); \
} while (0)

Expand Down
7 changes: 6 additions & 1 deletion drivers/platform/msm/gsi/gsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@
#define gsi_readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; })
#define gsi_writel(v, c) ({ __iowmb(); writel_relaxed((v), (c)); })

#define GSI_IPC_LOGGING(buf, fmt, args...) ((void)0)
#define GSI_IPC_LOGGING(buf, fmt, args...) \
do { \
if (buf) \
ipc_log_string((buf), fmt, __func__, __LINE__, \
## args); \
} while (0)

#define GSIDBG(fmt, args...) \
do { \
Expand Down
7 changes: 6 additions & 1 deletion drivers/platform/msm/ipa/ipa_common_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,12 @@ struct ipa_hdr_offset_entry {

extern const char *ipa_clients_strings[];

#define IPA_IPC_LOGGING(buf, fmt, args...) ((void)0)
#define IPA_IPC_LOGGING(buf, fmt, args...) \
do { \
if (buf) \
ipc_log_string((buf), fmt, __func__, __LINE__, \
## args); \
} while (0)

void ipa_inc_client_enable_clks(struct ipa_active_client_logging_info *id);
void ipa_dec_client_disable_clks(struct ipa_active_client_logging_info *id);
Expand Down
4 changes: 4 additions & 0 deletions drivers/platform/msm/mhi_dev/mhi.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,10 @@ extern void *mhi_ipc_log;
if (_msg_lvl >= mhi_msg_lvl) { \
pr_err("[%s] "_msg, __func__, ##__VA_ARGS__); \
} \
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__); \
} \
} while (0)


Expand Down
8 changes: 5 additions & 3 deletions drivers/platform/msm/mhi_dev/mhi_dev_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ struct mhi_dev_net_chan_attr {
if (_msg_lvl >= mhi_net_msg_lvl) { \
pr_err("[%s] "_msg, __func__, ##__VA_ARGS__); \
} \
if (mhi_net_ipc_log && (_msg_lvl >= mhi_net_ipc_log_lvl)) { \
ipc_log_string(mhi_net_ipc_log, \
"[%s] " _msg, __func__, ##__VA_ARGS__); \
} \
} while (0)

module_param(mhi_net_msg_lvl, uint, 0644);
Expand Down Expand Up @@ -580,9 +584,7 @@ static int mhi_dev_net_close(void)
}
/* freeing mhi client and IPC context */
kfree(client);
if (mhi_net_ipc_log)
kfree(mhi_net_ipc_log);

kfree(mhi_net_ipc_log);
return 0;
}

Expand Down
4 changes: 4 additions & 0 deletions drivers/platform/msm/mhi_dev/mhi_uci.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ struct mhi_uci_ctxt_t {
if (_msg_lvl >= mhi_uci_msg_lvl) { \
pr_err("[%s] "_msg, __func__, ##__VA_ARGS__); \
} \
if (mhi_uci_ipc_log && (_msg_lvl >= mhi_uci_ipc_log_lvl)) { \
ipc_log_string(mhi_uci_ipc_log, \
"[%s] " _msg, __func__, ##__VA_ARGS__); \
} \
} while (0)


Expand Down
45 changes: 44 additions & 1 deletion drivers/platform/msm/sps/spsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,33 @@ extern u8 logging_option;
extern u8 debug_level_option;
extern u8 print_limit_option;

#define SPS_IPC(idx, dev, msg, args...) do { \
if (dev) { \
if ((idx == 0) && (dev)->ipc_log0) \
ipc_log_string((dev)->ipc_log0, \
"%s: " msg, __func__, args); \
else if ((idx == 1) && (dev)->ipc_log1) \
ipc_log_string((dev)->ipc_log1, \
"%s: " msg, __func__, args); \
else if ((idx == 2) && (dev)->ipc_log2) \
ipc_log_string((dev)->ipc_log2, \
"%s: " msg, __func__, args); \
else if ((idx == 3) && (dev)->ipc_log3) \
ipc_log_string((dev)->ipc_log3, \
"%s: " msg, __func__, args); \
else if ((idx == 4) && (dev)->ipc_log4) \
ipc_log_string((dev)->ipc_log4, \
"%s: " msg, __func__, args); \
else \
pr_debug("sps: no such IPC logging index!\n"); \
} \
} while (0)
#define SPS_DUMP(msg, args...) do { \
pr_info(msg, ##args); \
SPS_IPC(4, sps, msg, args); \
if (sps) { \
if (sps->ipc_log4 == NULL) \
pr_info(msg, ##args); \
} \
} while (0)
#define SPS_ERR(dev, msg, args...) do { \
if (logging_option != 1) { \
Expand All @@ -127,6 +152,7 @@ extern u8 print_limit_option;
else \
pr_err(msg, ##args); \
} \
SPS_IPC(3, dev, msg, args); \
} while (0)
#define SPS_INFO(dev, msg, args...) do { \
if (logging_option != 1) { \
Expand All @@ -135,6 +161,7 @@ extern u8 print_limit_option;
else \
pr_info(msg, ##args); \
} \
SPS_IPC(3, dev, msg, args); \
} while (0)
#define SPS_DBG(dev, msg, args...) do { \
if ((unlikely(logging_option > 1)) \
Expand All @@ -145,6 +172,10 @@ extern u8 print_limit_option;
pr_info(msg, ##args); \
} else \
pr_debug(msg, ##args); \
if (dev) { \
if ((dev)->ipc_loglevel <= 0) \
SPS_IPC(0, dev, msg, args); \
} \
} while (0)
#define SPS_DBG1(dev, msg, args...) do { \
if ((unlikely(logging_option > 1)) \
Expand All @@ -155,6 +186,10 @@ extern u8 print_limit_option;
pr_info(msg, ##args); \
} else \
pr_debug(msg, ##args); \
if (dev) { \
if ((dev)->ipc_loglevel <= 1) \
SPS_IPC(1, dev, msg, args); \
} \
} while (0)
#define SPS_DBG2(dev, msg, args...) do { \
if ((unlikely(logging_option > 1)) \
Expand All @@ -165,6 +200,10 @@ extern u8 print_limit_option;
pr_info(msg, ##args); \
} else \
pr_debug(msg, ##args); \
if (dev) { \
if ((dev)->ipc_loglevel <= 2) \
SPS_IPC(2, dev, msg, args); \
} \
} while (0)
#define SPS_DBG3(dev, msg, args...) do { \
if ((unlikely(logging_option > 1)) \
Expand All @@ -175,6 +214,10 @@ extern u8 print_limit_option;
pr_info(msg, ##args); \
} else \
pr_debug(msg, ##args); \
if (dev) { \
if ((dev)->ipc_loglevel <= 3) \
SPS_IPC(3, dev, msg, args); \
} \
} while (0)
#else
#define SPS_DBG3(x...) pr_debug(x)
Expand Down
Loading

0 comments on commit 0b3a140

Please sign in to comment.