Messages in this thread | | | Date | Tue, 23 Feb 2010 10:50:25 +0100 | From | Borislav Petkov <> | Subject | Re: QUERY: Inclusion of header files in kernel header files |
| |
From: viresh kumar <viresh.linux@gmail.com> Date: Tue, Feb 23, 2010 at 01:01:25PM +0530
> >> Again, if i include device.h and resource.h, they must be included before bus.h. > > > > and this is the thing: all those other files which include > > <linux/amba/bus.h> either include <linux/device.h> and > > <linux/resource.h> directly or the last are being included indirectly > > through other headers. > > > > Baseline, struct device and struct resource's definitions have to be > > available before <linux/amba/bus.h> is included. That's why you have to > > include the bus.h header last. > > > > We need to include device.h and resource.h at every place where we use bus.h. > > Shouldn't it be responsibility of bus.h only? So that people don't > have to bother about bus.h > internal dependencies.
A quick grep in <include/linux/> reveals that most, if not all, of the headers that use struct resource, for example, include ioport.h which contains the definition. So yes, it should be like this, besides we guard against multiple inclusion with the #ifndef ..., #define... #endif thing anyway.
> I think, ideally including any header file shouldn't give compilation > errors for types used in > included header file.
Agreed.
I'd send a patch fixing the bus.h header, in case no one has a valid technical reason against it.
-- Regards/Gruss, Boris.
| |