Re: [PATCH v2 3/5] treewide: Consolidate {get,put}_unaligned_[bl]e24() definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 13, 2020 at 07:54:49AM -0700, Bart Van Assche wrote:
> On 2020-03-13 02:15, Andy Shevchenko wrote:
> > On Thu, Mar 12, 2020 at 07:37:16PM -0700, Bart Van Assche wrote:
> >> +static inline void __put_unaligned_be24(u32 val, u8 *p)
> > 
> > 	const u32 val
> 
> Hi Andy,
> 
> Thanks for the review. The above suggestion surprises me: as far as I
> can tell almost nobody declares function arguments that are passed by
> value as 'const' in the Linux kernel:
> 
> $ git grep -nH '(const[^\*,]*,' | wc -l
>    1065
> 
> That number is negligible compared to the number of function declarations:
> 
> $ git grep -nH '(.*);$' | wc -l
> 2692721

It's a surprising "argument".
If 100500 do worse it doesn't mean 3000 shouldn't do it better.
And of course first grep is incomplete and second one too broad.

Just for (generic) headers:

$ git grep -n '[a-z_0-9]([^)]*\bconst [^)]\+)' -- include | wc -l
4342

$ git grep -n '[a-z_0-9]([^)]\+)' -- include | wc -l
69672

~6% in headers. I don't think it's negligible.

You have at least two advantages on this:
a) we really don't modify the content of the input value;
b) it will be consistent with the rest of consolidated helpers.

-- 
With Best Regards,
Andy Shevchenko





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux