net: Use of_node_name_eq for node name comparisons
authorRob Herring <robh@kernel.org>
Wed, 5 Dec 2018 19:50:32 +0000 (13:50 -0600)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Dec 2018 04:51:05 +0000 (20:51 -0800)
Convert string compares of DT node names to use of_node_name_eq helper
instead. This removes direct access to the node name pointer.

For instances using of_node_cmp, this has the side effect of now using
case sensitive comparisons. This should not matter for any FDT based
system which all of these are.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Claudiu Manoil <claudiu.manoil@nxp.com>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Wingman Kwok <w-kwok2@ti.com>
Cc: Murali Karicheri <m-karicheri2@ti.com>
Cc: netdev@vger.kernel.org
Cc: linux-omap@vger.kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amd/sunlance.c
drivers/net/ethernet/freescale/gianfar.c
drivers/net/ethernet/sun/sunhme.c
drivers/net/ethernet/ti/cpsw.c
drivers/net/ethernet/ti/netcp_ethss.c

index 9d489982682336a7cef13186f20557a4a7d7daeb..bd6589de93d950e8cc9d657d4096f89adc20fdbe 100644 (file)
@@ -1488,9 +1488,9 @@ static int sunlance_sbus_probe(struct platform_device *op)
        struct device_node *parent_dp = parent->dev.of_node;
        int err;
 
-       if (!strcmp(parent_dp->name, "ledma")) {
+       if (of_node_name_eq(parent_dp, "ledma")) {
                err = sparc_lance_probe_one(op, parent, NULL);
-       } else if (!strcmp(parent_dp->name, "lebuffer")) {
+       } else if (of_node_name_eq(parent_dp, "lebuffer")) {
                err = sparc_lance_probe_one(op, NULL, parent);
        } else
                err = sparc_lance_probe_one(op, NULL, NULL);
index 0e102c764b133da2420d8adefc098a6b39e168fb..a831086601ebb1111d80d7e165a5ef76f0d88528 100644 (file)
@@ -720,7 +720,7 @@ static int gfar_of_group_count(struct device_node *np)
        int num = 0;
 
        for_each_available_child_of_node(np, child)
-               if (!of_node_cmp(child->name, "queue-group"))
+               if (of_node_name_eq(child, "queue-group"))
                        num++;
 
        return num;
@@ -838,7 +838,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
        /* Parse and initialize group specific information */
        if (priv->mode == MQ_MG_MODE) {
                for_each_available_child_of_node(np, child) {
-                       if (of_node_cmp(child->name, "queue-group"))
+                       if (!of_node_name_eq(child, "queue-group"))
                                continue;
 
                        err = gfar_parse_group(child, priv, model);
index 863fd602fd335b05c75fb4329b718521294e11a8..ff641cf30a4e1306baa5573bf5e7f464eaa5e729 100644 (file)
@@ -2691,7 +2691,7 @@ static int happy_meal_sbus_probe_one(struct platform_device *op, int is_qfe)
        sbus_dp = op->dev.parent->of_node;
 
        /* We can match PCI devices too, do not accept those here. */
-       if (strcmp(sbus_dp->name, "sbus") && strcmp(sbus_dp->name, "sbi"))
+       if (!of_node_name_eq(sbus_dp, "sbus") && !of_node_name_eq(sbus_dp, "sbi"))
                return err;
 
        if (is_qfe) {
index e4aa030f172686dd568a0b98b497e52595e4444d..0e8f61a29479201ec157f1e1cdd97e76d0851cc4 100644 (file)
@@ -3271,7 +3271,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
                const __be32 *parp;
 
                /* This is no slave child node, continue */
-               if (strcmp(slave_node->name, "slave"))
+               if (!of_node_name_eq(slave_node, "slave"))
                        continue;
 
                slave_data->phy_node = of_parse_phandle(slave_node,
@@ -3367,7 +3367,7 @@ static void cpsw_remove_dt(struct platform_device *pdev)
        for_each_available_child_of_node(node, slave_node) {
                struct cpsw_slave_data *slave_data = &data->slave_data[i];
 
-               if (strcmp(slave_node->name, "slave"))
+               if (!of_node_name_eq(slave_node, "slave"))
                        continue;
 
                if (of_phy_is_fixed_link(slave_node))
index 20d81e0b1c29703e0cfe4fd2a85fb715b9eb011e..5174d318901e0f74aa6fa6c7e12b29bfe2b362c7 100644 (file)
@@ -3623,7 +3623,7 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev,
                return -EINVAL;
        }
 
-       if (!strcmp(node->name, "gbe")) {
+       if (of_node_name_eq(node, "gbe")) {
                ret = get_gbe_resource_version(gbe_dev, node);
                if (ret)
                        return ret;
@@ -3637,7 +3637,7 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev,
                else
                        ret = -ENODEV;
 
-       } else if (!strcmp(node->name, "xgbe")) {
+       } else if (of_node_name_eq(node, "xgbe")) {
                ret = set_xgbe_ethss10_priv(gbe_dev, node);
                if (ret)
                        return ret;