[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1386536377.31845.77.camel@joe-AO722>
Date: Sun, 08 Dec 2013 12:59:37 -0800
From: Joe Perches <joe@...ches.com>
To: Borislav Petkov <bp@...en8.de>
Cc: LKML <linux-kernel@...r.kernel.org>, Borislav Petkov <bp@...e.de>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Lance Ortiz <lance.ortiz@...com>,
Tony Luck <tony.luck@...el.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
linux-pci@...r.kernel.org
Subject: Re: [PATCH 1/2] PCI, AER: Add a TLP header print helper
On Sun, 2013-12-08 at 16:12 +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@...e.de>
>
> ... and call it instead of duplicating the large printk format
> statement.
[]
> diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c
[]
> @@ -124,6 +124,21 @@ static const char *aer_agent_string[] = {
> +static void __print_tlp_header(struct pci_dev *dev,
> + struct aer_header_log_regs *t)
> +{
> + unsigned char *tlp = (unsigned char *)&t;
> +
> + dev_err(&dev->dev, " TLP Header:"
> + " %02x%02x%02x%02x %02x%02x%02x%02x"
> + " %02x%02x%02x%02x %02x%02x%02x%02x\n",
> + *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp,
> + *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4),
> + *(tlp + 11), *(tlp + 10), *(tlp + 9),
> + *(tlp + 8), *(tlp + 15), *(tlp + 14),
> + *(tlp + 13), *(tlp + 12));
> +}
Hey again Borislav:
Come to think of it, given this struct:
include/linux/aer.h:struct aer_header_log_regs {
include/linux/aer.h- unsigned int dw0;
include/linux/aer.h- unsigned int dw1;
include/linux/aer.h- unsigned int dw2;
include/linux/aer.h- unsigned int dw3;
include/linux/aer.h-};
this would be a lot more readable as:
static void __print_tlp_header(struct pci_dev *dev,
struct aer_header_log_regs *t)
{
dev_err(&dev->dev, " TLP Header: %08x %08x %08x %08x\n",
tlp->dw0, tlp->dw1, tlp->dw2, tlp->dw3);
}
though if the desire really is to show le output,
maybe these should use:
dev_err(&dev->dev, " TLP Header: %08x %08x %08x %08x\n",
cpu_to_le32(tlp->dw0), cpu_to_le32(tlp->dw1),
cpu_to_le32(tlp->dw2), cpu_to_le32(tlp->dw3));
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists