[coreboot-gerrit] Change in coreboot[master]: util/sconfig: Get rid of latestchild and next_sibling
Furquan Shaikh (Code Review)
gerrit at coreboot.org
Mon Jun 4 02:49:53 CEST 2018
Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/26805
Change subject: util/sconfig: Get rid of latestchild and next_sibling
......................................................................
util/sconfig: Get rid of latestchild and next_sibling
latestchild and next_sibling members of struct device were primarily
used for walking the device tree. Now that we are using
breadth-first walk, there is no need for these members. This CL gets
rid of latestchild and next_sibling and the functions required to
update these pointers during tree parsing i.e. fold_in and
postprocess_devtree.
BUG=b:80081934
TEST=Verified that the static.c generated with and without this CL is
exactly the same for all boards built using abuild.
Change-Id: I0da64f6f10017c9c36f40b0d915f6dbffca9195e
Signed-off-by: Furquan Shaikh <furquan at google.com>
---
M util/sconfig/main.c
M util/sconfig/sconfig.h
M util/sconfig/sconfig.tab.c_shipped
M util/sconfig/sconfig.y
4 files changed, 3 insertions(+), 52 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/05/26805/1
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 7540fc5..5c32178 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -191,25 +191,6 @@
return !!d->linkcnt;
}
-void fold_in(struct device *parent)
-{
- struct device *child;
- struct device *latest = 0;
-
- child = device_has_instance(parent) ? parent->last_instance->children
- : parent->children;
-
- while (child != latest) {
- if (child->children) {
- if (!latest)
- latest = child->children;
- parent->latestchild->next_sibling = child->children;
- parent->latestchild = child->latestchild;
- }
- child = child->next_sibling;
- }
-}
-
int yywrap(void)
{
return 1;
@@ -222,17 +203,6 @@
exit(1);
}
-void postprocess_devtree(void)
-{
- root.next_sibling = root.children;
-
- /*
- * Since root is statically created we need to call fold_in explicitly
- * here to have the next_sibling and latestchild setup correctly.
- */
- fold_in(&root);
-}
-
char *translate_name(const char *str, translate_t mode)
{
char *b, *c;
@@ -427,11 +397,6 @@
if (parent->linkcnt)
new_d->linknum = parent->linkcnt - 1;
- if (parent->latestchild)
- parent->latestchild->next_sibling = new_d;
-
- parent->latestchild = new_d;
-
struct device *c;
c = device_has_instance(parent) ? parent->last_instance->children :
parent->children;
diff --git a/util/sconfig/sconfig.h b/util/sconfig/sconfig.h
index e4f2270..2c52d23 100644
--- a/util/sconfig/sconfig.h
+++ b/util/sconfig/sconfig.h
@@ -109,8 +109,6 @@
int linknum;
struct device *children;
- struct device *latestchild;
- struct device *next_sibling;
struct device *sibling;
struct resource *res;
@@ -124,10 +122,6 @@
extern struct device *tree_root;
-void fold_in(struct device *parent);
-
-void postprocess_devtree(void);
-
struct device *new_device(struct device *parent,
struct chip_instance *chip_instance,
const int bustype, const char *devnum,
diff --git a/util/sconfig/sconfig.tab.c_shipped b/util/sconfig/sconfig.tab.c_shipped
index 152e70d..b9300ce 100644
--- a/util/sconfig/sconfig.tab.c_shipped
+++ b/util/sconfig/sconfig.tab.c_shipped
@@ -487,8 +487,8 @@
static const yytype_uint8 yyrline[] =
{
0, 36, 36, 36, 38, 38, 38, 38, 40, 40,
- 40, 40, 40, 40, 42, 42, 51, 51, 60, 63,
- 66, 69, 72
+ 40, 40, 40, 40, 42, 42, 51, 51, 59, 62,
+ 65, 68, 71
};
#endif
@@ -1291,12 +1291,6 @@
break;
- case 3:
-
- { postprocess_devtree(); }
-
- break;
-
case 14:
{
@@ -1328,7 +1322,6 @@
{
cur_parent = (yyvsp[-2].device)->parent;
- fold_in((yyvsp[-2].device));
}
break;
diff --git a/util/sconfig/sconfig.y b/util/sconfig/sconfig.y
index 48a727f..4c05a47 100755
--- a/util/sconfig/sconfig.y
+++ b/util/sconfig/sconfig.y
@@ -33,7 +33,7 @@
%token CHIP DEVICE REGISTER BOOL BUS RESOURCE END EQUALS HEX STRING PCI PNP I2C APIC CPU_CLUSTER CPU DOMAIN IRQ DRQ IO NUMBER SUBSYSTEMID INHERIT IOAPIC_IRQ IOAPIC PCIINT GENERIC SPI USB MMIO
%%
-devtree: { cur_parent = tree_root; } chip { postprocess_devtree(); } ;
+devtree: { cur_parent = tree_root; } chip;
chipchildren: chipchildren device | chipchildren chip | chipchildren registers | /* empty */ ;
@@ -54,7 +54,6 @@
}
devicechildren END {
cur_parent = $<device>5->parent;
- fold_in($<device>5);
};
resource: RESOURCE NUMBER /* == resnum */ EQUALS NUMBER /* == resval */
--
To view, visit https://review.coreboot.org/26805
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: I0da64f6f10017c9c36f40b0d915f6dbffca9195e
Gerrit-Change-Number: 26805
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/20180604/c8ea35a8/attachment-0001.html>
More information about the coreboot-gerrit
mailing list