Re: [PATCH v2 1/2] crypto: qat - refactor included headers

From: Andy Shevchenko
Date: Thu Aug 31 2023 - 09:26:43 EST


On Thu, Aug 31, 2023 at 11:55:52AM +0800, Herbert Xu wrote:
> On Tue, Aug 29, 2023 at 05:08:37PM +0300, Andy Shevchenko wrote:
> >
> > Do I understand correctly that you want *ideally* to have THE kernel.h
> > as a _single_ header and that's it?
>
> My rule of thumb for a .c file is that if you need more than two
> headers directly included by kernel.h then you should just use
> kernel.h.
>
> > While I understand your motivation as a maintainer, I hate the idea of current
> > kernel.h to be included as a silver bullet to every file because people are not
> > capable to understand this C language part of design. The usage of the proper
> > headers show that developer _thought_ very well about what they are doing in
> > the driver. Neglecting this affects the quality of the code in my opinion.
> > That's why I strongly recommend to avoid kernel.h inclusion unless it's indeed
> > the one that provides something that is used in the driver. Even though, the
> > rest headers also need to be included (as it wasn't done by kernel.h at any
> > circumstances).
>
> I have no qualms with fixing header files that include kernel.h
> to include whatever it is that they need directly. That is a
> worthy goal and should be enforced for all new header files.
>
> I just don't share your enthusiasm about doing the same for .c
> files.

I see, thanks for clarifying this. While you are right about *.c files that
it's not so critical for them, the kernel.h use is still a burden everywhere
in the kernel (at least in the current form). That's why I prefer to exclude
it from *.c-files as well. This will reduce amount of work in the future in
case we will be capable to clean up the crap from kernel.h and make it sane.

--
With Best Regards,
Andy Shevchenko