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@google.com>
Reviewed-on: https://review.coreboot.org/26806
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Furquan Shaikh 2018-06-07 23:36:45 -07:00
parent 931982600d
commit 4ca3a8abfa
2 changed files with 3 additions and 7 deletions

View File

@ -493,7 +493,6 @@ void add_resource(struct bus *bus, int type, int index, int base)
} else { } else {
dev->res = r; dev->res = r;
} }
dev->rescnt++;
} }
void add_register(struct chip_instance *chip_instance, char *name, char *val) void add_register(struct chip_instance *chip_instance, char *name, char *val)
@ -589,7 +588,7 @@ static void pass0(FILE *fil, struct device *ptr, struct device *next)
} }
fprintf(fil, "DEVTREE_CONST static struct device %s;\n", ptr->name); 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", fprintf(fil, "DEVTREE_CONST struct resource %s_res[];\n",
ptr->name); ptr->name);
if (dev_has_children(ptr)) if (dev_has_children(ptr))
@ -606,7 +605,7 @@ static void pass0(FILE *fil, struct device *ptr, struct device *next)
static void emit_resources(FILE *fil, struct device *ptr) static void emit_resources(FILE *fil, struct device *ptr)
{ {
if (ptr->rescnt == 0) if (ptr->res == NULL)
return; return;
int i = 1; int i = 1;
@ -704,7 +703,7 @@ static void pass1(FILE *fil, struct device *ptr, struct device *next)
fprintf(fil, "\t.subsystem_device = 0x%04x,\n", fprintf(fil, "\t.subsystem_device = 0x%04x,\n",
ptr->subsystem_device); ptr->subsystem_device);
if (ptr->rescnt > 0) { if (ptr->res) {
fprintf(fil, "\t.resource_list = &%s_res[0],\n", fprintf(fil, "\t.resource_list = &%s_res[0],\n",
ptr->name); ptr->name);
} }

View File

@ -99,9 +99,6 @@ struct device {
/* Indicates whether this device is enabled. */ /* Indicates whether this device is enabled. */
int enabled; int enabled;
/* Indicates number of resources for the device. */
int rescnt;
/* Subsystem IDs for the device. */ /* Subsystem IDs for the device. */
int subsystem_vendor; int subsystem_vendor;
int subsystem_device; int subsystem_device;