Including device.h and resource.h header files in linux/amba/bus.h
Subsystems (2)
PATCH 1/1 Including device.h and resource.h header files in linux/amba/bus.h
linux/amba/bus.h have dependencies on linux/device.h and linux/resource.h, but it doesn't include them. We get compilation errors in our files which include bus.h but doesn't include device.h and resource.h. This patch includes device.h and resource.h in linux/amba/bus.h file.
--- include/linux/amba/bus.h | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
include/linux/amba/bus.h +3 -0
@@ -14,6 +14,9 @@#ifndef ASMARM_AMBA_H #define ASMARM_AMBA_H +#include <linux/device.h> +#include <linux/resource.h> +#define AMBA_NR_IRQS 2 struct amba_device {
Signature · 1 line
1.6.0.2
PATCH 1/1 removing compilation warning comming from clkdev.h
clkdev.h is using struct device *. Due to this compilation warning is comming. Removing this warning.
--- arch/arm/include/asm/clkdev.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/include/asm/clkdev.h +1 -0
@@ -13,6 +13,7 @@#define __ASM_CLKDEV_Hstruct clk ; +struct device ;struct clk_lookup {struct list_head node;
Signature · 1 line
1.6.0.2
PATCH 1/1 removing compilation warning comming from clkdev.h
Quoted 2 lines · Viresh KUMAR
clkdev.his using struct device *. Due to this compilation warning is comming. Removing this warning.
Ok.
PATCH 1/1 Including device.h and resource.h header files in linux/amba/bus.h
In reply to Viresh KUMAR2010/3/25 Viresh KUMAR <[email protected]>:
Quoted 4 lines
linux/amba/bus.hhave dependencies onlinux/device.handlinux/resource.h, but it doesn't include them. We get compilation errors in our files which includebus.hbut doesn't includedevice.handresource.h. This patch includesdevice.handresource.hinlinux/amba/bus.hfile.
The customs of the kernel is to not #include .h files into each other so much, the reason being that this easily goes out of hand. Instead #include device.h and resource.h into your sourcefile above the amba/bus.h inclusion.
Yours,
Linus Walleij
PATCH 1/1 Including device.h and resource.h header files in linux/amba/bus.h
Quoted 7 lines · Linus Walleij
2010/3/25 Viresh KUMAR <[email protected]>:
Quoted 4 lines
linux/amba/bus.hhave dependencies onlinux/device.handlinux/resource.h, but it doesn't include them. We get compilation errors in our files which includebus.hbut doesn't includedevice.handresource.h. This patch includesdevice.handresource.hinlinux/amba/bus.hfile.
Quoted 5 lines
The customs of the kernel is to not #include .h files into each other so much, the reason being that this easily goes out of hand. Instead #include
device.handresource.hinto your sourcefile above theamba/bus.hinclusion.
Some time back i have initiated a thread regarding this type of issues. You can find them here:
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-February/010258.html
And my understanding after the discussion was:
It is the responsibility of a header files, using types definitions from outside world,
to include all header files required for proper compilation. This is not the responsibility of the user using this file to add dependency header in
his source files.
Ex: As everybody who is going to use bus.h has to have device.h and resource.h included.
So why not have all of them included once only. So that people don't see compilation
warnings when they try to use these header files. And don't have to add them in all source
files using them.
What do you say?
regards,
viresh kumar.
PATCH 1/1 Including device.h and resource.h header files in linux/amba/bus.h
2010/3/27 viresh kumar <[email protected]>:
Quoted 5 lines
Some time back i have initiated a thread regarding this type of issues. You can find them here:
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-February/010258.html
Quoted 8 lines
And my understanding after the discussion was:
It is the responsibility of a header files, using types definitions from outside world,
to include all header files required for proper compilation. This is not the responsibility of the user using this file to add dependency header in
his source files.
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.
Then this falls back on the definition of "facility". (And other academic discussions.)
I guess Russell will need to decide on this.
Linus
PATCH 1/1 Including device.h and resource.h header files in linux/amba/bus.h
Quoted 16 lines · Linus Walleij
2010/3/27 viresh kumar <[email protected]>:
Quoted 5 lines
Some time back i have initiated a thread regarding this type of issues. You can find them here:
http://lists.infradead.org/pipermail/linux-arm-kernel/2010-February/010258.html
Quoted 8 lines
And my understanding after the discussion was:
It is the responsibility of a header files, using types definitions from outside world,
to include all header files required for proper compilation. This is not the responsibility of the user using this file to add dependency header in
his source files.
Quoted 5 lines
On the other hand
Documentation/SubmitChecklistcontains 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.
But what if i don't want to use every type that is used in header file i am including. For ex: I don't want to use resource structure in my code and i need to include bus.h for some other definition. Then why should i get a compilation warning.
Again, according to above statement from submitchecklist:
shouldn't bus.h include device.h and resource.h, as it is using these facilities.
regards,
viresh kumar.
PATCH 1/1 Including device.h and resource.h header files in linux/amba/bus.h
[Viresh]
Quoted 7 lines
On Sat, Mar 27, 2010 at 2:43 PM, Linus Walleij
Quoted 5 lines
On the other hand
Documentation/SubmitChecklistcontains 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.
Quoted 6 lines
I agree on the above statement.
(...)
Again, according to above statement from submitchecklist:
shouldn'tbus.hincludedevice.handresource.h, as it is using these facilities.
Yes I think you're right, looks like it should be applied then! Acked-by:
Yours,
Linus Walleij
PATCH 1/1 Including device.h and resource.h header files in linux/amba/bus.h
Quoted 9 lines · Linus Walleij
Quoted 9 lines
On Sat, Mar 27, 2010 at 2:43 PM, Linus Walleij
Quoted 5 lines
On the other hand
Documentation/SubmitChecklistcontains 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.
Quoted 7 lines
Quoted 4 lines
(...)
Again, according to above statement from submitchecklist:
shouldn'tbus.hincludedevice.handresource.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.
Regards,
Hartley
PATCH 1/1 Including device.h and resource.h header files in linux/amba/bus.h
Quoted 15 lines · H Hartley Sweeten
Quoted 14 lines · Linus Walleij
Quoted 13 lines
On Sat, Mar 27, 2010 at 2:43 PM, Linus Walleij
Quoted 5 lines
On the other hand
Documentation/SubmitChecklistcontains 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'tbus.hincludedevice.handresource.h, as it is using these facilities.
Quoted 7 lines
Quoted 2 lines
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;
No - it needs the definitions themselves because it otherwise doesn't know how to lay out struct amba_device.
What you suggest works fine for pointers, but not if the actual definition itself is required.
PATCH 1/1 Including device.h and resource.h header files in linux/amba/bus.h
Quoted 21 lines · Russell King
Quoted 20 lines · H Hartley Sweeten
Quoted 9 lines · Linus Walleij
Quoted 9 lines
On Sat, Mar 27, 2010 at 2:43 PM, Linus Walleij
Quoted 5 lines
On the other hand
Documentation/SubmitChecklistcontains 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.
Quoted 7 lines
Quoted 4 lines
(...)
Again, according to above statement from submitchecklist:
shouldn'tbus.hincludedevice.handresource.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:
Quoted 8 lines
Quoted 2 lines
struct device;
struct resource;No - it needs the definitions themselves because it otherwise doesn't know how to lay out struct
amba_device.What you suggest works fine for pointers, but not if the actual definition itself is required.
Oops my bad... I didn't notice that the variables were not pointers.
You are correct, the headers are needed to get the proper definitions.
Regards,
Hartley
PATCH 1/1 Including device.h and resource.h header files in linux/amba/bus.h
In reply to Viresh KUMARQuoted 4 lines · Viresh KUMAR
linux/amba/bus.hhave dependencies onlinux/device.handlinux/resource.h, but it doesn't include them. We get compilation errors in our files which includebus.hbut doesn't includedevice.handresource.h. This patch includesdevice.handresource.hinlinux/amba/bus.hfile.
Ok.