[PATCH v2 1/2] PCI: Create minor pci_dev log wrapper functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add PCI-specific dev_printk() wrappers so we can do:

  pci_info(dev, "message\n");

instead of

  dev_info(&dev->dev, "message\n");

Signed-off-by: Frederick Lawler <fred@xxxxxxxxxxxx>
Signed-off-by: Bjorn Helgaas <helgaas@xxxxxxxxxx>
---
V2:
* Replace static inline varadic functions with macros instead

 include/linux/pci.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index c170c92..7a5012b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2281,4 +2281,31 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev)
 /* provide the legacy pci_dma_* API */
 #include <linux/pci-dma-compat.h>
 
+#define pci_printk(level, pdev, fmt, arg...)		\
+	dev_printk(level, &(pdev)->dev, fmt, ##arg)
+
+#define pci_emerg(pdev, fmt, arg...)			\
+	dev_emerg(&(pdev)->dev, fmt, ##arg)
+
+#define pci_crit(pdev, fmt, arg...)			\
+	dev_crit(&(pdev)->dev, fmt, ##arg)
+
+#define pci_alert(pdev, fmt, arg...)			\
+	dev_alert(&(pdev)->dev, fmt, ##arg)
+
+#define pci_err(pdev, fmt, arg...)			\
+	dev_err(&(pdev)->dev, fmt, ##arg)
+
+#define pci_notice(pdev, fmt, arg...)			\
+	dev_notice(&(pdev)->dev, fmt, ##arg)
+
+#define pci_warn(pdev, fmt, arg...)			\
+	dev_warn(&(pdev)->dev, fmt, ##arg)
+
+#define pci_info(pdev, fmt, arg...)			\
+	 dev_info(&(pdev)->dev, fmt, ##arg)
+
+#define pci_dbg(pdev, fmt, arg...)			\
+	dev_dbg(&(pdev)->dev, fmt, ##arg)
+
 #endif /* LINUX_PCI_H */
-- 
2.7.4




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux