[PATCH v2 5/9] PCI/AER: Prefix dmesg logs with PCIe service name

From: Frederick Lawler
Date: Fri May 03 2019 - 00:01:02 EST


Prefix dmesg logs with PCIe service name.

Signed-off-by: Frederick Lawler <fred@xxxxxxxxxxxx>
---
drivers/pci/pcie/aer.c | 10 +++++++---
drivers/pci/pcie/aer_inject.c | 6 ++++--
2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 82eb45335b6f..e603084b8fc1 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -12,6 +12,9 @@
* Andrew Patterson <andrew.patterson@xxxxxx>
*/

+#define pr_fmt(fmt) "AER: " fmt
+#define dev_fmt pr_fmt
+
#include <linux/cper.h>
#include <linux/pci.h>
#include <linux/pci-acpi.h>
@@ -1377,24 +1380,25 @@ static int aer_probe(struct pcie_device *dev)
int status;
struct aer_rpc *rpc;
struct device *device = &dev->device;
+ struct pci_dev *port = dev->port;

rpc = devm_kzalloc(device, sizeof(struct aer_rpc), GFP_KERNEL);
if (!rpc) {
return -ENOMEM;
}
- rpc->rpd = dev->port;
+ rpc->rpd = port;
set_service_data(dev, rpc);

status = devm_request_threaded_irq(device, dev->irq, aer_irq, aer_isr,
IRQF_SHARED, "aerdrv", dev);
if (status) {
- dev_err(device, "request AER IRQ %d failed\n",
+ pci_err(port, "request AER IRQ %d failed\n",
dev->irq);
return status;
}

aer_enable_rootport(rpc);
- dev_info(device, "AER enabled with IRQ %d\n", dev->irq);
+ pci_info(port, "AER enabled with IRQ %d\n", dev->irq);
return 0;
}

diff --git a/drivers/pci/pcie/aer_inject.c b/drivers/pci/pcie/aer_inject.c
index 95d4759664b3..d4f6d49acd0c 100644
--- a/drivers/pci/pcie/aer_inject.c
+++ b/drivers/pci/pcie/aer_inject.c
@@ -12,6 +12,8 @@
* Huang Ying <ying.huang@xxxxxxxxx>
*/

+#define dev_fmt(fmt) "AER: " fmt
+
#include <linux/module.h>
#include <linux/init.h>
#include <linux/irq.h>
@@ -460,12 +462,12 @@ static int aer_inject(struct aer_error_inj *einj)
if (device) {
edev = to_pcie_device(device);
if (!get_service_data(edev)) {
- dev_warn(&edev->device,
+ pci_warn(edev->port,
"aer_inject: AER service is not initialized\n");
ret = -EPROTONOSUPPORT;
goto out_put;
}
- dev_info(&edev->device,
+ pci_info(edev->port,
"aer_inject: Injecting errors %08x/%08x into device %s\n",
einj->cor_status, einj->uncor_status, pci_name(dev));
local_irq_disable();
--
2.17.1