]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
PCI: rpadlpar: Use for_each_child_of_node() and for_each_node_by_name()
authorQinglang Miao <miaoqinglang@huawei.com>
Wed, 16 Sep 2020 06:21:28 +0000 (14:21 +0800)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 17 Sep 2020 21:22:36 +0000 (16:22 -0500)
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.com
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/hotplug/rpadlpar_core.c

index f979b7098acf3448a638caea7a53ad86d3025612..0a3c80ba66be4c4e48098fa7efa0f0972c504b88 100644 (file)
@@ -40,13 +40,13 @@ static DEFINE_MUTEX(rpadlpar_mutex);
 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 *dn = NULL;
+       struct device_node *dn;
        int rc;
 
        if (!parent)
                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);
                if (rc == 0)
                        break;
@@ -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,
                                                  char *drc_type)
 {
-       struct device_node *np = NULL;
+       struct device_node *np;
        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);
                if (rc == 0)
                        break;