From: viresh kumar <viresh.linux@gmail.com>
To: Borislav Petkov <petkovbb@googlemail.com>,
viresh kumar <viresh.linux@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: QUERY: Inclusion of header files in kernel header files
Date: Tue, 23 Feb 2010 13:01:25 +0530 [thread overview]
Message-ID: <22dbbef21002222331o6a59dc25mea3fc7e62dae6710@mail.gmail.com> (raw)
In-Reply-To: <20100223065953.GB32503@liondog.tnic>
Hi,
>> Is this correct approach?
>>
>> 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.
I think, ideally including any header file shouldn't give compilation
errors for types used in
included header file.
viresh kumar
On Tue, Feb 23, 2010 at 12:29 PM, Borislav Petkov
<petkovbb@googlemail.com> wrote:
> From: viresh kumar <viresh.linux@gmail.com>
> Date: Tue, Feb 23, 2010 at 12:13:35PM +0530
>
> Hi,
>
>> 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.
>
> 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.
>
>> Now this will disturb the alphabetical ordering of including header files
>> sometimes. (not in this example)
>
> I don't think there's such thing as alphabetical header ordering and if
> it were it would be rather dumb thing to do.
>
> Hope this helps.
>
> --
> Regards/Gruss,
> Boris.
>
next prev parent reply other threads:[~2010-02-23 7:31 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <22dbbef21002222241h711402f1me6b60ac7502cccd4@mail.gmail.com>
2010-02-23 6:43 ` viresh kumar
2010-02-23 6:59 ` Borislav Petkov
2010-02-23 7:31 ` viresh kumar [this message]
2010-02-23 9:50 ` Borislav Petkov
2010-02-23 11:37 ` viresh kumar
2010-02-23 13:01 ` Borislav Petkov
2010-02-23 13:59 ` Stefan Richter
2010-02-24 4:23 ` viresh kumar
2010-02-23 15:15 ` Theodore Tso
2010-02-24 4:28 ` viresh kumar
2010-02-24 7:02 ` Theodore Tso
2010-02-24 10:38 ` Clemens Ladisch
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=22dbbef21002222331o6a59dc25mea3fc7e62dae6710@mail.gmail.com \
--to=viresh.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=petkovbb@googlemail.com \
/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
all inboxes | Powered by JetHome®