[PATCH 3/6] powerpc/eeh: Reduce lines of log dump
David Laight
David.Laight at ACULAB.COM
Wed Jul 16 18:30:55 EST 2014
From: Gavin Shan
> The patch prints 4 PCIE or AER config registers each line, which
> is part of the EEH log so that it looks a bit more compact.
...
> - for (i=0; i<=8; i++) {
> + for (i=0, j=0; i<=8; i++) {
> eeh_ops->read_config(dn, cap+4*i, 4, &cfg);
> n += scnprintf(buf+n, len-n, "%02x:%x\n", 4*i, cfg);
> - pr_warn("EEH: PCI-E %02x: %08x\n", i, cfg);
> +
> + if ((i % 4) == 0) {
> + memset(buffer, 0, sizeof(buffer));
You don't need a memset().
I would add:
if (i != 0)
pr_warn("%s\n", buffer);
and move the other pr_warn() outside the loop.
> + j = scnprintf(buffer, sizeof(buffer),
> + "EEH: PCI-E %02x: %08x ",
> + 4*i, cfg);
> + } else {
> + j += scnprintf(buffer+j, sizeof(buffer)-j,
> + "%08x ", cfg);
> + }
> +
> + if ((i % 4) == 3 || i >= 8)
> + pr_warn("%s\n", buffer);
> }
> }
David
More information about the Linuxppc-dev
mailing list