On 7/26/24 1:55 AM, xiaopeitux@xxxxxxxxxxx wrote:
Use min_t to replace min, min_t is a bit fast because min use twice typeof.
Have you measured the difference in compilation speed? Is the difference even measurable? Do we even care about the difference in compilation speed in this case?
And using min_t is cleaner here since the min/max macros do a typecheck while min_t()/max_t() to an explicit type cast.
In other words, this change makes the code WORSE. I prefer no casts over explicit casts because introducing explicit casts makes it impossible for the compiler to perform type checking.
Fixes the below checkpatch warning: WARNING: min() should probably be min_t()
checkpatch is a tool for checking patches and should not be used to check upstream code. Additionally, please fix checkpatch such that it does not complain about the code touched by this patch. The code in checkpatch that recommends to use min_t()/max_t() should only complain about min()/max() calls that have explicit casts. Bart.