From b72ab9e4d7af47749e4f9c27074e782d934848d9 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 31 May 2018 11:03:17 -0700 Subject: 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=b: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 Reviewed-on: https://review.coreboot.org/26741 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- util/sconfig/main.c | 20 ++++++++++---------- util/sconfig/sconfig.h | 1 - 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'util/sconfig') diff --git a/util/sconfig/main.c b/util/sconfig/main.c index d505d4f5f2..8059a8754e 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 @@ void postprocess_devtree(void) /* 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 @@ struct device *new_device(struct device *parent, 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: @@ -547,8 +547,8 @@ static void pass1(FILE *fil, struct device *ptr) 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) { @@ -744,7 +744,7 @@ int main(int argc, char **argv) yyrestart(filec); - lastdev = head = &root; + lastnode = head = &root; yyparse(); @@ -765,7 +765,7 @@ int main(int argc, char **argv) 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 960facd7b1..2bb816d5ef 100644 --- a/util/sconfig/sconfig.h +++ b/util/sconfig/sconfig.h @@ -98,7 +98,6 @@ struct device { struct device *parent; struct device *next; - struct device *nextdev; struct device *children; struct device *latestchild; struct device *next_sibling; -- cgit v1.2.3