Commit 85d79c52 authored by Qinglang Miao's avatar Qinglang Miao Committed by Bjorn Helgaas

PCI: rpadlpar: Use for_each_child_of_node() and for_each_node_by_name()

Use for_each_child_of_node() and for_each_node_by_name() macros instead of
open coding them.

Link: https://lore.kernel.org/r/20200916062128.190819-1-miaoqinglang@huawei.comSigned-off-by: default avatarQinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 9123e3a7
...@@ -40,13 +40,13 @@ static DEFINE_MUTEX(rpadlpar_mutex); ...@@ -40,13 +40,13 @@ static DEFINE_MUTEX(rpadlpar_mutex);
static struct device_node *find_vio_slot_node(char *drc_name) static struct device_node *find_vio_slot_node(char *drc_name)
{ {
struct device_node *parent = of_find_node_by_name(NULL, "vdevice"); struct device_node *parent = of_find_node_by_name(NULL, "vdevice");
struct device_node *dn = NULL; struct device_node *dn;
int rc; int rc;
if (!parent) if (!parent)
return NULL; return NULL;
while ((dn = of_get_next_child(parent, dn))) { for_each_child_of_node(parent, dn) {
rc = rpaphp_check_drc_props(dn, drc_name, NULL); rc = rpaphp_check_drc_props(dn, drc_name, NULL);
if (rc == 0) if (rc == 0)
break; break;
...@@ -60,10 +60,10 @@ static struct device_node *find_vio_slot_node(char *drc_name) ...@@ -60,10 +60,10 @@ static struct device_node *find_vio_slot_node(char *drc_name)
static struct device_node *find_php_slot_pci_node(char *drc_name, static struct device_node *find_php_slot_pci_node(char *drc_name,
char *drc_type) char *drc_type)
{ {
struct device_node *np = NULL; struct device_node *np;
int rc; int rc;
while ((np = of_find_node_by_name(np, "pci"))) { for_each_node_by_name(np, "pci") {
rc = rpaphp_check_drc_props(np, drc_name, drc_type); rc = rpaphp_check_drc_props(np, drc_name, drc_type);
if (rc == 0) if (rc == 0)
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment