summaryrefslogtreecommitdiff
path: root/src/soc/amd
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd')
-rw-r--r--src/soc/amd/common/block/acpi/ivrs.c11
-rw-r--r--src/soc/amd/common/block/lpc/lpc.c24
-rw-r--r--src/soc/amd/stoneyridge/northbridge.c20
3 files changed, 22 insertions, 33 deletions
diff --git a/src/soc/amd/common/block/acpi/ivrs.c b/src/soc/amd/common/block/acpi/ivrs.c
index 9d0ece1d6c..57b5974e71 100644
--- a/src/soc/amd/common/block/acpi/ivrs.c
+++ b/src/soc/amd/common/block/acpi/ivrs.c
@@ -140,7 +140,6 @@ static void add_ivhd_device_entries(struct device *parent, struct device *dev,
unsigned long *current, uint16_t nb_bus)
{
struct device *sibling;
- struct bus *link;
if (!root_level)
return;
@@ -155,11 +154,11 @@ static void add_ivhd_device_entries(struct device *parent, struct device *dev,
ivrs_add_device_or_bridge(parent, dev, current);
}
- for (link = dev->link_list; link; link = link->next)
- for (sibling = link->children; sibling; sibling =
- sibling->sibling)
- add_ivhd_device_entries(dev, sibling, depth + 1, depth, root_level,
- current, nb_bus);
+ if (!dev->link_list)
+ return;
+ for (sibling = dev->link_list->children; sibling; sibling = sibling->sibling)
+ add_ivhd_device_entries(dev, sibling, depth + 1, depth, root_level, current,
+ nb_bus);
}
static unsigned long acpi_ivhd_misc(unsigned long current, struct device *dev)
diff --git a/src/soc/amd/common/block/lpc/lpc.c b/src/soc/amd/common/block/lpc/lpc.c
index 4e81316881..c076361080 100644
--- a/src/soc/amd/common/block/lpc/lpc.c
+++ b/src/soc/amd/common/block/lpc/lpc.c
@@ -278,20 +278,20 @@ static void configure_child_espi_windows(struct device *child)
static void lpc_enable_children_resources(struct device *dev)
{
- struct bus *link;
struct device *child;
- for (link = dev->link_list; link; link = link->next) {
- for (child = link->children; child; child = child->sibling) {
- if (!child->enabled)
- continue;
- if (child->path.type != DEVICE_PATH_PNP)
- continue;
- if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI))
- configure_child_espi_windows(child);
- else
- configure_child_lpc_windows(dev, child);
- }
+ if (!dev->link_list)
+ return;
+
+ for (child = dev->link_list->children; child; child = child->sibling) {
+ if (!child->enabled)
+ continue;
+ if (child->path.type != DEVICE_PATH_PNP)
+ continue;
+ if (CONFIG(SOC_AMD_COMMON_BLOCK_USE_ESPI))
+ configure_child_espi_windows(child);
+ else
+ configure_child_lpc_windows(dev, child);
}
}
diff --git a/src/soc/amd/stoneyridge/northbridge.c b/src/soc/amd/stoneyridge/northbridge.c
index deebfb351f..b95c4cdf2e 100644
--- a/src/soc/amd/stoneyridge/northbridge.c
+++ b/src/soc/amd/stoneyridge/northbridge.c
@@ -52,16 +52,9 @@ static void read_resources(struct device *dev)
static void create_vga_resource(struct device *dev)
{
- struct bus *link;
-
- /* find out which link the VGA card is connected,
- * we only deal with the 'first' vga card */
- for (link = dev->link_list ; link ; link = link->next)
- if (link->bridge_ctrl & PCI_BRIDGE_CTL_VGA)
- break;
-
- /* no VGA card installed */
- if (link == NULL)
+ if (!dev->link_list)
+ return;
+ if (!(dev->link_list->bridge_ctrl & PCI_BRIDGE_CTL_VGA))
return;
printk(BIOS_DEBUG, "VGA: %s has VGA device\n", dev_path(dev));
@@ -71,14 +64,11 @@ static void create_vga_resource(struct device *dev)
static void set_resources(struct device *dev)
{
- struct bus *bus;
-
/* do we need this? */
create_vga_resource(dev);
- for (bus = dev->link_list ; bus ; bus = bus->next)
- if (bus->children)
- assign_resources(bus);
+ if (dev->link_list && dev->link_list->children)
+ assign_resources(dev->link_list);
}
static void northbridge_init(struct device *dev)