util/sconfig: Get rid of ops from struct device

"ops" field was used in device structure only to add
default_dev_ops_root for root device. It was always set to NULL for
all other devices. This change gets rid of ops field from struct
device and instead hardcodes default_dev_ops_root in pass1 for root
device.

BUG=b:80081934
TEST=Verified that static.c generated with and without this change is
exactly the same.

Change-Id: I0848788610c2ed27274daf4920de3068a9784d4c
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/27209
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Furquan Shaikh 2018-06-23 00:59:31 -07:00
parent 27efc501d1
commit 50ddc0bb28
2 changed files with 9 additions and 6 deletions

View File

@ -98,7 +98,6 @@ static struct device base_root_dev = {
.id = 0, .id = 0,
.chip_instance = &mainboard_instance, .chip_instance = &mainboard_instance,
.path = " .type = DEVICE_PATH_ROOT ", .path = " .type = DEVICE_PATH_ROOT ",
.ops = "&default_dev_ops_root",
.parent = &base_root_bus, .parent = &base_root_bus,
.enabled = 1, .enabled = 1,
.bus = &base_root_bus, .bus = &base_root_bus,
@ -120,7 +119,6 @@ static struct device override_root_dev = {
*/ */
.chip_instance = &mainboard_instance, .chip_instance = &mainboard_instance,
.path = " .type = DEVICE_PATH_ROOT ", .path = " .type = DEVICE_PATH_ROOT ",
.ops = "&default_dev_ops_root",
.parent = &override_root_bus, .parent = &override_root_bus,
.enabled = 1, .enabled = 1,
.bus = &override_root_bus, .bus = &override_root_bus,
@ -773,7 +771,15 @@ static void pass1(FILE *fil, struct device *ptr, struct device *next)
fprintf(fil, "static "); fprintf(fil, "static ");
fprintf(fil, "DEVTREE_CONST struct device %s = {\n", ptr->name); fprintf(fil, "DEVTREE_CONST struct device %s = {\n", ptr->name);
fprintf(fil, "#if !DEVTREE_EARLY\n"); fprintf(fil, "#if !DEVTREE_EARLY\n");
fprintf(fil, "\t.ops = %s,\n", (ptr->ops) ? (ptr->ops) : "0");
/*
* ops field is set to default_dev_ops_root only for the root
* device. For all other devices, it is set by the driver at runtime.
*/
if (ptr == &base_root_dev)
fprintf(fil, "\t.ops = &default_dev_ops_root,\n");
else
fprintf(fil, "\t.ops = NULL,\n");
fprintf(fil, "#endif\n"); fprintf(fil, "#endif\n");
fprintf(fil, "\t.bus = &%s_links[%d],\n", ptr->parent->dev->name, fprintf(fil, "\t.bus = &%s_links[%d],\n", ptr->parent->dev->name,
ptr->parent->id); ptr->parent->id);

View File

@ -110,9 +110,6 @@ struct device {
int subsystem_device; int subsystem_device;
int inherit_subsystem; int inherit_subsystem;
/* Name of ops structure for the device. */
char *ops;
/* Name of this device. */ /* Name of this device. */
char *name; char *name;