Re: [PATCH v8 3/3] aerdrv: Cleanup log output for AER

Joe Perches
2013-01-02T23:27:42Z

On Wed, 2013-01-02 at 16:27 -0700, Lance Ortiz wrote:
> These changes make cper_print_aer more consistent with aer_print_error
> and clean things up by elimiating the use of the prefix variable and
> replacing it with dev_printk.
[]
> v7-v8 Updated to use dev_printk instated of prefix. Changed
> log levels to KERN_ERR as per Mauro's suggestion

Just use dev_err( instead of dev_printk(KERN_ERR,
It's a function and it makes the object code smaller.

> diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c
[]
> @@ -144,26 +143,24 @@ static void __aer_print_error(const char *prefix,
> aer_uncorrectable_error_string[i] : NULL;
>
> if (errmsg)
> - printk("%s"" [%2d] %-22s%s\n", prefix, i, errmsg,
> + dev_printk(KERN_ERR, &dev->dev,
> + " [%2d] %-22s%s\n", i, errmsg,
> info->first_error == i ? " (First)" : "");
> else
> - printk("%s"" [%2d] Unknown Error Bit%s\n", prefix, i,
> - info->first_error == i ? " (First)" : "");
> + dev_printk(KERN_ERR, &dev->dev,
> + " [%2d] Unknown Error Bit%s\n",
> + i, info->first_error == i ? " (First)" : "");
> }
[]
> if (info->status == 0) {
> - printk("%s""PCIe Bus Error: severity=%s, type=Unaccessible, "
> - "id=%04x(Unregistered Agent ID)\n", prefix,
> + dev_printk(KERN_ERR, &dev->dev,
> + "PCIe Bus Error: severity=%s, type=Unaccessible, "
> + "id=%04x(Unregistered Agent ID)\n",
[]
> @@ -171,22 +168,24 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
[]
> + dev_printk(KERN_ERR, &dev->dev,
> + "PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n",
> + aer_error_severity_string[info->severity],
[]
> + dev_printk(KERN_ERR, &dev->dev,
> + " device [%04x:%04x] error status/mask=%08x/%08x\n",
> + dev->vendor, dev->device,
> info->status, info->mask);
[]
> + dev_printk(KERN_ERR, &dev->dev, " TLP Header:"
> " %02x%02x%02x%02x %02x%02x%02x%02x"
> " %02x%02x%02x%02x %02x%02x%02x%02x\n",
[]
> @@ -195,8 +194,9 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
[]
> + dev_printk(KERN_ERR, &dev->dev,
> + " Error of this Agent(%04x) is reported first\n",
> + id);
[]
> @@ -244,21 +244,21 @@ void cper_print_aer(const char *prefix, struct pci_dev *dev, int cper_severity,
[]
> + dev_printk(KERN_ERR, &dev->dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n",
> + status, mask);
[]
> + dev_printk(KERN_ERR, &dev->dev, "aer_layer=%s, aer_agent=%s\n",
> aer_error_layer[layer], aer_agent_string[agent]);
[]
> + dev_printk(KERN_ERR, &dev->dev, "aer_tlp_header:"