Re: [PATCH trivial] include/linux/gfp.h: Improve the coding styles

From: Chen Gang
Date: Thu Feb 25 2016 - 17:13:50 EST

On 2/25/16 22:47, Michal Hocko wrote:
>> For the "comment placement" the common way is below, but still make git
>> grep harder:
> if you did git grep ZONE_MOVABLE you would get less information


>> -#define __GFP_MOVABLE ((__force gfp_t)___GFP_MOVABLE) /* ZONE_MOVABLE allowed */
>> +/* ZONE_MOVABLE allowed */
>> +#define __GFP_MOVABLE ((__force gfp_t)___GFP_MOVABLE)
>> Then how about:
>> -#define __GFP_MOVABLE ((__force gfp_t)___GFP_MOVABLE) /* ZONE_MOVABLE allowed */
>> +#define __GFP_MOVABLE \
>> ((__force gfp_t)___GFP_MOVABLE) /* ZONE_MOVABLE allowed */
>> or:
>> -#define __GFP_MOVABLE ((__force gfp_t)___GFP_MOVABLE) /* ZONE_MOVABLE allowed */
>> +#define __GFP_MOVABLE /* ZONE_MOVABLE allowed */ \
>> ((__force gfp_t)___GFP_MOVABLE)
> Now looks worse then other, really. Please try to think what would be
> a benefit of such change. As Mel already pointed out git blame would
> take an additional step to get back to the patch which has introduced
> them. And what is the advantage? Make 80 characters-per-line rule happy?
> I just do not think this is worth changes at all.

For 80 column limitation:

- I often use vsp (vertical split window) in vim to reading code in the
2 files, 80 columns limitation can avoid the line wrap, which will
let code reading better.

- Sometimes we need copy/past the code to a pdf files (e.g. print the
interface header file contents to a new document as appendix), or
print the code to a physical paper (e.g. write a book).

For worth or worthless:

The shared header files (e.g. in our case), have more chances to be
read or printed than the normal source code files. So for me, we need
take more care about the coding styles of them.

For git-blame:

- It really a good feature! Originally, I did not know about it :-).

- Can it instead of sending trivial patch? (I guess not).

Chen Gang (éå)

Managing Natural Environments is the Duty of Human Beings.