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

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to