1 From: Roman Kuzmitskii <damex.pp@icloud.com>
2 Date: Wed, 28 Oct 2020 19:00:00 +0000
3 Subject: [PATCH] staging: octeon: add net-labels support
5 With this patch, device name can be set within dts file
6 in the same way as dsa port can.
8 Add label to pip interface node to use this feature:
11 Tested-by: Johannes Kimmel <fff@bareminimum.eu>
12 Signed-off-by: Roman Kuzmitskii <damex.pp@icloud.com>
13 --- a/drivers/staging/octeon/ethernet.c
14 +++ b/drivers/staging/octeon/ethernet.c
15 @@ -408,7 +408,11 @@ int cvm_oct_common_init(struct net_devic
16 int cvm_oct_common_init(struct net_device *dev)
18 struct octeon_ethernet *priv = netdev_priv(dev);
19 + const u8 *label = NULL;
23 + label = of_get_property(priv->of_node, "label", NULL);
25 ret = of_get_mac_address(priv->of_node, dev->dev_addr);
27 @@ -445,6 +448,9 @@ int cvm_oct_common_init(struct net_devic
28 if (dev->netdev_ops->ndo_stop)
29 dev->netdev_ops->ndo_stop(dev);
31 + if (!IS_ERR_OR_NULL(label))
32 + dev_alloc_name(dev, label);