diff mbox series

[U-Boot,2/2] dm: core: remove the duplicated function dm_ofnode_pre_reloc

Message ID 1549275292-3134-2-git-send-email-patrick.delaunay@st.com
State Superseded
Delegated to: Simon Glass
Headers show
Series [U-Boot,1/2] fdt: Allow indicating a node is for U-Boot proper only | expand

Commit Message

Patrick DELAUNAY Feb. 4, 2019, 10:14 a.m. UTC
The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc()
defined in drivers/core/ofnode.c and used only one time
in drivers/core/lists.c:lists_bind_fdt().

So the function can be removed and directly call ofnode_pre_reloc.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
---

 drivers/core/lists.c |  2 +-
 drivers/core/util.c  | 26 --------------------------
 include/dm/util.h    | 27 ---------------------------
 3 files changed, 1 insertion(+), 54 deletions(-)

Comments

Simon Glass Feb. 4, 2019, 2:40 p.m. UTC | #1
Hi Patrick,

On Mon, 4 Feb 2019 at 03:15, Patrick Delaunay <patrick.delaunay@st.com> wrote:
>
> The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc()
> defined in drivers/core/ofnode.c and used only one time
> in drivers/core/lists.c:lists_bind_fdt().
>
> So the function can be removed and directly call ofnode_pre_reloc.
>
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
>
>  drivers/core/lists.c |  2 +-
>  drivers/core/util.c  | 26 --------------------------
>  include/dm/util.h    | 27 ---------------------------
>  3 files changed, 1 insertion(+), 54 deletions(-)

I think the docs for ofnode_pre_reloc() need updating.

Regards,
Simon
Patrick DELAUNAY Feb. 6, 2019, 9:26 a.m. UTC | #2
Hi Simon,

> From: Simon Glass <sjg@chromium.org>
> Sent: lundi 4 février 2019 15:41
> 
> Hi Patrick,
> 
> On Mon, 4 Feb 2019 at 03:15, Patrick Delaunay <patrick.delaunay@st.com>
> wrote:
> >
> > The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc()
> > defined in drivers/core/ofnode.c and used only one time in
> > drivers/core/lists.c:lists_bind_fdt().
> >
> > So the function can be removed and directly call ofnode_pre_reloc.
> >
> > Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> > ---
> >
> >  drivers/core/lists.c |  2 +-
> >  drivers/core/util.c  | 26 --------------------------
> >  include/dm/util.h    | 27 ---------------------------
> >  3 files changed, 1 insertion(+), 54 deletions(-)
> 
> I think the docs for ofnode_pre_reloc() need updating.

You think about which docs ?

With previous patch in the serie, in ofnode.h, I have:

/**
 * ofnode_pre_reloc() - check if a node should be bound before relocation
 *
 * Device tree nodes can be marked as needing-to-be-bound in the loader stages
 * via special device tree properties.
 *
 * Before relocation this function can be used to check if nodes are required
 * in either SPL or TPL stages.
 *
 * After relocation and jumping into the real U-Boot binary it is possible to
 * determine if a node was bound in one of SPL/TPL stages.
 *
 * There are 4 settings currently in use
 * - u-boot,dm-pre-proper: U-Boot proper pre-relocation only
 * - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL
 *   Existing platforms only use it to indicate nodes needed in
 *   SPL. Should probably be replaced by u-boot,dm-spl for
 *   new platforms.
 * - u-boot,dm-spl: SPL and U-Boot pre-relocation
 * - u-boot,dm-tpl: TPL and U-Boot pre-relocation
 *
 * @node: node to check
 * @return true if node is needed in SPL/TL, false otherwise
 */
bool ofnode_pre_reloc(ofnode node);

What do you expect ?

> Regards,
> Simon

Regards
Patrick
diff mbox series

Patch

diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index a1f8284..67edf0f 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -173,7 +173,7 @@  int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,
 			continue;
 
 		if (pre_reloc_only) {
-			if (!dm_ofnode_pre_reloc(node) &&
+			if (!ofnode_pre_reloc(node) &&
 			    !(entry->flags & DM_FLAG_PRE_RELOC))
 				return 0;
 		}
diff --git a/drivers/core/util.c b/drivers/core/util.c
index 6bedc8a..fa9ccbd 100644
--- a/drivers/core/util.c
+++ b/drivers/core/util.c
@@ -56,29 +56,3 @@  bool dm_fdt_pre_reloc(const void *blob, int offset)
 
 	return false;
 }
-
-bool dm_ofnode_pre_reloc(ofnode node)
-{
-	if (ofnode_read_bool(node, "u-boot,dm-pre-reloc"))
-		return true;
-	if (ofnode_read_bool(node, "u-boot,dm-pre-proper"))
-		return true;
-
-#ifdef CONFIG_TPL_BUILD
-	if (ofnode_read_bool(node, "u-boot,dm-tpl"))
-		return true;
-#elif defined(CONFIG_SPL_BUILD)
-	if (ofnode_read_bool(node, "u-boot,dm-spl"))
-		return true;
-#else
-	/*
-	 * In regular builds individual spl and tpl handling both
-	 * count as handled pre-relocation for later second init.
-	 */
-	if (ofnode_read_bool(node, "u-boot,dm-spl") ||
-	    ofnode_read_bool(node, "u-boot,dm-tpl"))
-		return true;
-#endif
-
-	return false;
-}
diff --git a/include/dm/util.h b/include/dm/util.h
index cbc209d..9b1128f 100644
--- a/include/dm/util.h
+++ b/include/dm/util.h
@@ -67,31 +67,4 @@  static inline void dm_dump_devres(void)
  */
 bool dm_fdt_pre_reloc(const void *blob, int offset);
 
-/**
- * Check if an of node should be or was bound before relocation.
- *
- * Devicetree nodes can be marked as needed to be bound
- * in the loader stages via special devicetree properties.
- *
- * Before relocation this function can be used to check if nodes
- * are required in either SPL or TPL stages.
- *
- * After relocation and jumping into the real U-Boot binary
- * it is possible to determine if a node was bound in one of
- * SPL/TPL stages.
- *
- * There are 4 settings currently in use
- * - u-boot,dm-pre-proper: U-Boot proper pre-relocation only
- * - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL
- *   Existing platforms only use it to indicate nodes needed in
- *   SPL. Should probably be replaced by u-boot,dm-spl for
- *   existing platforms.
- * - u-boot,dm-spl: SPL and U-Boot pre-relocation
- * - u-boot,dm-tpl: TPL and U-Boot pre-relocation
- * @node: of node
- *
- * Returns true if node is needed in SPL/TL, false otherwise.
- */
-bool dm_ofnode_pre_reloc(ofnode node);
-
 #endif