All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 9/9] dm: core: Adjust device_bind_common() to take an ofnode
Date: Mon,  1 May 2017 09:18:52 -0600	[thread overview]
Message-ID: <20170501151852.26670-10-sjg@chromium.org> (raw)
In-Reply-To: <20170501151852.26670-1-sjg@chromium.org>

This core function will need to work with a live tree also. Update it to
accept an ofnode instead of an offset.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Cut the series down to only prepare the way for live tree
- Drop all live tree changes
- Adjust storage to avoid a code size increase

 drivers/core/device.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 2738685092..363c1833e9 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -29,7 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static int device_bind_common(struct udevice *parent, const struct driver *drv,
 			      const char *name, void *platdata,
-			      ulong driver_data, int of_offset,
+			      ulong driver_data, ofnode node,
 			      uint of_platdata_size, struct udevice **devp)
 {
 	struct udevice *dev;
@@ -60,7 +60,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
 	dev->platdata = platdata;
 	dev->driver_data = driver_data;
 	dev->name = name;
-	dev->node = offset_to_ofnode(of_offset);
+	dev->node = node;
 	dev->parent = parent;
 	dev->driver = drv;
 	dev->uclass = uc;
@@ -76,9 +76,10 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv,
 		 * resolved (and ->seq updated) when the device is probed.
 		 */
 		if (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS) {
-			if (uc->uc_drv->name && of_offset != -1) {
+			if (uc->uc_drv->name && ofnode_valid(node)) {
 				fdtdec_get_alias_seq(gd->fdt_blob,
-						uc->uc_drv->name, of_offset,
+						uc->uc_drv->name,
+						ofnode_to_offset(node),
 						&dev->req_seq);
 			}
 		}
@@ -219,15 +220,15 @@ int device_bind_with_driver_data(struct udevice *parent,
 				 struct udevice **devp)
 {
 	return device_bind_common(parent, drv, name, NULL, driver_data,
-				  of_offset, 0, devp);
+				  offset_to_ofnode(of_offset), 0, devp);
 }
 
 int device_bind(struct udevice *parent, const struct driver *drv,
 		const char *name, void *platdata, int of_offset,
 		struct udevice **devp)
 {
-	return device_bind_common(parent, drv, name, platdata, 0, of_offset, 0,
-				  devp);
+	return device_bind_common(parent, drv, name, platdata, 0,
+				  offset_to_ofnode(of_offset), 0, devp);
 }
 
 int device_bind_by_name(struct udevice *parent, bool pre_reloc_only,
@@ -246,7 +247,8 @@ int device_bind_by_name(struct udevice *parent, bool pre_reloc_only,
 	platdata_size = info->platdata_size;
 #endif
 	return device_bind_common(parent, drv, info->name,
-			(void *)info->platdata, 0, -1, platdata_size, devp);
+			(void *)info->platdata, 0, offset_to_ofnode(-1),
+			platdata_size, devp);
 }
 
 static void *alloc_priv(int size, uint flags)
-- 
2.13.0.rc0.306.g87b477812d-goog

  parent reply	other threads:[~2017-05-01 15:18 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
2017-05-01 15:18 ` Simon Glass [this message]
2017-05-10 21:43   ` [U-Boot] [PATCH v2 9/9] dm: core: Adjust device_bind_common() to take an ofnode 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=20170501151852.26670-10-sjg@chromium.org \
    --to=sjg@chromium.org \
    --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.