Ping-Ke Shih wrote: > Kalle Valo <kvalo@xxxxxxxxxx> wrote: > > I noticed by random that rtl8xxxu includes linux/wireless.h even though it > > doesn't need it. While investigating a bit more I found even more unused > > include files: > > > > #include <linux/init.h> > > #include <linux/sched.h> > > #include <linux/ethtool.h> > > > > It looks like that the includes are just copied to every file without checking > > if the file really needs the include. So more includes could be removed but > > that would need more careful analysis per each file. > > I can do that. My ways will be to create an empty (new) C file to examine > every driver's header file can be included individually, and then try-and-error > to remove includes from existing C files. I made a patch [1] followed above ways based on these two patches. > > However, this driver uses #ifdef. I will check if autoconf.h is included. Make script of kernel will automatically include include/linux/kconfig.h, so I didn't need extra works for #ifdef. [1] https://lore.kernel.org/linux-wireless/20240429024711.30992-1-pkshih@xxxxxxxxxxx/T/#u