diff mbox series

[v2,1/5] pci: Move logging macros to pci.h

Message ID 1532967631-9679-2-git-send-email-arbab@linux.ibm.com
State Superseded
Headers show
Series npu2: Add support for relaxed-ordering mode | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied

Commit Message

Reza Arbab July 30, 2018, 4:20 p.m. UTC
Move the PCI{TRACE,DBG,NOTICE,ERR} logging macros from pci.c to pci.h so
they can be used in other files.

Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Reviewed-by: Alistair Popple <alistair@popple.id.au>
---
 core/pci.c    | 21 ---------------------
 include/pci.h | 21 +++++++++++++++++++++
 2 files changed, 21 insertions(+), 21 deletions(-)

Comments

Stewart Smith July 31, 2018, 3:23 a.m. UTC | #1
Reza Arbab <arbab@linux.ibm.com> writes:
> Move the PCI{TRACE,DBG,NOTICE,ERR} logging macros from pci.c to pci.h so
> they can be used in other files.
>
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
> Reviewed-by: Alistair Popple <alistair@popple.id.au>

I'm increasingly looking longingly at Oliver's patch that adds custom
printf specifiers that we could use for things like this... it'd
certainly make 'prlog' and 'prerror' more greppable rather than each
subsystem having their own #defines.

Thoughts?

(this isn't a nack or anything, just a point for discussion/future
cleanup)
diff mbox series

Patch

diff --git a/core/pci.c b/core/pci.c
index 109459b..6ba6eda 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -29,27 +29,6 @@ 
 static struct phb *phbs[MAX_PHB_ID];
 int last_phb_id = 0;
 
-#define PCITRACE(_p, _bdfn, fmt, a...) \
-	prlog(PR_TRACE, "PHB#%04x:%02x:%02x.%x " fmt,	\
-	      (_p)->opal_id,				\
-	      ((_bdfn) >> 8) & 0xff,			\
-	      ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a)
-#define PCIDBG(_p, _bdfn, fmt, a...) \
-	prlog(PR_DEBUG, "PHB#%04x:%02x:%02x.%x " fmt,	\
-	      (_p)->opal_id,				\
-	      ((_bdfn) >> 8) & 0xff,			\
-	      ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a)
-#define PCINOTICE(_p, _bdfn, fmt, a...) \
-	prlog(PR_NOTICE, "PHB#%04x:%02x:%02x.%x " fmt,	\
-	      (_p)->opal_id,				\
-	      ((_bdfn) >> 8) & 0xff,			\
-	      ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a)
-#define PCIERR(_p, _bdfn, fmt, a...) \
-	prlog(PR_ERR, "PHB#%04x:%02x:%02x.%x " fmt,	\
-	      (_p)->opal_id,				\
-	      ((_bdfn) >> 8) & 0xff,			\
-	      ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a)
-
 /*
  * Generic PCI utilities
  */
diff --git a/include/pci.h b/include/pci.h
index 253dbd8..c6aa664 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -23,6 +23,27 @@ 
 #include <bitmap.h>
 #include <ccan/list/list.h>
 
+#define PCITRACE(_p, _bdfn, fmt, a...) \
+	prlog(PR_TRACE, "PHB#%04x:%02x:%02x.%x " fmt,	\
+	      (_p)->opal_id,				\
+	      ((_bdfn) >> 8) & 0xff,			\
+	      ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a)
+#define PCIDBG(_p, _bdfn, fmt, a...) \
+	prlog(PR_DEBUG, "PHB#%04x:%02x:%02x.%x " fmt,	\
+	      (_p)->opal_id,				\
+	      ((_bdfn) >> 8) & 0xff,			\
+	      ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a)
+#define PCINOTICE(_p, _bdfn, fmt, a...) \
+	prlog(PR_NOTICE, "PHB#%04x:%02x:%02x.%x " fmt,	\
+	      (_p)->opal_id,				\
+	      ((_bdfn) >> 8) & 0xff,			\
+	      ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a)
+#define PCIERR(_p, _bdfn, fmt, a...) \
+	prlog(PR_ERR, "PHB#%04x:%02x:%02x.%x " fmt,	\
+	      (_p)->opal_id,				\
+	      ((_bdfn) >> 8) & 0xff,			\
+	      ((_bdfn) >> 3) & 0x1f, (_bdfn) & 0x7, ## a)
+
 struct pci_device;
 struct pci_cfg_reg_filter;