From mboxrd@z Thu Jan 1 00:00:00 1970 From: Masahiro Yamada Date: Sun, 21 May 2017 01:17:41 +0900 Subject: [U-Boot] [PATCH v2 8/9] dm: core: Add ofnode to represent device tree nodes In-Reply-To: References: <20170501151852.26670-1-sjg@chromium.org> <20170501151852.26670-9-sjg@chromium.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Simon, 2017-05-20 11:29 GMT+09:00 Simon Glass : > Hi Masahiro, > > On 16 May 2017 at 04:35, Masahiro Yamada wrote: >> >> Hi Simon, >> >> >> 2017-05-02 0:18 GMT+09:00 Simon Glass : >> > With live tree we need a struct device_node * to reference a node. With >> > the existing flat tree, we need an int offset. We need to unify these into >> > a single value which can represent both. >> > >> > Add an ofnode union for this and adjust existing code to move to this. >> > >> > Signed-off-by: Simon Glass >> > --- >> > >> > Changes in v2: None >> > >> > drivers/core/device.c | 2 +- >> > drivers/core/root.c | 2 +- >> > include/dm.h | 1 + >> > include/dm/device.h | 14 +++++-- >> > include/dm/ofnode.h | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++ >> > 5 files changed, 113 insertions(+), 6 deletions(-) >> > create mode 100644 include/dm/ofnode.h > >> When you add a new header, please make sure it is self-contained. >> >> You use bool for offset_toofnode() and ofnode_equal(). >> So you need to include from this header. >> >> (or, use "int" for the return type.) > > I'm wondering about this problem: > > In general we want to minimise the size of headers included by U-Boot. > For something like ofnode which is used by several header files we end > up including it many times, once per header. It is no problem if the header body is surrounded by an include guard. With include guards, each header is _parsed_ only once even if _included_ multiple times. > With dm.h we avoid this since the header is only included ones (and in > the correct order). Generally, we should not rely on a specific include order. Even if we compel drivers to include dm.h, each of dm/{device.h, platdata.h, uclass.h} should be self-contained. We usually sort includes alphabetically, but technically it should work in any order. It would be possible if each header is self-contained. > What is the best solution to this? -- Best Regards Masahiro Yamada