]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
net: sfp: Unique GPIO interrupt names
authorChris Healy <cphealy@gmail.com>
Tue, 7 Jul 2020 01:27:07 +0000 (18:27 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Jul 2020 19:45:39 +0000 (12:45 -0700)
Dynamically generate a unique GPIO interrupt name, based on the
device name and the GPIO name.  For example:

103:          0   sx1503q  12 Edge      sff2-los
104:          0   sx1503q  13 Edge      sff2-tx-fault

The sffX indicates the SFP the los and tx-fault are associated with.

v3:
- reverse Christmas tree new variable
- fix spaces vs tabs
v2:
- added net-next to PATCH part of subject line
- switched to devm_kasprintf()

Signed-off-by: Chris Healy <cphealy@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/sfp.c

index 73c2969f11a4b200fee352b78115cb967219307b..7bdfcde98266c258d34a89ff8065132dca14ae85 100644 (file)
@@ -2238,6 +2238,7 @@ static int sfp_probe(struct platform_device *pdev)
 {
        const struct sff_data *sff;
        struct i2c_adapter *i2c;
+       char *sfp_irq_name;
        struct sfp *sfp;
        int err, i;
 
@@ -2349,12 +2350,16 @@ static int sfp_probe(struct platform_device *pdev)
                        continue;
                }
 
+               sfp_irq_name = devm_kasprintf(sfp->dev, GFP_KERNEL,
+                                             "%s-%s", dev_name(sfp->dev),
+                                             gpio_of_names[i]);
+
                err = devm_request_threaded_irq(sfp->dev, sfp->gpio_irq[i],
                                                NULL, sfp_irq,
                                                IRQF_ONESHOT |
                                                IRQF_TRIGGER_RISING |
                                                IRQF_TRIGGER_FALLING,
-                                               dev_name(sfp->dev), sfp);
+                                               sfp_irq_name, sfp);
                if (err) {
                        sfp->gpio_irq[i] = 0;
                        sfp->need_poll = true;