Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752469AbaBJOJz (ORCPT ); Mon, 10 Feb 2014 09:09:55 -0500 Received: from cdptpa-outbound-snat.email.rr.com ([107.14.166.225]:38071 "EHLO cdptpa-oedge-vip.email.rr.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751449AbaBJOJy (ORCPT ); Mon, 10 Feb 2014 09:09:54 -0500 Date: Mon, 10 Feb 2014 09:09:48 -0500 From: Steven Rostedt To: Dongsheng Yang Cc: Namhyung Kim , linux-kernel@vger.kernel.org, peterz@infradead.org, raistlin@linux.it, juri.lelli@gmail.com, clark.williams@gmail.com, mingo@redhat.com Subject: Re: [PATCH 1/3] sched: Move the priority specific bits into a new header file. Message-ID: <20140210090948.02266f38@gandalf.local.home> In-Reply-To: <52F83FE2.90004@cn.fujitsu.com> References: <87fvo75pci.fsf@sejong.aot.lge.com> <52F83FE2.90004@cn.fujitsu.com> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.22; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-RR-Connecting-IP: 107.14.168.142:25 X-Cloudmark-Score: 0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Feb 2014 10:56:34 +0800 Dongsheng Yang wrote: > >> diff --git a/include/linux/sched.h b/include/linux/sched.h > >> index 68a0e84..ba1b732 100644 > >> --- a/include/linux/sched.h > >> +++ b/include/linux/sched.h > >> @@ -3,6 +3,10 @@ > >> > >> #include > >> > >> +#ifndef _SCHED_PRIO_H > >> +#include > >> +#endif /* #ifndef _SCHED_PRIO_H */ > > It seems you don't need to use #ifndef-#endif pair to include a header > > file? > > Sorry for the late reply, coming back from vacation for Chinese Spring > Festival. > > The reason I use #ifndef-#endif here is that there are lots of files, > such as kernel/sched/sched.h, are including and > . And both of them are including prio.h. > > I am not sure should we avoid reincluding a file and how. > > Could you help to give me some suggestion of it. Thanx :) That's why you have: +++ b/include/linux/sched/prio.h @@ -0,0 +1,23 @@ +#ifndef _SCHED_PRIO_H +#define _SCHED_PRIO_H The first time a header gets included, it checks if _SCHED_PRIO_H is defined, if not, it defines it and continues. Otherwise it skips the content of the file. This is so standard practice that CPP (C Pre-Processor) optimizes this by checking if this exists and caches it. It wont even open the file the second time it sees it included. -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/