[Intel-gfx] [DIM PATCH 3/3] dim: loosen some drm-intel checkpatch rules

Jani Nikula jani.nikula at intel.com
Wed Mar 14 09:03:33 UTC 2018

On Tue, 13 Mar 2018, Daniel Vetter <daniel at ffwll.ch> wrote:
> On Tue, Mar 13, 2018 at 01:30:10PM +0200, Jani Nikula wrote:
>> Set max line length to 100. I don't want to silence the LONG_LINE
>> warning altogether, and I'd still prefer to keep lines under 80
>> characters, but I also don't want to see all the noise, and nor do I
>> want to see silly code trying to arbitrarily squeeze under 80 when it
>> doesn't make sense. 100 is a nice arbitrary round number... I hope
>> review catches silly stuff regardless. Fingers crossed.
>> BIT_MACRO. We have (1 << N) all over the place. I hope to switch to
>> BIT() macro eventually, but this documents current use.
>> PREFER_KERNEL_TYPES. We also have uint(8|16|32|64)_t all over the
>> place. I also hope to move towards kernel types, but this documents
>> current use.
>> SPLIT_STRING, LONG_LINE_STRING. Don't nag about strings split to many
>> lines, but also don't nag about strings not split.
>> There's plenty more that could be tweaked, but let's start with
>> something to improve the S/N ratio of the automated CI checkpatch
>> reports. Now that we have --show-types included in the output, we can
>> more easily discuss the ignores on a case-by-case basis.
>> Cc: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
>> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
>> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
>> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
>> ---
>>  dim | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> diff --git a/dim b/dim
>> index 4ba1c7ff490a..9fa6d9cd855b 100755
>> --- a/dim
>> +++ b/dim
>> @@ -1390,7 +1390,7 @@ function checkpatch_commit
>>  			profile_options=""
>>  			;;
>>  		drm-intel)
>> -			profile_options=""
>> +			profile_options="--max-line-length=100 --ignore=BIT_MACRO,PREFER_KERNEL_TYPES,SPLIT_STRING,LONG_LINE_STRING"
> I've scrolled a bit through checkpatch complaines with this, and I think
> it looks a lot more reasonable. There's also a huge pile of stuff that we
> should probably have fixed when the patches landed, so CI'ing this looks
> good.
> Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> Aside: Should we encourage checkpatch patches to clean this up, with the
> note that they must use the drm-intel profile and the caveat that we might
> want to add more stuff to our ignore list instead of taking the patches?

Overall I just think the checkpatch patches crop up enough without
encouragement. IMO let's see how this rolls in CI first and proceed from

The two warnings that I do think would most benefit from mass change are
BIT_MACRO and PREFER_KERNEL_TYPES. People tend to look around them and
cargo cult. A little bit of git grep on the C99 types seems to back this
up; their use multiplies and prospers in some files, while is neglible
in others.


Jani Nikula, Intel Open Source Technology Center

More information about the Intel-gfx mailing list