Frans Hendriks has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/49963 )
Change subject: device: Correct code style ......................................................................
device: Correct code style
lint report errors and warnings
Solve the next issues: - BRACES - EMBEDDED_FUNCTION_NAME - MULTILINE_DEREFERNCE - POINTER_LOCATION - UNNECSSARY_ELSE
BUG = N/A TEST = Build Compulab Intense-PC with secure oprom enabled
Change-Id: I780251d946d5bea97658476d61d25555ec768dfc Signed-off-by: Frans Hendriks fhendriks@eltan.com --- M src/device/azalia_device.c M src/device/device.c M src/device/device_const.c M src/device/device_util.c M src/device/i2c_bus.c 5 files changed, 38 insertions(+), 40 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/63/49963/1
diff --git a/src/device/azalia_device.c b/src/device/azalia_device.c index e1899f1..e383821 100644 --- a/src/device/azalia_device.c +++ b/src/device/azalia_device.c @@ -174,9 +174,9 @@ reg32 |= HDA_ICII_BUSY | HDA_ICII_VALID; write32(base + HDA_ICII_REG, reg32);
- while (timeout--) { + while (timeout--) udelay(1); - } + timeout = 50; while (timeout--) { reg32 = read32(base + HDA_ICII_REG); diff --git a/src/device/device.c b/src/device/device.c index ffdfeac..6e05a6f 100644 --- a/src/device/device.c +++ b/src/device/device.c @@ -166,8 +166,8 @@
if (!curdev->ops || !curdev->ops->read_resources) { if (curdev->path.type != DEVICE_PATH_APIC) - printk(BIOS_ERR, "%s missing read_resources\n", - dev_path(curdev)); + printk(BIOS_ERR, "%s %s missing\n", + dev_path(curdev), __func__); continue; } post_log_path(curdev); @@ -178,8 +178,8 @@ read_resources(link); } post_log_clear(); - printk(BIOS_SPEW, "%s read_resources bus %d link: %d done\n", - dev_path(bus->dev), bus->secondary, bus->link_num); + printk(BIOS_SPEW, "%s %s bus %d link: %d done\n", + dev_path(bus->dev), __func__, bus->secondary, bus->link_num); }
struct device *vga_pri = NULL; @@ -210,11 +210,10 @@ "A bridge on the path doesn't support 16-bit VGA decoding!"); }
- if (dev->on_mainboard) { + if (dev->on_mainboard) vga_onboard = dev; - } else { + else vga = dev; - }
/* It isn't safe to enable all VGA cards. */ dev->command &= ~(PCI_COMMAND_MEMORY | PCI_COMMAND_IO); @@ -269,8 +268,8 @@ { struct device *curdev;
- printk(BIOS_SPEW, "%s assign_resources, bus %d link: %d\n", - dev_path(bus->dev), bus->secondary, bus->link_num); + printk(BIOS_SPEW, "%s %s, bus %d link: %d\n", + dev_path(bus->dev), __func__, bus->secondary, bus->link_num);
for (curdev = bus->children; curdev; curdev = curdev->sibling) { if (!curdev->enabled || !curdev->resource_list) @@ -285,8 +284,8 @@ curdev->ops->set_resources(curdev); } post_log_clear(); - printk(BIOS_SPEW, "%s assign_resources, bus %d link: %d\n", - dev_path(bus->dev), bus->secondary, bus->link_num); + printk(BIOS_SPEW, "%s %s, bus %d link: %d\n", + dev_path(bus->dev), __func__, bus->secondary, bus->link_num); }
/** diff --git a/src/device/device_const.c b/src/device/device_const.c index 5288a74..2ce76c6 100644 --- a/src/device/device_const.c +++ b/src/device/device_const.c @@ -9,7 +9,7 @@ #include <device/resource.h>
/** Linked list of ALL devices */ -DEVTREE_CONST struct device * DEVTREE_CONST all_devices = &dev_root; +DEVTREE_CONST struct device *DEVTREE_CONST all_devices = &dev_root;
/** * Given a PCI bus and a devfn number, find the device structure. diff --git a/src/device/device_util.c b/src/device/device_util.c index 0bce26a..d72d94f 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -370,7 +370,8 @@ resource->next = NULL; tail = dev->resource_list; if (tail) { - while (tail->next) tail = tail->next; + while (tail->next) + tail = tail->next; tail->next = resource; } else { dev->resource_list = resource; @@ -555,7 +556,7 @@
/* If it is a subtractive resource recurse. */ if (res->flags & IORESOURCE_SUBTRACTIVE) { - struct bus * subbus; + struct bus *subbus; for (subbus = curdev->link_list; subbus; subbus = subbus->next) if (subbus->link_num @@ -604,11 +605,10 @@ return;
dev->enabled = enable; - if (dev->ops && dev->ops->enable) { + if (dev->ops && dev->ops->enable) dev->ops->enable(dev); - } else if (dev->chip_ops && dev->chip_ops->enable_dev) { + else if (dev->chip_ops && dev->chip_ops->enable_dev) dev->chip_ops->enable_dev(dev); - } }
void disable_children(struct bus *bus) @@ -814,7 +814,7 @@ buf, resource_type(resource), comment); }
-void show_all_devs_resources(int debug_level, const char* msg) +void show_all_devs_resources(int debug_level, const char *msg) { struct device *dev;
diff --git a/src/device/i2c_bus.c b/src/device/i2c_bus.c index a65cdad..858a649 100644 --- a/src/device/i2c_bus.c +++ b/src/device/i2c_bus.c @@ -48,19 +48,18 @@ .len = sizeof(val), };
- const int ret = busdev->ops->ops_i2c_bus-> - transfer(busdev, &msg, 1); + const int ret = busdev->ops->ops_i2c_bus->transfer(busdev, &msg, 1); if (ret) return ret; else return val; } else if (busdev->ops->ops_smbus_bus->recv_byte) { return busdev->ops->ops_smbus_bus->recv_byte(dev); - } else { - printk(BIOS_ERR, "%s Missing ops_smbus_bus->recv_byte", - dev_path(busdev)); - return -1; } + + printk(BIOS_ERR, "%s Missing ops_smbus_bus->recv_byte", + dev_path(busdev)); + return -1; }
int i2c_dev_writeb(struct device *const dev, uint8_t val) @@ -79,11 +78,11 @@ return busdev->ops->ops_i2c_bus->transfer(busdev, &msg, 1); } else if (busdev->ops->ops_smbus_bus->send_byte) { return busdev->ops->ops_smbus_bus->send_byte(dev, val); - } else { - printk(BIOS_ERR, "%s Missing ops_smbus_bus->send_byte", - dev_path(busdev)); - return -1; } + + printk(BIOS_ERR, "%s Missing ops_smbus_bus->send_byte", + dev_path(busdev)); + return -1; }
int i2c_dev_readb_at(struct device *const dev, uint8_t off) @@ -109,19 +108,19 @@ }, };
- const int ret = busdev->ops->ops_i2c_bus-> - transfer(busdev, msg, ARRAY_SIZE(msg)); + const int ret = busdev->ops->ops_i2c_bus->transfer(busdev, msg, + ARRAY_SIZE(msg)); if (ret) return ret; else return val; } else if (busdev->ops->ops_smbus_bus->read_byte) { return busdev->ops->ops_smbus_bus->read_byte(dev, off); - } else { - printk(BIOS_ERR, "%s Missing ops_smbus_bus->read_byte", - dev_path(busdev)); - return -1; } + + printk(BIOS_ERR, "%s Missing ops_smbus_bus->read_byte", + dev_path(busdev)); + return -1; }
int i2c_dev_writeb_at(struct device *const dev, @@ -142,11 +141,11 @@ return busdev->ops->ops_i2c_bus->transfer(busdev, &msg, 1); } else if (busdev->ops->ops_smbus_bus->write_byte) { return busdev->ops->ops_smbus_bus->write_byte(dev, off, val); - } else { - printk(BIOS_ERR, "%s Missing ops_smbus_bus->write_byte", - dev_path(busdev)); - return -1; } + + printk(BIOS_ERR, "%s Missing ops_smbus_bus->write_byte", + dev_path(busdev)); + return -1; }
int i2c_dev_read_at16(struct device *const dev,