mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 15:41:36 +00:00
PCI/AER: Log messages with pci_dev, not pcie_device
Log messages with pci_dev, not pcie_device. Factor out common message prefixes with dev_fmt(). Example output change: - aer 0000:00:00.0:pci002: AER enabled with IRQ ... + pcieport 0000:00:00.0: AER: enabled with IRQ ... Link: https://lore.kernel.org/lkml/20190509141456.223614-5-helgaas@kernel.org Signed-off-by: Frederick Lawler <fred@fredlawl.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Keith Busch <keith.busch@intel.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
This commit is contained in:
parent
10a9990c10
commit
9cc6f75b27
@ -12,6 +12,9 @@
|
|||||||
* Andrew Patterson <andrew.patterson@hp.com>
|
* Andrew Patterson <andrew.patterson@hp.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define pr_fmt(fmt) "AER: " fmt
|
||||||
|
#define dev_fmt pr_fmt
|
||||||
|
|
||||||
#include <linux/cper.h>
|
#include <linux/cper.h>
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
#include <linux/pci-acpi.h>
|
#include <linux/pci-acpi.h>
|
||||||
@ -779,10 +782,11 @@ static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info)
|
|||||||
u8 bus = info->id >> 8;
|
u8 bus = info->id >> 8;
|
||||||
u8 devfn = info->id & 0xff;
|
u8 devfn = info->id & 0xff;
|
||||||
|
|
||||||
pci_info(dev, "AER: %s%s error received: %04x:%02x:%02x.%d\n",
|
pci_info(dev, "%s%s error received: %04x:%02x:%02x.%d\n",
|
||||||
info->multi_error_valid ? "Multiple " : "",
|
info->multi_error_valid ? "Multiple " : "",
|
||||||
aer_error_severity_string[info->severity],
|
aer_error_severity_string[info->severity],
|
||||||
pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
|
pci_domain_nr(dev->bus), bus, PCI_SLOT(devfn),
|
||||||
|
PCI_FUNC(devfn));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI_APEI_PCIEAER
|
#ifdef CONFIG_ACPI_APEI_PCIEAER
|
||||||
@ -1376,23 +1380,24 @@ static int aer_probe(struct pcie_device *dev)
|
|||||||
int status;
|
int status;
|
||||||
struct aer_rpc *rpc;
|
struct aer_rpc *rpc;
|
||||||
struct device *device = &dev->device;
|
struct device *device = &dev->device;
|
||||||
|
struct pci_dev *port = dev->port;
|
||||||
|
|
||||||
rpc = devm_kzalloc(device, sizeof(struct aer_rpc), GFP_KERNEL);
|
rpc = devm_kzalloc(device, sizeof(struct aer_rpc), GFP_KERNEL);
|
||||||
if (!rpc)
|
if (!rpc)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
rpc->rpd = dev->port;
|
rpc->rpd = port;
|
||||||
set_service_data(dev, rpc);
|
set_service_data(dev, rpc);
|
||||||
|
|
||||||
status = devm_request_threaded_irq(device, dev->irq, aer_irq, aer_isr,
|
status = devm_request_threaded_irq(device, dev->irq, aer_irq, aer_isr,
|
||||||
IRQF_SHARED, "aerdrv", dev);
|
IRQF_SHARED, "aerdrv", dev);
|
||||||
if (status) {
|
if (status) {
|
||||||
dev_err(device, "request AER IRQ %d failed\n", dev->irq);
|
pci_err(port, "request AER IRQ %d failed\n", dev->irq);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
aer_enable_rootport(rpc);
|
aer_enable_rootport(rpc);
|
||||||
dev_info(device, "AER enabled with IRQ %d\n", dev->irq);
|
pci_info(port, "enabled with IRQ %d\n", dev->irq);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
* Huang Ying <ying.huang@intel.com>
|
* Huang Ying <ying.huang@intel.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define dev_fmt(fmt) "aer_inject: " fmt
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
@ -332,14 +334,14 @@ static int aer_inject(struct aer_error_inj *einj)
|
|||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
rpdev = pcie_find_root_port(dev);
|
rpdev = pcie_find_root_port(dev);
|
||||||
if (!rpdev) {
|
if (!rpdev) {
|
||||||
pci_err(dev, "aer_inject: Root port not found\n");
|
pci_err(dev, "Root port not found\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
goto out_put;
|
goto out_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos_cap_err = dev->aer_cap;
|
pos_cap_err = dev->aer_cap;
|
||||||
if (!pos_cap_err) {
|
if (!pos_cap_err) {
|
||||||
pci_err(dev, "aer_inject: Device doesn't support AER\n");
|
pci_err(dev, "Device doesn't support AER\n");
|
||||||
ret = -EPROTONOSUPPORT;
|
ret = -EPROTONOSUPPORT;
|
||||||
goto out_put;
|
goto out_put;
|
||||||
}
|
}
|
||||||
@ -350,7 +352,7 @@ static int aer_inject(struct aer_error_inj *einj)
|
|||||||
|
|
||||||
rp_pos_cap_err = rpdev->aer_cap;
|
rp_pos_cap_err = rpdev->aer_cap;
|
||||||
if (!rp_pos_cap_err) {
|
if (!rp_pos_cap_err) {
|
||||||
pci_err(rpdev, "aer_inject: Root port doesn't support AER\n");
|
pci_err(rpdev, "Root port doesn't support AER\n");
|
||||||
ret = -EPROTONOSUPPORT;
|
ret = -EPROTONOSUPPORT;
|
||||||
goto out_put;
|
goto out_put;
|
||||||
}
|
}
|
||||||
@ -398,14 +400,14 @@ static int aer_inject(struct aer_error_inj *einj)
|
|||||||
if (!aer_mask_override && einj->cor_status &&
|
if (!aer_mask_override && einj->cor_status &&
|
||||||
!(einj->cor_status & ~cor_mask)) {
|
!(einj->cor_status & ~cor_mask)) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
pci_warn(dev, "aer_inject: The correctable error(s) is masked by device\n");
|
pci_warn(dev, "The correctable error(s) is masked by device\n");
|
||||||
spin_unlock_irqrestore(&inject_lock, flags);
|
spin_unlock_irqrestore(&inject_lock, flags);
|
||||||
goto out_put;
|
goto out_put;
|
||||||
}
|
}
|
||||||
if (!aer_mask_override && einj->uncor_status &&
|
if (!aer_mask_override && einj->uncor_status &&
|
||||||
!(einj->uncor_status & ~uncor_mask)) {
|
!(einj->uncor_status & ~uncor_mask)) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
pci_warn(dev, "aer_inject: The uncorrectable error(s) is masked by device\n");
|
pci_warn(dev, "The uncorrectable error(s) is masked by device\n");
|
||||||
spin_unlock_irqrestore(&inject_lock, flags);
|
spin_unlock_irqrestore(&inject_lock, flags);
|
||||||
goto out_put;
|
goto out_put;
|
||||||
}
|
}
|
||||||
@ -460,19 +462,17 @@ static int aer_inject(struct aer_error_inj *einj)
|
|||||||
if (device) {
|
if (device) {
|
||||||
edev = to_pcie_device(device);
|
edev = to_pcie_device(device);
|
||||||
if (!get_service_data(edev)) {
|
if (!get_service_data(edev)) {
|
||||||
dev_warn(&edev->device,
|
pci_warn(edev->port, "AER service is not initialized\n");
|
||||||
"aer_inject: AER service is not initialized\n");
|
|
||||||
ret = -EPROTONOSUPPORT;
|
ret = -EPROTONOSUPPORT;
|
||||||
goto out_put;
|
goto out_put;
|
||||||
}
|
}
|
||||||
dev_info(&edev->device,
|
pci_info(edev->port, "Injecting errors %08x/%08x into device %s\n",
|
||||||
"aer_inject: Injecting errors %08x/%08x into device %s\n",
|
|
||||||
einj->cor_status, einj->uncor_status, pci_name(dev));
|
einj->cor_status, einj->uncor_status, pci_name(dev));
|
||||||
local_irq_disable();
|
local_irq_disable();
|
||||||
generic_handle_irq(edev->irq);
|
generic_handle_irq(edev->irq);
|
||||||
local_irq_enable();
|
local_irq_enable();
|
||||||
} else {
|
} else {
|
||||||
pci_err(rpdev, "aer_inject: AER device not found\n");
|
pci_err(rpdev, "AER device not found\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
}
|
}
|
||||||
out_put:
|
out_put:
|
||||||
|
Loading…
Reference in New Issue
Block a user