iwmc3200top: cleanup log messages

1. add TRACE level
2. use TRACE where needed to reduce the noise
3  don't INFOEX from driver
4. add DUMP level for packets dumps
5. use correct context for the log messages

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Tomas Winkler 2009-12-16 04:26:25 +00:00 committed by David S. Miller
parent 9fa4d67c6e
commit 0df828f670
3 changed files with 48 additions and 34 deletions

View file

@ -43,7 +43,7 @@ static int iwmct_fw_parser_init(struct iwmct_priv *priv, const u8 *file,
struct iwmct_parser *parser = &priv->parser; struct iwmct_parser *parser = &priv->parser;
struct iwmct_fw_hdr *fw_hdr = &parser->versions; struct iwmct_fw_hdr *fw_hdr = &parser->versions;
LOG_INFOEX(priv, INIT, "-->\n"); LOG_TRACE(priv, FW_DOWNLOAD, "-->\n");
LOG_INFO(priv, FW_DOWNLOAD, "file_size=%zd\n", file_size); LOG_INFO(priv, FW_DOWNLOAD, "file_size=%zd\n", file_size);
@ -69,7 +69,7 @@ static int iwmct_fw_parser_init(struct iwmct_priv *priv, const u8 *file,
parser->cur_pos += sizeof(struct iwmct_fw_hdr); parser->cur_pos += sizeof(struct iwmct_fw_hdr);
LOG_INFOEX(priv, INIT, "<--\n"); LOG_TRACE(priv, FW_DOWNLOAD, "<--\n");
return 0; return 0;
} }
@ -112,7 +112,7 @@ static int iwmct_parse_next_section(struct iwmct_priv *priv, const u8 **p_sec,
struct iwmct_dbg *dbg = &priv->dbg; struct iwmct_dbg *dbg = &priv->dbg;
struct iwmct_fw_sec_hdr *sec_hdr; struct iwmct_fw_sec_hdr *sec_hdr;
LOG_INFOEX(priv, INIT, "-->\n"); LOG_TRACE(priv, FW_DOWNLOAD, "-->\n");
while (parser->cur_pos + sizeof(struct iwmct_fw_sec_hdr) while (parser->cur_pos + sizeof(struct iwmct_fw_sec_hdr)
<= parser->file_size) { <= parser->file_size) {
@ -151,7 +151,7 @@ static int iwmct_parse_next_section(struct iwmct_priv *priv, const u8 **p_sec,
"finished with section cur_pos=%zd\n", parser->cur_pos); "finished with section cur_pos=%zd\n", parser->cur_pos);
} }
LOG_INFOEX(priv, INIT, "<--\n"); LOG_TRACE(priv, INIT, "<--\n");
return 0; return 0;
} }
@ -166,7 +166,7 @@ static int iwmct_download_section(struct iwmct_priv *priv, const u8 *p_sec,
int ret = 0; int ret = 0;
u32 cmd = 0; u32 cmd = 0;
LOG_INFOEX(priv, INIT, "-->\n"); LOG_TRACE(priv, FW_DOWNLOAD, "-->\n");
LOG_INFO(priv, FW_DOWNLOAD, "Download address 0x%x size 0x%zx\n", LOG_INFO(priv, FW_DOWNLOAD, "Download address 0x%x size 0x%zx\n",
addr, sec_size); addr, sec_size);
@ -250,7 +250,7 @@ static int iwmct_download_section(struct iwmct_priv *priv, const u8 *p_sec,
if (sent < sec_size) if (sent < sec_size)
ret = -EINVAL; ret = -EINVAL;
exit: exit:
LOG_INFOEX(priv, INIT, "<--\n"); LOG_TRACE(priv, FW_DOWNLOAD, "<--\n");
return ret; return ret;
} }
@ -261,7 +261,7 @@ static int iwmct_kick_fw(struct iwmct_priv *priv, bool jump)
int ret; int ret;
u32 cmd; u32 cmd;
LOG_INFOEX(priv, INIT, "-->\n"); LOG_TRACE(priv, FW_DOWNLOAD, "-->\n");
memset(parser->buf, 0, parser->buf_size); memset(parser->buf, 0, parser->buf_size);
cmd = IWMC_CMD_SIGNATURE << CMD_HDR_SIGNATURE_POS; cmd = IWMC_CMD_SIGNATURE << CMD_HDR_SIGNATURE_POS;
@ -284,7 +284,7 @@ static int iwmct_kick_fw(struct iwmct_priv *priv, bool jump)
if (ret) if (ret)
LOG_INFO(priv, FW_DOWNLOAD, "iwmct_tx returned %d", ret); LOG_INFO(priv, FW_DOWNLOAD, "iwmct_tx returned %d", ret);
LOG_INFOEX(priv, INIT, "<--\n"); LOG_TRACE(priv, FW_DOWNLOAD, "<--\n");
return 0; return 0;
} }
@ -298,6 +298,16 @@ int iwmct_fw_load(struct iwmct_priv *priv)
int ret; int ret;
LOG_INFO(priv, FW_DOWNLOAD, "barker download request 0x%x is:\n",
priv->barker);
LOG_INFO(priv, FW_DOWNLOAD, "******* Top FW %s requested ********\n",
(priv->barker & BARKER_DNLOAD_TOP_MSK) ? "was" : "not");
LOG_INFO(priv, FW_DOWNLOAD, "******* GPS FW %s requested ********\n",
(priv->barker & BARKER_DNLOAD_GPS_MSK) ? "was" : "not");
LOG_INFO(priv, FW_DOWNLOAD, "******* BT FW %s requested ********\n",
(priv->barker & BARKER_DNLOAD_BT_MSK) ? "was" : "not");
/* get the firmware */ /* get the firmware */
ret = request_firmware(&raw, fw_name, &priv->func->dev); ret = request_firmware(&raw, fw_name, &priv->func->dev);
if (ret < 0) { if (ret < 0) {

View file

@ -37,13 +37,26 @@
#define LOG_SEV_INFO 3 #define LOG_SEV_INFO 3
#define LOG_SEV_INFOEX 4 #define LOG_SEV_INFOEX 4
#define LOG_SEV_FILTER_ALL \ /* Log levels not defined for FW */
(BIT(LOG_SEV_CRITICAL) | \ #define LOG_SEV_TRACE 5
BIT(LOG_SEV_ERROR) | \ #define LOG_SEV_DUMP 6
BIT(LOG_SEV_WARNING) | \
BIT(LOG_SEV_INFO) | \ #define LOG_SEV_FW_FILTER_ALL \
(BIT(LOG_SEV_CRITICAL) | \
BIT(LOG_SEV_ERROR) | \
BIT(LOG_SEV_WARNING) | \
BIT(LOG_SEV_INFO) | \
BIT(LOG_SEV_INFOEX)) BIT(LOG_SEV_INFOEX))
#define LOG_SEV_FILTER_ALL \
(BIT(LOG_SEV_CRITICAL) | \
BIT(LOG_SEV_ERROR) | \
BIT(LOG_SEV_WARNING) | \
BIT(LOG_SEV_INFO) | \
BIT(LOG_SEV_INFOEX) | \
BIT(LOG_SEV_TRACE) | \
BIT(LOG_SEV_DUMP))
/* log source */ /* log source */
#define LOG_SRC_INIT 0 #define LOG_SRC_INIT 0
#define LOG_SRC_DEBUGFS 1 #define LOG_SRC_DEBUGFS 1
@ -104,16 +117,16 @@ do { \
__func__, __LINE__, ##args); \ __func__, __LINE__, ##args); \
} while (0) } while (0)
#define LOG_INFOEX(priv, src, fmt, args...) \ #define LOG_TRACE(priv, src, fmt, args...) \
do { \ do { \
if (iwmct_logdefs[LOG_SRC_ ## src] & BIT(LOG_SEV_INFOEX)) \ if (iwmct_logdefs[LOG_SRC_ ## src] & BIT(LOG_SEV_TRACE)) \
dev_dbg(priv2dev(priv), "%s %d: " fmt, \ dev_dbg(priv2dev(priv), "%s %d: " fmt, \
__func__, __LINE__, ##args); \ __func__, __LINE__, ##args); \
} while (0) } while (0)
#define LOG_HEXDUMP(src, ptr, len) \ #define LOG_HEXDUMP(src, ptr, len) \
do { \ do { \
if (iwmct_logdefs[LOG_SRC_ ## src] & BIT(LOG_SEV_INFOEX)) \ if (iwmct_logdefs[LOG_SRC_ ## src] & BIT(LOG_SEV_DUMP)) \
print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_NONE, \ print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_NONE, \
16, 1, ptr, len, false); \ 16, 1, ptr, len, false); \
} while (0) } while (0)
@ -142,7 +155,7 @@ ssize_t store_iwmct_log_level_fw(struct device *d,
#define LOG_ERROR(priv, src, fmt, args...) #define LOG_ERROR(priv, src, fmt, args...)
#define LOG_WARNING(priv, src, fmt, args...) #define LOG_WARNING(priv, src, fmt, args...)
#define LOG_INFO(priv, src, fmt, args...) #define LOG_INFO(priv, src, fmt, args...)
#define LOG_INFOEX(priv, src, fmt, args...) #define LOG_TRACE(priv, src, fmt, args...)
#define LOG_HEXDUMP(src, ptr, len) #define LOG_HEXDUMP(src, ptr, len)
static inline void iwmct_log_top_message(struct iwmct_priv *priv, static inline void iwmct_log_top_message(struct iwmct_priv *priv,

View file

@ -66,7 +66,7 @@ static void iwmct_rescan_worker(struct work_struct *ws)
ret = bus_rescan_devices(priv->func->dev.bus); ret = bus_rescan_devices(priv->func->dev.bus);
if (ret < 0) if (ret < 0)
LOG_INFO(priv, FW_DOWNLOAD, "bus_rescan_devices FAILED!!!\n"); LOG_INFO(priv, INIT, "bus_rescan_devices FAILED!!!\n");
} }
static void op_top_message(struct iwmct_priv *priv, struct top_msg *msg) static void op_top_message(struct iwmct_priv *priv, struct top_msg *msg)
@ -137,7 +137,7 @@ int iwmct_send_hcmd(struct iwmct_priv *priv, u8 *cmd, u16 len)
int ret; int ret;
u8 *buf; u8 *buf;
LOG_INFOEX(priv, FW_MSG, "Sending hcmd:\n"); LOG_TRACE(priv, FW_MSG, "Sending hcmd:\n");
/* add padding to 256 for IWMC */ /* add padding to 256 for IWMC */
((struct top_msg *)cmd)->hdr.flags |= CMD_FLAG_PADDING_256; ((struct top_msg *)cmd)->hdr.flags |= CMD_FLAG_PADDING_256;
@ -192,7 +192,7 @@ static void iwmct_irq_read_worker(struct work_struct *ws)
priv = container_of(ws, struct iwmct_priv, isr_worker); priv = container_of(ws, struct iwmct_priv, isr_worker);
LOG_INFO(priv, IRQ, "enter iwmct_irq_read_worker %p\n", ws); LOG_TRACE(priv, IRQ, "enter iwmct_irq_read_worker %p\n", ws);
/* --------------------- Handshake with device -------------------- */ /* --------------------- Handshake with device -------------------- */
sdio_claim_host(priv->func); sdio_claim_host(priv->func);
@ -292,15 +292,6 @@ static void iwmct_irq_read_worker(struct work_struct *ws)
sdio_release_host(priv->func); sdio_release_host(priv->func);
LOG_INFO(priv, IRQ, "barker download request 0x%x is:\n", priv->barker);
LOG_INFO(priv, IRQ, "******* Top FW %s requested ********\n",
(priv->barker & BARKER_DNLOAD_TOP_MSK) ? "was" : "not");
LOG_INFO(priv, IRQ, "******* GPS FW %s requested ********\n",
(priv->barker & BARKER_DNLOAD_GPS_MSK) ? "was" : "not");
LOG_INFO(priv, IRQ, "******* BT FW %s requested ********\n",
(priv->barker & BARKER_DNLOAD_BT_MSK) ? "was" : "not");
if (priv->dbg.fw_download) if (priv->dbg.fw_download)
iwmct_fw_load(priv); iwmct_fw_load(priv);
else else
@ -312,7 +303,7 @@ exit_release:
sdio_release_host(priv->func); sdio_release_host(priv->func);
exit: exit:
kfree(buf); kfree(buf);
LOG_INFO(priv, IRQ, "exit iwmct_irq_read_worker\n"); LOG_TRACE(priv, IRQ, "exit iwmct_irq_read_worker\n");
} }
static void iwmct_irq(struct sdio_func *func) static void iwmct_irq(struct sdio_func *func)
@ -325,12 +316,12 @@ static void iwmct_irq(struct sdio_func *func)
priv = sdio_get_drvdata(func); priv = sdio_get_drvdata(func);
LOG_INFO(priv, IRQ, "enter iwmct_irq\n"); LOG_TRACE(priv, IRQ, "enter iwmct_irq\n");
/* read the function's status register */ /* read the function's status register */
val = sdio_readb(func, IWMC_SDIO_INTR_STATUS_ADDR, &ret); val = sdio_readb(func, IWMC_SDIO_INTR_STATUS_ADDR, &ret);
LOG_INFO(priv, IRQ, "iir value = %d, ret=%d\n", val, ret); LOG_TRACE(priv, IRQ, "iir value = %d, ret=%d\n", val, ret);
if (!val) { if (!val) {
LOG_ERROR(priv, IRQ, "iir = 0, exiting ISR\n"); LOG_ERROR(priv, IRQ, "iir = 0, exiting ISR\n");
@ -372,7 +363,7 @@ static void iwmct_irq(struct sdio_func *func)
queue_work(priv->wq, &priv->isr_worker); queue_work(priv->wq, &priv->isr_worker);
LOG_INFO(priv, IRQ, "exit iwmct_irq\n"); LOG_TRACE(priv, IRQ, "exit iwmct_irq\n");
return; return;
@ -660,7 +651,7 @@ static int __init iwmct_init(void)
/* Default log filter settings */ /* Default log filter settings */
iwmct_log_set_filter(LOG_SRC_ALL, LOG_SEV_FILTER_RUNTIME); iwmct_log_set_filter(LOG_SRC_ALL, LOG_SEV_FILTER_RUNTIME);
iwmct_log_set_filter(LOG_SRC_FW_MSG, LOG_SEV_FILTER_ALL); iwmct_log_set_filter(LOG_SRC_FW_MSG, LOG_SEV_FW_FILTER_ALL);
iwmct_log_set_fw_filter(LOG_SRC_ALL, FW_LOG_SEV_FILTER_RUNTIME); iwmct_log_set_fw_filter(LOG_SRC_ALL, FW_LOG_SEV_FILTER_RUNTIME);
rc = sdio_register_driver(&iwmct_driver); rc = sdio_register_driver(&iwmct_driver);