Re: [PATCH EDACv16 1/2] edac: Change internal representation to workwith layers

From: Mauro Carvalho Chehab
Date: Sun Apr 29 2012 - 12:20:36 EST


Em 29-04-2012 12:11, Mauro Carvalho Chehab escreveu:
> Em 29-04-2012 11:25, Mauro Carvalho Chehab escreveu:
>> Em 28-04-2012 05:52, Borislav Petkov escreveu:
>>> you simply need to remove the __func__ argument in your newly added debug call:
>>>
>>> debugf2("%s: %d: dimm%zd (%d:%d:%d): row %d, chan %d\n", __func__,
>>> i, (dimm - mci->dimms),
>>> pos[0], pos[1], pos[2], row, chn);
>>>
>>> And while you're at it, remove the rest of the __func__ arguments from
>>> your newly added debugfX calls.
>>
>> A single patch fixing this everywhere at drivers/edac is better and clearer than adding
>> an unrelated fix on this patch. This is already complex enough to add more unrelated
>> things there.
>>
>> Also, a simple perl/coccinelle script can replace all such __func__ occurrences
>> on one shot.
>
> Most of the issues can be solved with the above script-based patch.
>
> There are still 171 places (12 places at the core, the rest are on the drivers)
> that will require a more sophisticated patch or that requires a manual fix.
>
> -
>
> From: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
> Date: Sun, 29 Apr 2012 11:59:14 -0300
> Subject: [PATCH] edac: Don't add __func__ or __FILE__ for debugf[0-9] msgs
>
> The debug macro already adds that. Made by this small script:
>
> $f .=$_ while (<>);
>
> $f =~ s/(debugf[0-9]\s*\(\s*)__FILE__\s*": /\1"/g;
> $f =~ s/(debugf[0-9]\s*\(\s*)__FILE__\s*/\1/g;
> $f =~ s/(debugf[0-9]\s*\(\s*)__FILE__\s*"MC: /\1"/g;
> $f =~ s/(debugf[0-9]\s*\(\")\%s[\:\,\(\)]*\s*(\s*[^\)]+)__func__\s*\,\s*/\1\2/g;
> $f =~ s/(debugf[0-9]\s*\(\")\%s[\:\,\(\)]*\s*(\s*[^\)]+),\s*__func__\s*\)/\1\2)/g;
>
> $f =~ s/(debugf[0-9]\s*\(\"MC\:\s*)\%s[\:\,\(\)]*\s*(\s*[^\)]+)__func__\s*\,\s*/\1\2/g;
> $f =~ s/(debugf[0-9]\s*\(\"MC\:\s*)\%s[\:\,\(\)]*\s*(\s*[^\)]+),\s*__func__\s*\)/\1\2)/g;
>
> print $f;

The script below is even better. After that, only 113 occurrences of __func__
is now found at drivers/edac, and some of them are not related to debugf[1-9],
so they shouldn't be cover on a patch like that.

I'll do some manual cleanup on it.