On Mon, Jun 30, 2025 at 10:19 PM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote: > > On Mon, Jun 30, 2025 at 02:02:25PM -0400, Robert P. J. Day wrote: > > > > As promised, I have the first small number of kernel cleanup scripts > > that should inspire some obvious janitorial work: > > > > https://crashcourse.ca/doku/doku.php?id=linux_kernel_cleanup > > > > There will be more scripts coming, and a lot of them will address some > > rather obvious cleanup that relates to identifying leftover cruft that > > was overlooked when something was removed from the kernel -- things > > like: > > > > - are there things being #defined and never referenced? > > Quite often people publish these deliberately. They sort of function > as documentation. At one company every time they expose anything > about the hardware interface it has to be approved by the legal dept > so they publish every single define that they can possibly think of > as early as possible so they don't have to go back and forth with > legal later on. > > > - are there things defined in Kconfig files that are never used, > > or vice versa? > > Lukas Bulwahn does a lot of this work already. It will be interesting > to see if there is anything his scripts miss. > The script I use is in the kernel repository at scripts/checkkconfigsymbol.py. I have not written the script, though. I know its shortcomings, and I would have written it differently but I have not spent time improving anything in that script above. Instead, when I started, I used some kind of bash filtering on the output. Then, I also have a collected list of known false positives, as I sent out patches and got responses from developers and maintainers on the mailing list. And finally, I currently often only look at the diff between two runs on linux-next. On my short list concerning Kconfig clean-up: There are several directories named configs in arch/. They contain parts of config files, specific for some hardware, but these files seem to be not reduced to the essential content of relevance, though. Now, to make things worse, it seems that when changes to Kconfig symbols, nobody touches those files, and nobody really maintains them later on either. At the moment, this adds up to 55,000 LoC in the repository, and I am pretty sure---once it is understood---what each single file is really intended for, this can be reduced to probably around 1,000 LoC or even less. This may also be picked up by others if they are looking for work. Lukas