RE: [PATCH v1 3/3] kernel.h: Split out container_of() and typeof_memeber() macros

From: David Laight
Date: Tue Jul 13 2021 - 09:58:35 EST


> The whole idea came when discussing drivers, esp. IIO ones. They often
> are using ARRAY_SIZE() + container_of(). kernel.h is a big overkill
> there.

It probably makes no difference.
Even apparently trivial includes pull in most of the world.

I managed to get a compile error from one of the defines
in sys/ioctl.h - the include sequence the compiler gave
me was about 20 deep.
I've forgotten where it started, but it meandered through
some arch/x86 directories.

I suspect that some files have a #include where just a
'struct foo' would suffice.

There will also be .h files which include both the 'public'
interface and 'private' definitions.
Sometimes splitting those can reduce the number of includes.
This is most noticeable compiling trivial drivers.

The other way to speed up compilations is to reduce the -I
path list to the compiler.
This is particularly significant if compiling over NFS.
(Well NFS might have changed, but...)

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)