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,9 +408,12 @@ int cvm_oct_common_init(struct net_devic
17 struct octeon_ethernet *priv = netdev_priv(dev);
19 + const u8 *label = NULL;
22 + if (priv->of_node) {
23 mac = of_get_mac_address(priv->of_node);
24 + label = of_get_property(priv->of_node, "label", NULL);
27 if (!IS_ERR_OR_NULL(mac))
28 ether_addr_copy(dev->dev_addr, mac);
29 @@ -445,6 +448,9 @@ int cvm_oct_common_init(struct net_devic
30 if (dev->netdev_ops->ndo_stop)
31 dev->netdev_ops->ndo_stop(dev);
33 + if (!IS_ERR_OR_NULL(label))
34 + dev_alloc_name(dev, label);