]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: vertexcom: mse102x: Add warning about IRQ trigger type
authorStefan Wahren <wahrenst@gmx.net>
Fri, 9 May 2025 12:04:31 +0000 (14:04 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 13 May 2025 01:46:44 +0000 (18:46 -0700)
The example of the initial DT binding of the Vertexcom MSE 102x suggested
a IRQ_TYPE_EDGE_RISING, which is wrong. So warn everyone to fix their
device tree to level based IRQ.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20250509120435.43646-3-wahrenst@gmx.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/vertexcom/mse102x.c

index e4d993f31374070a9b3ba7a1eed5c24ddd292776..78a50a68c567778cfd347061fbce8b4b29f6e277 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/if_vlan.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
@@ -522,10 +523,25 @@ static irqreturn_t mse102x_irq(int irq, void *_mse)
 
 static int mse102x_net_open(struct net_device *ndev)
 {
+       struct irq_data *irq_data = irq_get_irq_data(ndev->irq);
        struct mse102x_net *mse = netdev_priv(ndev);
        struct mse102x_net_spi *mses = to_mse102x_spi(mse);
        int ret;
 
+       if (!irq_data) {
+               netdev_err(ndev, "Invalid IRQ: %d\n", ndev->irq);
+               return -EINVAL;
+       }
+
+       switch (irqd_get_trigger_type(irq_data)) {
+       case IRQ_TYPE_LEVEL_HIGH:
+       case IRQ_TYPE_LEVEL_LOW:
+               break;
+       default:
+               netdev_warn_once(ndev, "Only IRQ type level recommended, please update your device tree firmware.\n");
+               break;
+       }
+
        ret = request_threaded_irq(ndev->irq, NULL, mse102x_irq, IRQF_ONESHOT,
                                   ndev->name, mse);
        if (ret < 0) {