Re: [PATCH 1/1] container_of: Document container_of_const() is preferred
From: Andy Shevchenko
Date: Fri Aug 09 2024 - 08:59:55 EST
On Mon, Jun 17, 2024 at 01:08:25PM +0300, Sakari Ailus wrote:
> There is a warning in kerneldoc documentation of container_of() that
> constness of @ptr is lost. While this is a suggestion container_of_const()
> should be used instead, the vast majority of new code still uses
> container_of():
A side note...
> $ git diff v6.8 v6.9|grep container_of\(|wc -l
> 788
> $ git diff v6.8 v6.9|grep container_of_const|wc -l
> 11
This is classic "Useless use of grep".
$ git log --oneline -G 'container_of\(' v6.8..v6.9 | wc -l
296
However, if you really want the _new_ code only, you have to run to `git grep`:
$ git grep -n -w container_of v6.8 | wc
20763
$ git grep -n -w container_of v6.9 | wc
20943
180 new uses.
--
With Best Regards,
Andy Shevchenko