diff mbox series

[net-next,v2] net: sfp: Unique GPIO interrupt names

Message ID CAFXsbZoOoOkgkxXNbG5JTXHdJiSoxu2OiHKHh39m3GfYE2jGcg@mail.gmail.com
State Awaiting Upstream
Delegated to: David Miller
Headers show
Series [net-next,v2] net: sfp: Unique GPIO interrupt names | expand

Commit Message

Chris Healy July 7, 2020, 12:24 a.m. UTC
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.

Signed-off-by: Chris Healy <cphealy@gmail.com>

v2:
- added net-next to PATCH part of subject line
- switched to devm_kasprintf()
---
 drivers/net/phy/sfp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Andrew Lunn July 7, 2020, 12:40 a.m. UTC | #1
> diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
> index 73c2969f11a4..193a124c26c4 100644
> --- a/drivers/net/phy/sfp.c
> +++ b/drivers/net/phy/sfp.c
> @@ -2239,6 +2239,7 @@ static int sfp_probe(struct platform_device *pdev)
>      const struct sff_data *sff;
>      struct i2c_adapter *i2c;
>      struct sfp *sfp;
> +    char *sfp_irq_name;
>      int err, i;

Hi Chris

Reverse Christmas tree.

> 
>      sfp = sfp_alloc(&pdev->dev);
> @@ -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]);
> +

Did you run ./scripts/checkpatch.pl on this patch? I suspect it will
complain about spaces, not tabs.

Humm, actually, all tabs seem to of been converted to spaces.

Something David often recommends. email the patch to yourself, and
then apply it using git am. If it does not apply cleanly, something
has mangled it.

    Andrew
diff mbox series

Patch

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 73c2969f11a4..193a124c26c4 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -2239,6 +2239,7 @@  static int sfp_probe(struct platform_device *pdev)
     const struct sff_data *sff;
     struct i2c_adapter *i2c;
     struct sfp *sfp;
+    char *sfp_irq_name;
     int err, i;

     sfp = sfp_alloc(&pdev->dev);
@@ -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;