Re: QUERY: Inclusion of header files in kernel header files

From: Stefan Richter
Date: Tue Feb 23 2010 - 09:00:22 EST


Borislav Petkov wrote:
> From: viresh kumar <viresh.linux@xxxxxxxxx>
>> Actually this issue is not present only in bus.h, but some other
>> kernel header files.
>> Like: arch/arm/include/asm/clkdev.h don't include list.h file but
>> using struct list_head
>>
>> May be we need to check this in other header files also.
>
> Well, you should talk to the arm maintainer about that task and whether
> it is desirable.

I agree but feel compelled to add: While each header file should indeed
include everything that is necessary to allow for arbitrary orders of
inclusion of this header,¹ this is sometimes not possible for core
kernel headers or architecture headers.

An example over which I stumbled a few days ago: linux/wait.h cannot
easily include linux/sched.h although it uses definitions from it.
There is a direct circular dependency which can be easily resolved, but
there are also dependencies at deeper levels of indirection which cannot
be easily resolved.

----------
¹) IOW each header should include everything which it uses. OTOH a
user of that header should not rely on having its own dependencies
included indirectly.
--
Stefan Richter
-=====-==-=- --=- =-===
http://arcgraph.de/sr/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/