]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
w5100: remove unused gpio link detection
authorArnd Bergmann <arnd@arndb.de>
Tue, 5 May 2026 18:04:59 +0000 (20:04 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 7 May 2026 02:18:45 +0000 (19:18 -0700)
Since the platform_device support is now gone, nothing ever passes a
valid gpio number, and all the link state handling can go away.

An earlier version of my patch changed this to look up the GPIO descriptor
from devicetree and convert it all to the modern interface, but there
are no users of that binding at the moment.

Remove the gpio handling, which is now one of the last users of the
legacy gpio interface in platform-independent code.

Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/all/20230127095839.3266452-1-arnd@kernel.org/
Link: https://patch.msgid.link/20260505180459.1247690-3-arnd@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/wiznet/w5100-spi.c
drivers/net/ethernet/wiznet/w5100.c
drivers/net/ethernet/wiznet/w5100.h

index 990a3cce8c0fcc146ae2f0ad189f6f8f5f91787f..d2c5e99ab9c798ffa55e76997b0af7931331a3ae 100644 (file)
@@ -450,7 +450,7 @@ static int w5100_spi_probe(struct spi_device *spi)
                return -EINVAL;
        }
 
-       return w5100_probe(&spi->dev, ops, priv_size, mac, spi->irq, -EINVAL);
+       return w5100_probe(&spi->dev, ops, priv_size, mac, spi->irq);
 }
 
 static void w5100_spi_remove(struct spi_device *spi)
index cfe6813ce80533b36c7a6deb7c0eee4055245e4d..53d8dc642fbd60a5ce3f346bffa4fc357c9b973e 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
-#include <linux/gpio.h>
 
 #include "w5100.h"
 
@@ -155,8 +154,6 @@ struct w5100_priv {
        u16 s0_rx_buf_size;
 
        int irq;
-       int link_irq;
-       int link_gpio;
 
        struct napi_struct napi;
        struct net_device *ndev;
@@ -417,16 +414,6 @@ static void w5100_get_drvinfo(struct net_device *ndev,
                sizeof(info->bus_info));
 }
 
-static u32 w5100_get_link(struct net_device *ndev)
-{
-       struct w5100_priv *priv = netdev_priv(ndev);
-
-       if (gpio_is_valid(priv->link_gpio))
-               return !!gpio_get_value(priv->link_gpio);
-
-       return 1;
-}
-
 static u32 w5100_get_msglevel(struct net_device *ndev)
 {
        struct w5100_priv *priv = netdev_priv(ndev);
@@ -629,24 +616,6 @@ static irqreturn_t w5100_interrupt(int irq, void *ndev_instance)
        return IRQ_HANDLED;
 }
 
-static irqreturn_t w5100_detect_link(int irq, void *ndev_instance)
-{
-       struct net_device *ndev = ndev_instance;
-       struct w5100_priv *priv = netdev_priv(ndev);
-
-       if (netif_running(ndev)) {
-               if (gpio_get_value(priv->link_gpio) != 0) {
-                       netif_info(priv, link, ndev, "link is up\n");
-                       netif_carrier_on(ndev);
-               } else {
-                       netif_info(priv, link, ndev, "link is down\n");
-                       netif_carrier_off(ndev);
-               }
-       }
-
-       return IRQ_HANDLED;
-}
-
 static void w5100_setrx_work(struct work_struct *work)
 {
        struct w5100_priv *priv = container_of(work, struct w5100_priv,
@@ -690,9 +659,6 @@ static int w5100_open(struct net_device *ndev)
        w5100_hw_start(priv);
        napi_enable(&priv->napi);
        netif_start_queue(ndev);
-       if (!gpio_is_valid(priv->link_gpio) ||
-           gpio_get_value(priv->link_gpio) != 0)
-               netif_carrier_on(ndev);
        return 0;
 }
 
@@ -712,7 +678,6 @@ static const struct ethtool_ops w5100_ethtool_ops = {
        .get_drvinfo            = w5100_get_drvinfo,
        .get_msglevel           = w5100_get_msglevel,
        .set_msglevel           = w5100_set_msglevel,
-       .get_link               = w5100_get_link,
        .get_regs_len           = w5100_get_regs_len,
        .get_regs               = w5100_get_regs,
 };
@@ -735,8 +700,7 @@ void *w5100_ops_priv(const struct net_device *ndev)
 EXPORT_SYMBOL_GPL(w5100_ops_priv);
 
 int w5100_probe(struct device *dev, const struct w5100_ops *ops,
-               int sizeof_ops_priv, const void *mac_addr, int irq,
-               int link_gpio)
+               int sizeof_ops_priv, const void *mac_addr, int irq)
 {
        struct w5100_priv *priv;
        struct net_device *ndev;
@@ -787,7 +751,6 @@ int w5100_probe(struct device *dev, const struct w5100_ops *ops,
        priv->ndev = ndev;
        priv->ops = ops;
        priv->irq = irq;
-       priv->link_gpio = link_gpio;
 
        ndev->netdev_ops = &w5100_netdev_ops;
        ndev->ethtool_ops = &w5100_ethtool_ops;
@@ -840,26 +803,8 @@ int w5100_probe(struct device *dev, const struct w5100_ops *ops,
        if (err)
                goto err_hw;
 
-       if (gpio_is_valid(priv->link_gpio)) {
-               char *link_name = devm_kzalloc(dev, 16, GFP_KERNEL);
-
-               if (!link_name) {
-                       err = -ENOMEM;
-                       goto err_gpio;
-               }
-               snprintf(link_name, 16, "%s-link", netdev_name(ndev));
-               priv->link_irq = gpio_to_irq(priv->link_gpio);
-               if (request_any_context_irq(priv->link_irq, w5100_detect_link,
-                                           IRQF_TRIGGER_RISING |
-                                           IRQF_TRIGGER_FALLING,
-                                           link_name, priv->ndev) < 0)
-                       priv->link_gpio = -EINVAL;
-       }
-
        return 0;
 
-err_gpio:
-       free_irq(priv->irq, ndev);
 err_hw:
        destroy_workqueue(priv->xfer_wq);
 err_wq:
@@ -877,8 +822,6 @@ void w5100_remove(struct device *dev)
 
        w5100_hw_reset(priv);
        free_irq(priv->irq, ndev);
-       if (gpio_is_valid(priv->link_gpio))
-               free_irq(priv->link_irq, ndev);
 
        flush_work(&priv->setrx_work);
        flush_work(&priv->restart_work);
@@ -914,9 +857,6 @@ static int w5100_resume(struct device *dev)
                w5100_hw_start(priv);
 
                netif_device_attach(ndev);
-               if (!gpio_is_valid(priv->link_gpio) ||
-                   gpio_get_value(priv->link_gpio) != 0)
-                       netif_carrier_on(ndev);
        }
        return 0;
 }
index 481af3b6d9e8c65dbab042f7772484f70c208cee..76e1b8149041f77616ec1fe7bd85b4ed20550593 100644 (file)
@@ -29,8 +29,7 @@ struct w5100_ops {
 void *w5100_ops_priv(const struct net_device *ndev);
 
 int w5100_probe(struct device *dev, const struct w5100_ops *ops,
-               int sizeof_ops_priv, const void *mac_addr, int irq,
-               int link_gpio);
+               int sizeof_ops_priv, const void *mac_addr, int irq);
 void w5100_remove(struct device *dev);
 
 extern const struct dev_pm_ops w5100_pm_ops;