[PATCH] Including device.h and resource.h header files in linux/amba/bus.h

H Hartley Sweeten hartleys at visionengravers.com
Mon Mar 29 13:16:32 EDT 2010

On Saturday, March 27, 2010 1:57 PM, Linus Walleij wrote:
>> On Sat, Mar 27, 2010 at 2:43 PM, Linus Walleij
>>> On the other hand Documentation/SubmitChecklist contains this:
>>> 1: If you use a facility then #include the file that defines/declares
>>>   that facility.  Don't depend on other header files pulling in ones
>>>   that you use.
>> I agree on the above statement.
>> Again, according to above statement from submitchecklist:
>> shouldn't bus.h include device.h and resource.h, as it is using
>> these facilities.
> Yes I think you're right, looks like it should be applied then!
> Acked-by:

A cleaner solution would be to just add:

struct device;
struct resource;

to the bus.h header.  This will pacify the precompiler.  Then if the
source file actually does need the device of resource facilities you
will get a proper error message during the compile to indicate this.
Adding the #includes to this header means many source files already
in the tree are going to needlessly include the headers twice.

The only reason the include the headers directly in bus.h is if something
(i.e. an inline function) uses the facilities provided by the included
header.  Nothing in bus.h does.


More information about the linux-arm-kernel mailing list