Thread (20 messages) 20 messages, 2 authors, 2021-04-16

Re: [PATCH v3 net-next 07/10] net: korina: Add support for device tree

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-04-15 23:49:17
Also in: lkml

-	memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
+	if (mac_addr) {
+		ether_addr_copy(dev->dev_addr, mac_addr);
+	} else {
+		u8 ofmac[ETH_ALEN];
+
+		if (of_get_mac_address(pdev->dev.of_node, ofmac) == 0)
+			ether_addr_copy(dev->dev_addr, ofmac);
You should be able to skip the ether_addr_copy() by passing 
dev->dev_addr directly to of_get_mac_address().
quoted hunk ↗ jump to hunk
+		else
+			eth_hw_addr_random(dev);
+	}
 
 	lp->rx_irq = platform_get_irq_byname(pdev, "korina_rx");
 	lp->tx_irq = platform_get_irq_byname(pdev, "korina_tx");
@@ -1146,8 +1157,21 @@ static int korina_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id korina_match[] = {
+	{
+		.compatible = "idt,3243x-emac",
You need to document this compatible somewhere under Documentation/devicetree/binding

    Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help