Quoting Andy Shevchenko (2024-02-28 17:17:12) > On Wed, Feb 28, 2024 at 2:03 PM sakari.ailus@xxxxxxxxxxxxxxx > <sakari.ailus@xxxxxxxxxxxxxxx> wrote: > > On Wed, Feb 28, 2024 at 11:22:13AM +0200, Andy Shevchenko wrote: > > > > Another, I also reviewed some other sensor driver code(such as > > > > gc0a08/gc2145 and imx/ov), they are all the same. > > > > > > They are also problematic. So what? > > > > The situation is the same in a large number of drivers, also outside the > > media tree. It's also not trivial to figure out which header should be > > included and it tends to be that if it compiles without warnings, > > developers won't bother trying to figure out what should still be changed. > > I spent about 20 minutes reading the code. Yes, for inexperienced > developers it can take 3x longer, but still, much longer time was > spent on writing that code to begin with. So, the headers are a part > of the evolution of the code. And now it's pure technical debt with no > excuses to not fulfill. > > TL;DR: It's (rightfully) assumed that the developer *knows* their code. > > > I wonder if this could be automated by using the C preprocessor and a > > small Perl script. :-) > > There is a Google project coming from Clang people or so, but I have > no idea of the state of affairs. I've used iwyu (include-what-you-use) successfully on libcamera. But I don't know how this would translate to working on the kernel, with a more complex build system. But indeed, tooling already exists [0] to do these checks, and is packaged in distros [1] [0] https://include-what-you-use.org/ [1] https://manpages.ubuntu.com/manpages/focal/man1/iwyu_tool.1.html -- Kieran > > > -- > With Best Regards, > Andy Shevchenko