[lkml]   [2010]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: QUERY: Inclusion of header files in kernel header files
From: viresh kumar <>
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.


I'd send a patch fixing the bus.h header, in case no one has a valid
technical reason against it.


 \ /
  Last update: 2010-02-23 10:59    [W:0.036 / U:7.624 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site