From: eric.y.miao@gmail.com (Eric Miao)
To: linux-arm-kernel@lists.infradead.org
Subject: QUERY: Inclusion of header files in kernel header files.
Date: Wed, 24 Feb 2010 10:52:47 +0800 [thread overview]
Message-ID: <f17812d71002231852l1e47add7pc17764c67d26ae2b@mail.gmail.com> (raw)
In-Reply-To: <22dbbef21002222230x780c1ffatca5541453f6043ab@mail.gmail.com>
On Tue, Feb 23, 2010 at 2:30 PM, viresh kumar <viresh.linux@gmail.com> wrote:
> Hello,
> I have been through many kernel header files and have found that kernel
> header
> files at many places don't include other header files which they have
> dependency upon.
> For example:
> <linux/amba/bus.h> uses struct device and struct resource and it doesn't
> include <linux/device.h> and <linux/resource.h> header files.
> Now, whenever i try to include bus.h, i have to include device.h and
> resource.h.
> Is this correct approach?
> Again, if i include device.h and resource.h, they must be included before
> bus.h.
> Now this will disturb the alphabetical ordering of including header files
> sometimes. (not in this example)
> Any idea behind this philosophy.
>
My understanding is that if you are going to include every dependency
into the header files, they are going to explode very soon. E.g. like bus.h,
as long as you declared something like:
struct device;
struct resource;
....
The compiler will be happy to know the structures are actually defined
elsewhere when processing the header file itself (as long as there is
no direct de-reference of the field members of these structures). And
thus in .c file you are going to decide all the dependent header files
by your own.
> regards,
> viresh kumar
> ST Microelectronics
> India.
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
>
next prev parent reply other threads:[~2010-02-24 2:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-23 6:30 QUERY: Inclusion of header files in kernel header files viresh kumar
2010-02-24 2:52 ` Eric Miao [this message]
2010-02-24 4:20 ` viresh kumar
2010-02-24 12:59 ` Laurent Pinchart
-- strict thread matches above, loose matches on Subject: below --
2010-02-23 6:36 viresh kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f17812d71002231852l1e47add7pc17764c67d26ae2b@mail.gmail.com \
--to=eric.y.miao@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).