From: Ingo Molnar <mingo@elte.hu>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Jaswinder Singh Rajput <jaswinder@kernel.org>,
x86 maintainers <x86@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -tip] x86: kdebugfs.c cleanup
Date: Sun, 15 Mar 2009 05:54:46 +0100 [thread overview]
Message-ID: <20090315045446.GD11150@elte.hu> (raw)
In-Reply-To: <49BC8182.5050508@cn.fujitsu.com>
* Li Zefan <lizf@cn.fujitsu.com> wrote:
> > #include <linux/debugfs.h>
> > #include <linux/uaccess.h>
> > -#include <linux/stat.h>
> > +#include <linux/module.h>
> > #include <linux/init.h>
> > +#include <linux/stat.h>
> > #include <linux/io.h>
> > #include <linux/mm.h>
> > -#include <linux/module.h>
> >
>
> Just curious about the rule to sort those includes, and why they need
> to be rearranged.
Such includes (the 'reverse christmas tree'):
#include <linux/interrupt.h>
#include <linux/mmiotrace.h>
#include <linux/bootmem.h>
#include <linux/compiler.h>
#include <linux/highmem.h>
#include <linux/kprobes.h>
#include <linux/uaccess.h>
#include <linux/vmalloc.h>
#include <linux/vt_kern.h>
#include <linux/signal.h>
#include <linux/kernel.h>
#include <linux/ptrace.h>
#include <linux/string.h>
#include <linux/module.h>
#include <linux/kdebug.h>
#include <linux/errno.h>
#include <linux/magic.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/mman.h>
#include <linux/tty.h>
#include <linux/smp.h>
#include <linux/mm.h>
#include <asm/kmemcheck.h>
#include <asm/tlbflush.h>
#include <asm/pgalloc.h>
#include <asm/segment.h>
#include <asm/system.h>
#include <asm/proto.h>
#include <asm/traps.h>
#include <asm/desc.h>
are used by x86 architecture code (and some other subsystems) to
reduce the likelyhood of patch conflicts in commonly modified
kernel files.
Without such ordering developers typically append to the
existing list of include files when introducing a new header -
creating an almost certain patch conflict. Via the above
ordering, new headers get distributed roughly evenly amongst the
full range - and thus the chance of patch conflicts is much
smaller.
This way it also looks a bit more structured and bit less messy.
It looks unprofessional and sloppy if a .c file starts with a
big block of thrown-together include files.
Ingo
prev parent reply other threads:[~2009-03-15 4:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-14 15:01 [PATCH -tip] x86: kdebugfs.c cleanup Jaswinder Singh Rajput
2009-03-15 4:18 ` Li Zefan
2009-03-15 4:54 ` Ingo Molnar [this message]
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=20090315045446.GD11150@elte.hu \
--to=mingo@elte.hu \
--cc=jaswinder@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=x86@kernel.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