diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2014-07-31 14:29:51 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-08-08 16:07:26 +1000 |
commit | 6150a663a5e6d26ec89413186cd7468d621e0bc5 (patch) | |
tree | 641f1552888aabb05e8db09b4fd06c785128f26b /hw | |
parent | 09e08414c6ac42837428f4b046afcec82cf5a197 (diff) | |
download | talos-skiboot-6150a663a5e6d26ec89413186cd7468d621e0bc5.tar.gz talos-skiboot-6150a663a5e6d26ec89413186cd7468d621e0bc5.zip |
Use small macros for PHB debug/log messages
Save stack space, remove code and improve logging all in one handy patch.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/p5ioc2-phb.c | 23 | ||||
-rw-r--r-- | hw/p7ioc-phb.c | 24 | ||||
-rw-r--r-- | hw/phb3.c | 26 |
3 files changed, 14 insertions, 59 deletions
diff --git a/hw/p5ioc2-phb.c b/hw/p5ioc2-phb.c index b52fe44b..0dcf0cea 100644 --- a/hw/p5ioc2-phb.c +++ b/hw/p5ioc2-phb.c @@ -25,25 +25,10 @@ #include <interrupts.h> #include <ccan/str/str.h> -static void p5ioc2_phb_trace(struct p5ioc2_phb *p, FILE *s, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); - -static void p5ioc2_phb_trace(struct p5ioc2_phb *p, FILE *s, const char *fmt, ...) -{ - /* Use a temp stack buffer to print all at once to avoid - * mixups of a trace entry on SMP - */ - char tbuf[128 + 10]; - va_list args; - char *b = tbuf; - - b += sprintf(b, "PHB%d: ", p->phb.opal_id); - va_start(args, fmt); - vsnprintf(b, 128, fmt, args); - va_end(args); - fputs(tbuf, s); -} -#define PHBDBG(p, fmt...) p5ioc2_phb_trace(p, stdout, fmt) -#define PHBERR(p, fmt...) p5ioc2_phb_trace(p, stderr, fmt) +#define PHBDBG(p, fmt, a...) prlog(PR_DEBUG, "PHB%d: " fmt, \ + (p)->phb.opal_id, ## a) +#define PHBERR(p, fmt, a...) prlog(PR_ERR, "PHB%d: " fmt, \ + (p)->phb.opal_id, ## a) /* Helper to set the state machine timeout */ static inline uint64_t p5ioc2_set_sm_timeout(struct p5ioc2_phb *p, uint64_t dur) diff --git a/hw/p7ioc-phb.c b/hw/p7ioc-phb.c index 834a7941..fd2ebd6e 100644 --- a/hw/p7ioc-phb.c +++ b/hw/p7ioc-phb.c @@ -26,26 +26,10 @@ #include <opal.h> #include <ccan/str/str.h> -static void p7ioc_phb_trace(struct p7ioc_phb *p, FILE *s, const char *fmt, ...) -__attribute__ ((format (printf, 3, 4))); - -static void p7ioc_phb_trace(struct p7ioc_phb *p, FILE *s, const char *fmt, ...) -{ - /* Use a temp stack buffer to print all at once to avoid - * mixups of a trace entry on SMP - */ - char tbuf[128 + 10]; - va_list args; - char *b = tbuf; - - b += sprintf(b, "PHB%d: ", p->phb.opal_id); - va_start(args, fmt); - vsnprintf(b, 128, fmt, args); - va_end(args); - fputs(tbuf, s); -} -#define PHBDBG(p, fmt...) p7ioc_phb_trace(p, stdout, fmt) -#define PHBERR(p, fmt...) p7ioc_phb_trace(p, stderr, fmt) +#define PHBDBG(p, fmt, a...) prlog(PR_DEBUG, "PHB%d: " fmt, \ + (p)->phb.opal_id, ## a) +#define PHBERR(p, fmt, a...) prlog(PR_ERR, "PHB%d: " fmt, \ + (p)->phb.opal_id, ## a) /* Helper to select an IODA table entry */ static inline void p7ioc_phb_ioda_sel(struct p7ioc_phb *p, uint32_t table, @@ -51,26 +51,12 @@ static void phb3_init_hw(struct phb3 *p); -static void phb3_trace(struct phb3 *p, FILE *s, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); - -static void phb3_trace(struct phb3 *p, FILE *s, const char *fmt, ...) -{ - /* Use a temp stack buffer to print all at once to avoid - * mixups of a trace entry on SMP - */ - char tbuf[128 + 10]; - va_list args; - char *b = tbuf; - - b += sprintf(b, "PHB%d: ", p->phb.opal_id); - va_start(args, fmt); - vsnprintf(b, 128, fmt, args); - va_end(args); - fputs(tbuf, s); -} -#define PHBDBG(p, fmt...) phb3_trace(p, stdout, fmt) -#define PHBINF(p, fmt...) phb3_trace(p, stderr, fmt) -#define PHBERR(p, fmt...) phb3_trace(p, stderr, fmt) +#define PHBDBG(p, fmt, a...) prlog(PR_DEBUG, "PHB%d: " fmt, \ + (p)->phb.opal_id, ## a) +#define PHBINF(p, fmt, a...) prlog(PR_INFO, "PHB%d: " fmt, \ + (p)->phb.opal_id, ## a) +#define PHBERR(p, fmt, a...) prlog(PR_ERR, "PHB%d: " fmt, \ + (p)->phb.opal_id, ## a) /* * Lock callbacks. Allows the OPAL API handlers to lock the |