openwrt/target/linux/lantiq/patches-6.6/0701-NET-lantiq-etop-of-mido.patch
Aleksander Jan Bajkowski ccfc454548 lantiq: fix checkpatch warnings in etop driver
This commit fixes all errors reported by the checkpatch script. This
should make it easier to accept upstream this patch.

There should be no functional changes.

Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://github.com/openwrt/openwrt/pull/15939
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-07-21 14:07:26 +02:00

48 lines
1.4 KiB
Diff

From 870ed9cae083ff8a60a739ef7e74c5a1800533be Mon Sep 17 00:00:00 2001
From: Johann Neuhauser <johann@it-neuhauser.de>
Date: Thu, 17 May 2018 19:12:35 +0200
Subject: [PATCH] net: lantiq_etop: of mdio
Signed-off-by: Johann Neuhauser <johann@it-neuhauser.de>
---
drivers/net/ethernet/lantiq_etop.c | 555 +++++++++++++++++++++++++-----------
1 file changed, 389 insertions(+), 166 deletions(-)
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -31,6 +31,7 @@
#include <linux/of_net.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
+#include <linux/of_mdio.h>
#include <asm/checksum.h>
@@ -561,7 +562,8 @@ static int
ltq_etop_mdio_init(struct net_device *dev)
{
struct ltq_etop_priv *priv = netdev_priv(dev);
- int err;
+ struct device_node *mdio_np = NULL;
+ int err, ret;
priv->mii_bus = mdiobus_alloc();
if (!priv->mii_bus) {
@@ -581,7 +583,15 @@ ltq_etop_mdio_init(struct net_device *de
priv->mii_bus->name = "ltq_mii";
snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
priv->pdev->name, priv->pdev->id);
- if (mdiobus_register(priv->mii_bus)) {
+
+ mdio_np = of_get_child_by_name(priv->pdev->dev.of_node, "mdio-bus");
+
+ if (mdio_np)
+ ret = of_mdiobus_register(priv->mii_bus, mdio_np);
+ else
+ ret = mdiobus_register(priv->mii_bus);
+
+ if (ret) {
err = -ENXIO;
goto err_out_free_mdiobus;
}