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

Furquan Shaikh (Code Review) gerrit at coreboot.org
Mon Jun 4 02:49:54 CEST 2018


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


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

util/sconfig: Get rid of rescnt in struct device

This change gets rid of rescnt member in struct device since it is
redundant. "res" member can be used to determine if resource list is
present or not.

BUG=b:80081934
TEST=Verified that static.c generated with and without this CL is
exactly the same for all boards built using abuild.

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



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/26806/1

diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 5c32178..f98cc5f 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -486,7 +486,6 @@
 	} else {
 		dev->res = r;
 	}
-	dev->rescnt++;
 }
 
 void add_register(struct chip_instance *chip_instance, char *name, char *val)
@@ -567,7 +566,7 @@
 	}
 
 	fprintf(fil, "DEVTREE_CONST static struct device %s;\n", ptr->name);
-	if (ptr->rescnt > 0)
+	if (ptr->res)
 		fprintf(fil, "DEVTREE_CONST struct resource %s_res[];\n",
 			ptr->name);
 	if (ptr->children || device_has_instance(ptr))
@@ -583,7 +582,7 @@
 
 static void emit_resources(FILE *fil, struct device *ptr)
 {
-	if (ptr->rescnt == 0)
+	if (!ptr->res)
 		return;
 
 	int i = 1;
@@ -692,7 +691,7 @@
 		fprintf(fil, "\t.subsystem_device = 0x%04x,\n",
 			ptr->subsystem_device);
 
-	if (ptr->rescnt > 0) {
+	if (ptr->res) {
 		fprintf(fil, "\t.resource_list = &%s_res[0],\n",
 			ptr->name);
 	}
diff --git a/util/sconfig/sconfig.h b/util/sconfig/sconfig.h
index 2c52d23..10d58ae 100644
--- a/util/sconfig/sconfig.h
+++ b/util/sconfig/sconfig.h
@@ -89,7 +89,6 @@
 struct device {
 	int id;
 	int enabled;
-	int rescnt;
 	int subsystem_vendor;
 	int subsystem_device;
 	int inherit_subsystem;

-- 
To view, visit https://review.coreboot.org/26806
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: I73a2361686ad1130716a7d29576f2d02b9ed33c1
Gerrit-Change-Number: 26806
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/c593a496/attachment.html>


More information about the coreboot-gerrit mailing list