mtk_eth_soc:add support for mtk eth soc label name setting

This commit is contained in:
padavanonly 2024-09-18 02:02:02 +08:00
parent 81c7963be2
commit dad29c8636

View File

@ -3418,6 +3418,7 @@ static const struct net_device_ops mtk_netdev_ops = {
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
{
const __be32 *_id = of_get_property(np, "reg", NULL);
const char *label = of_get_property(np, "label", NULL);
struct phylink *phylink;
int phy_mode, id, err;
struct mtk_mac *mac;
@ -3438,9 +3439,10 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
return -EINVAL;
}
eth->netdev[id] = alloc_etherdev(sizeof(*mac));
eth->netdev[id] = alloc_netdev(sizeof(*mac), label ? label : "eth%d",
NET_NAME_UNKNOWN, ether_setup);
if (!eth->netdev[id]) {
dev_err(eth->dev, "alloc_etherdev failed\n");
dev_err(eth->dev, "alloc_netdev failed\n");
return -ENOMEM;
}
mac = netdev_priv(eth->netdev[id]);