[PATCH 3/6] powerpc/eeh: Reduce lines of log dump

Gavin Shan gwshan at linux.vnet.ibm.com
Wed Jul 16 22:26:53 EST 2014


On Wed, Jul 16, 2014 at 08:30:55AM +0000, David Laight wrote:
>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.
>

Thanks, It looks better. I'll fix.

>> +				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
>

Thanks,
Gavin



More information about the Linuxppc-dev mailing list