Skip to content

Instantly share code, notes, and snippets.

@damex
Created October 28, 2020 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damex/010880e0ecf08a432551e115acc6eed1 to your computer and use it in GitHub Desktop.
Save damex/010880e0ecf08a432551e115acc6eed1 to your computer and use it in GitHub Desktop.
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -407,9 +407,12 @@
{
struct octeon_ethernet *priv = netdev_priv(dev);
const u8 *mac = NULL;
+ const u8 *label = NULL;
- if (priv->of_node)
+ if (priv->of_node) {
mac = of_get_mac_address(priv->of_node);
+ label = of_get_property(priv->of_node, "label", NULL);
+ }
if (!IS_ERR_OR_NULL(mac))
ether_addr_copy(dev->dev_addr, mac);
@@ -444,6 +447,9 @@
if (dev->netdev_ops->ndo_stop)
dev->netdev_ops->ndo_stop(dev);
+ if (!IS_ERR_OR_NULL(label))
+ dev_change_name(dev, label);
+
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment