[coreboot-gerrit] Change in coreboot[master]: util/sconfig: Get rid of nextdev member in struct device

Furquan Shaikh (Code Review) gerrit at coreboot.org
Thu May 31 20:05:51 CEST 2018


Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/26741


Change subject: util/sconfig: Get rid of nextdev member in struct device
......................................................................

util/sconfig: Get rid of nextdev member in struct device

Now that chips and devices are treated differently and the device tree
actually contains only devices, next and nextdev are exactly the same
for all devices in the tree. This change gets rid of nextdev pointer
and updates all uses of nextdev to next.

BUG=80081934
TEST=Verified that static.c generated for all boards built by abuild
is same with and without this change.

Change-Id: Ie50b3d769a78fe0beddba2e5551441b43cb212a2
Signed-off-by: Furquan Shaikh <furquan at google.com>
---
M util/sconfig/main.c
M util/sconfig/sconfig.h
2 files changed, 10 insertions(+), 11 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/41/26741/1

diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 32d7aac..10e6e67 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -20,7 +20,7 @@
 
 extern int linenum;
 
-struct device *head, *lastdev;
+struct device *head, *lastnode;
 
 static struct chip chip_header;
 
@@ -185,9 +185,9 @@
 		/* skip functions of the same device in sibling chain */
 		while (dev->sibling && dev->sibling->used)
 			dev->sibling = dev->sibling->sibling;
-		/* skip duplicate function elements in nextdev chain */
-		while (dev->nextdev && dev->nextdev->used)
-			dev->nextdev = dev->nextdev->nextdev;
+		/* skip duplicate function elements in next chain */
+		while (dev->next && dev->next->used)
+			dev->next = dev->next->next;
 		dev = dev->next_sibling;
 	}
 }
@@ -304,8 +304,8 @@
 	if (!parent->children)
 		parent->children = new_d;
 
-	lastdev->nextdev = new_d;
-	lastdev = new_d;
+	lastnode->next = new_d;
+	lastnode = new_d;
 
 	switch (bustype) {
 	case PCI:
@@ -546,8 +546,8 @@
 		if (chip_ins->chip->chiph_exists)
 			fprintf(fil, "\t.chip_info = &%s_info_%d,\n",
 				chip_ins->chip->name_underscore, chip_ins->id);
-		if (ptr->nextdev)
-			fprintf(fil, "\t.next=&%s\n", ptr->nextdev->name);
+		if (ptr->next)
+			fprintf(fil, "\t.next=&%s\n", ptr->next->name);
 		fprintf(fil, "};\n");
 	}
 	if (ptr->rescnt > 0) {
@@ -748,7 +748,7 @@
 
 	yyrestart(filec);
 
-	lastdev = head = &root;
+	lastnode = head = &root;
 
 	yyparse();
 
@@ -769,7 +769,7 @@
 	walk_device_tree(autogen, &root, pass0, NULL);
 	fprintf(autogen, "\n/* pass 1 */\n"
 		"DEVTREE_CONST struct device * DEVTREE_CONST last_dev = &%s;\n",
-		lastdev->name);
+		lastnode->name);
 	walk_device_tree(autogen, &root, pass1, NULL);
 
 	fclose(autogen);
diff --git a/util/sconfig/sconfig.h b/util/sconfig/sconfig.h
index d2a3d28..d71d5ef 100644
--- a/util/sconfig/sconfig.h
+++ b/util/sconfig/sconfig.h
@@ -98,7 +98,6 @@
 
 	struct device *parent;
 	struct device *next;
-	struct device *nextdev;
 	struct device *children;
 	struct device *latestchild;
 	struct device *next_sibling;

-- 
To view, visit https://review.coreboot.org/26741
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie50b3d769a78fe0beddba2e5551441b43cb212a2
Gerrit-Change-Number: 26741
Gerrit-PatchSet: 1
Gerrit-Owner: Furquan Shaikh <furquan at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180531/7cbe3dbd/attachment.html>


More information about the coreboot-gerrit mailing list