[OpenBIOS] [PATCH 1/5] ide: use REGISTER_NAMED_NODE_PHANDLE rather than REGISTER_NAMED_NODE

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Thu Dec 24 20:53:55 CET 2015


There already exists a macro to create the device node and return its phandle,
so use this directly rather than having to create the node and then navigate
to its full path separately.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/drivers/ide.c |   14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/openbios-devel/drivers/ide.c b/openbios-devel/drivers/ide.c
index 5125b78..51f1696 100644
--- a/openbios-devel/drivers/ide.c
+++ b/openbios-devel/drivers/ide.c
@@ -1424,9 +1424,7 @@ int ob_ide_init(const char *path, uint32_t io_port0, uint32_t ctl_port0,
 
                 snprintf(nodebuff, sizeof(nodebuff), "%s/" DEV_NAME, path,
                          current_channel);
-		REGISTER_NAMED_NODE(ob_ide_ctrl, nodebuff);
-
-		dnode = find_dev(nodebuff);
+		REGISTER_NAMED_NODE_PHANDLE(ob_ide_ctrl, nodebuff, dnode);
 
 #if !defined(CONFIG_PPC) && !defined(CONFIG_SPARC64)
 		props[0]=14; props[1]=0;
@@ -1471,8 +1469,7 @@ int ob_ide_init(const char *path, uint32_t io_port0, uint32_t ctl_port0,
                         snprintf(nodebuff, sizeof(nodebuff),
                                  "%s/" DEV_NAME "/%s", path, current_channel,
                                  media);
-			REGISTER_NAMED_NODE(ob_ide, nodebuff);
-			dnode=find_dev(nodebuff);
+			REGISTER_NAMED_NODE_PHANDLE(ob_ide, nodebuff, dnode);
 			set_int_property(dnode, "reg", j);
 
 			/* create aliases */
@@ -1596,9 +1593,7 @@ int macio_ide_init(const char *path, uint32_t addr, int nb_channels)
 
                 snprintf(nodebuff, sizeof(nodebuff), "%s/" DEV_NAME, path,
                          current_channel);
-		REGISTER_NAMED_NODE(ob_ide_ctrl, nodebuff);
-
-		dnode = find_dev(nodebuff);
+		REGISTER_NAMED_NODE_PHANDLE(ob_ide_ctrl, nodebuff, dnode);
 
 		set_property(dnode, "compatible", (is_oldworld() ?
 			     "heathrow-ata" : "keylargo-ata"), 13);
@@ -1694,8 +1689,7 @@ int macio_ide_init(const char *path, uint32_t addr, int nb_channels)
                         snprintf(nodebuff, sizeof(nodebuff),
                                  "%s/" DEV_NAME "/%s", path, current_channel,
                                  media);
-			REGISTER_NAMED_NODE(ob_ide, nodebuff);
-			dnode = find_dev(nodebuff);
+			REGISTER_NAMED_NODE_PHANDLE(ob_ide, nodebuff, dnode);
 			set_int_property(dnode, "reg", j);
 
 			/* create aliases */
-- 
1.7.10.4




More information about the OpenBIOS mailing list