Message ID | 1452072839-24468-1-git-send-email-clg@fr.ibm.com |
---|---|
State | Superseded |
Headers | show |
Cédric Le Goater <clg@fr.ibm.com> writes: > This patch adds a "BT: " prefix to all logs and replaces a forgotten > printf. > > Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> > --- > hw/bt.c | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) > > Index: skiboot.git/hw/bt.c > =================================================================== > --- skiboot.git.orig/hw/bt.c > +++ skiboot.git/hw/bt.c > @@ -77,15 +77,16 @@ > > #define _BT_Q_LOG(level, msg, fmt, args...) \ > do { if (msg) \ > - prlog(level, "BT seq 0x%02x netfn 0x%02x cmd 0x%02x: " fmt "\n", \ > + prlog(level, "BT: seq 0x%02x netfn 0x%02x cmd 0x%02x: " fmt "\n", \ > (msg)->seq, (msg)->ipmi_msg.netfn, (msg)->ipmi_msg.cmd, ##args); \ > else \ > - prlog(level, "BT seq 0x?? netfn 0x?? cmd 0x??: " fmt "\n", ##args); \ > + prlog(level, "BT: seq 0x?? netfn 0x?? cmd 0x??: " fmt "\n", ##args); \ > } while(0) Instead of that you can just #define pr_fmt(fmt) "BT: " fmt before you #include skiboot.h and it'll do it automagically for you for every prlog in that file. Arguably we should switch from the BT_XXX macros just to calling prlog or teh other prerror functions to aid in grep-ability.
On 01/07/2016 06:55 AM, Stewart Smith wrote: > Cédric Le Goater <clg@fr.ibm.com> writes: > >> This patch adds a "BT: " prefix to all logs and replaces a forgotten >> printf. >> >> Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> >> --- >> hw/bt.c | 23 ++++++++++++----------- >> 1 file changed, 12 insertions(+), 11 deletions(-) >> >> Index: skiboot.git/hw/bt.c >> =================================================================== >> --- skiboot.git.orig/hw/bt.c >> +++ skiboot.git/hw/bt.c >> @@ -77,15 +77,16 @@ >> >> #define _BT_Q_LOG(level, msg, fmt, args...) \ >> do { if (msg) \ >> - prlog(level, "BT seq 0x%02x netfn 0x%02x cmd 0x%02x: " fmt "\n", \ >> + prlog(level, "BT: seq 0x%02x netfn 0x%02x cmd 0x%02x: " fmt "\n", \ >> (msg)->seq, (msg)->ipmi_msg.netfn, (msg)->ipmi_msg.cmd, ##args); \ >> else \ >> - prlog(level, "BT seq 0x?? netfn 0x?? cmd 0x??: " fmt "\n", ##args); \ >> + prlog(level, "BT: seq 0x?? netfn 0x?? cmd 0x??: " fmt "\n", ##args); \ >> } while(0) > > Instead of that you can just > #define pr_fmt(fmt) "BT: " fmt > > before you #include skiboot.h and it'll do it automagically for you for > every prlog in that file. OK. I see. > Arguably we should switch from the BT_XXX macros just to calling prlog > or teh other prerror functions to aid in grep-ability. Yes. I will change the patch and resend. Thanks, C.
Index: skiboot.git/hw/bt.c =================================================================== --- skiboot.git.orig/hw/bt.c +++ skiboot.git/hw/bt.c @@ -77,15 +77,16 @@ #define _BT_Q_LOG(level, msg, fmt, args...) \ do { if (msg) \ - prlog(level, "BT seq 0x%02x netfn 0x%02x cmd 0x%02x: " fmt "\n", \ + prlog(level, "BT: seq 0x%02x netfn 0x%02x cmd 0x%02x: " fmt "\n", \ (msg)->seq, (msg)->ipmi_msg.netfn, (msg)->ipmi_msg.cmd, ##args); \ else \ - prlog(level, "BT seq 0x?? netfn 0x?? cmd 0x??: " fmt "\n", ##args); \ + prlog(level, "BT: seq 0x?? netfn 0x?? cmd 0x??: " fmt "\n", ##args); \ } while(0) -#define BT_ERR(fmt, args...) prlog(PR_ERR, fmt, ##args) -#define BT_DBG(fmt, args...) prlog(PR_DEBUG, fmt, ##args) -#define BT_INF(fmt, args...) prlog(PR_INFO, fmt, ##args) +#define BT_ERR(fmt, args...) prlog(PR_ERR, "BT: " fmt, ##args) +#define BT_DBG(fmt, args...) prlog(PR_DEBUG, "BT: " fmt, ##args) +#define BT_INF(fmt, args...) prlog(PR_INFO, "BT: " fmt, ##args) +#define BT_NOTICE(fmt, args...) prlog(PR_NOTICE, "BT: " fmt, ##args) /* * takes a struct bt_msg * @@ -344,8 +345,8 @@ static void bt_get_resp(void) } if (!bt_msg) { /* A response to a message we no longer care about. */ - BT_INF("BT: Nobody cared about a response to an BT/IPMI message" - "(seq 0x%02x netfn 0x%02x cmd 0x%02x)", seq, netfn, cmd); + BT_INF("Nobody cared about a response to an BT/IPMI message" + "(seq 0x%02x netfn 0x%02x cmd 0x%02x)\n", seq, netfn, cmd); bt_flush_msg(); return; } @@ -638,11 +639,11 @@ void bt_init(void) /* Get IO base */ prop = dt_find_property(n, "reg"); if (!prop) { - BT_ERR("BT: Can't find reg property\n"); + BT_ERR("Can't find reg property\n"); return; } if (dt_property_get_cell(prop, 0) != OPAL_LPC_IO) { - BT_ERR("BT: Only supports IO addresses\n"); + BT_ERR("Only supports IO addresses\n"); return; } bt.base_addr = dt_property_get_cell(prop, 1); @@ -658,7 +659,7 @@ void bt_init(void) list_head_init(&bt.msgq); bt.queue_len = 0; - printf("BT: Interface initialized, IO 0x%04x\n", bt.base_addr); + BT_NOTICE("Interface initialized, IO 0x%04x\n", bt.base_addr); ipmi_register_backend(&bt_backend); @@ -675,5 +676,5 @@ void bt_init(void) /* Enqueue an IPMI message to ask the BMC about its BT capabilities */ get_bt_caps(); - BT_DBG("BT: Using LPC IRQ %d\n", irq); + BT_DBG("Using LPC IRQ %d\n", irq); }
This patch adds a "BT: " prefix to all logs and replaces a forgotten printf. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> --- hw/bt.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)