All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 8/9] dm: core: Add ofnode to represent device tree nodes
Date: Sun, 21 May 2017 01:17:41 +0900	[thread overview]
Message-ID: <CAK7LNARRfumpvaZH+AiSxaCwutSjT+WFm2bsh6F8_b7M+rp4iQ@mail.gmail.com> (raw)
In-Reply-To: <CAPnjgZ288K7M-97FET=EzNhPFWm+RDB6ZgPm6hZYc_1Y_EwaWA@mail.gmail.com>

Hi Simon,


2017-05-20 11:29 GMT+09:00 Simon Glass <sjg@chromium.org>:
> Hi Masahiro,
>
> On 16 May 2017 at 04:35, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>>
>> Hi Simon,
>>
>>
>> 2017-05-02 0:18 GMT+09:00 Simon Glass <sjg@chromium.org>:
>> > 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 <sjg@chromium.org>
>> > ---
>> >
>> > 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 <stdbool.h> 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

  reply	other threads:[~2017-05-20 16:17 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-01 15:18 [U-Boot] [PATCH v2 0/9] dm: Prepare for supporting a live device tree Simon Glass
2017-05-01 15:18 ` [U-Boot] [PATCH v2 1/9] dm: Use dm.h header when driver mode is used Simon Glass
2017-05-10 21:43   ` Tom Rini
2017-05-11  2:12     ` Masahiro Yamada
2017-05-13  1:11       ` Simon Glass
2017-05-16  9:56         ` Masahiro Yamada
2017-05-17 10:07           ` Simon Glass
2017-05-01 15:18 ` [U-Boot] [PATCH v2 2/9] dm: core: Move dev_get_addr() etc. into a separate file Simon Glass
2017-05-10 21:43   ` Tom Rini
2017-05-16 10:04   ` Masahiro Yamada
2017-05-17 10:09     ` Simon Glass
2017-05-01 15:18 ` [U-Boot] [PATCH v2 3/9] dm: Rename dev_addr..() functions Simon Glass
2017-05-10 21:43   ` Tom Rini
2017-05-01 15:18 ` [U-Boot] [PATCH v2 4/9] atmel: Fix up use of dm_scan_fdt_node() Simon Glass
2017-05-10 21:43   ` Tom Rini
2017-05-01 15:18 ` [U-Boot] [PATCH v2 5/9] Fix up inclusion of common.h Simon Glass
2017-05-10 21:43   ` Tom Rini
2017-05-11  2:21     ` Masahiro Yamada
2017-05-13  1:11       ` Simon Glass
2017-05-16 10:32         ` Masahiro Yamada
2017-05-17 10:09           ` Simon Glass
2017-05-20 16:50             ` Masahiro Yamada
2017-05-01 15:18 ` [U-Boot] [PATCH v2 6/9] dm: core: Dont export dm_scan_fdt_node() Simon Glass
2017-05-10 21:43   ` Tom Rini
2017-05-01 15:18 ` [U-Boot] [PATCH v2 7/9] dm: core: Replace of_offset with accessor (part 2) Simon Glass
2017-05-10 21:43   ` Tom Rini
2017-05-01 15:18 ` [U-Boot] [PATCH v2 8/9] dm: core: Add ofnode to represent device tree nodes Simon Glass
2017-05-10 21:43   ` Tom Rini
2017-05-11  2:33   ` Masahiro Yamada
2017-05-13  1:11     ` Simon Glass
2017-05-16 10:35   ` Masahiro Yamada
2017-05-20  2:29     ` Simon Glass
2017-05-20 16:17       ` Masahiro Yamada [this message]
2017-05-01 15:18 ` [U-Boot] [PATCH v2 9/9] dm: core: Adjust device_bind_common() to take an ofnode Simon Glass
2017-05-10 21:43   ` Tom Rini

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=CAK7LNARRfumpvaZH+AiSxaCwutSjT+WFm2bsh6F8_b7M+rp4iQ@mail.gmail.com \
    --to=yamada.masahiro@socionext.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.