kernel: add missing symbol to 5.4 config
[oweals/openwrt.git] / target / linux / lantiq / patches-5.4 / 0701-NET-lantiq-etop-of-mido.patch
1 --- a/drivers/net/ethernet/lantiq_etop.c
2 +++ b/drivers/net/ethernet/lantiq_etop.c
3 @@ -30,6 +30,7 @@
4  #include <linux/of_net.h>
5  #include <linux/of_irq.h>
6  #include <linux/of_platform.h>
7 +#include <linux/of_mdio.h>
8  
9  #include <asm/checksum.h>
10  
11 @@ -553,7 +554,8 @@ static int
12  ltq_etop_mdio_init(struct net_device *dev)
13  {
14         struct ltq_etop_priv *priv = netdev_priv(dev);
15 -       int err;
16 +       struct device_node *mdio_np = NULL;
17 +       int err, ret;
18  
19         priv->mii_bus = mdiobus_alloc();
20         if (!priv->mii_bus) {
21 @@ -573,7 +575,15 @@ ltq_etop_mdio_init(struct net_device *de
22         priv->mii_bus->name = "ltq_mii";
23         snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
24                 priv->pdev->name, priv->pdev->id);
25 -       if (mdiobus_register(priv->mii_bus)) {
26 +
27 +       mdio_np = of_get_child_by_name(priv->pdev->dev.of_node, "mdio-bus");
28 +
29 +       if (mdio_np)
30 +               ret = of_mdiobus_register(priv->mii_bus, mdio_np);
31 +       else
32 +               ret = mdiobus_register(priv->mii_bus);
33 +
34 +       if (ret) {
35                 err = -ENXIO;
36                 goto err_out_free_mdiobus;
37         }