The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Borislav Petkov <bp@alien8.de>
Cc: LKML <linux-kernel@vger.kernel.org>, Borislav Petkov <bp@suse.de>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Lance Ortiz <lance.ortiz@hp.com>, Tony Luck <tony.luck@intel.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH 1/2] PCI, AER: Add a TLP header print helper
Date: Sun, 08 Dec 2013 12:59:37 -0800	[thread overview]
Message-ID: <1386536377.31845.77.camel@joe-AO722> (raw)
In-Reply-To: <1386515571-23252-1-git-send-email-bp@alien8.de>

On Sun, 2013-12-08 at 16:12 +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.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));



  parent reply	other threads:[~2013-12-08 20:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-08 15:12 [PATCH 1/2] PCI, AER: Add a TLP header print helper Borislav Petkov
2013-12-08 15:12 ` [PATCH 2/2] PCI, AER: Clean up error printing code a bit Borislav Petkov
2013-12-08 16:05 ` [PATCH 1/2] PCI, AER: Add a TLP header print helper Joe Perches
2013-12-08 16:13   ` Borislav Petkov
2013-12-08 20:59 ` Joe Perches [this message]
2013-12-16 21:03 ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386536377.31845.77.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=bp@suse.de \
    --cc=lance.ortiz@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tony.luck@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox