All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v3] net: sfp: Unique GPIO interrupt names
@ 2020-07-07  1:27 Chris Healy
  2020-07-07 19:45 ` David Miller
       [not found] ` <CAHp75VedcWazv9=KkWXU75SP3giPtBXvyDF3dQbCEETRM5bjaQ@mail.gmail.com>
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Healy @ 2020-07-07  1:27 UTC (permalink / raw)
  To: linux, andrew, f.fainelli, hkallweit1, davem, kuba, netdev, linux-kernel
  Cc: Chris Healy

From: Chris Healy <cphealy@gmail.com>

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>

v3:
- reverse Christmas tree new variable
- fix spaces vs tabs
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(-)

diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
index 73c2969f11a4..7bdfcde98266 100644
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
@@ -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;
-- 
2.21.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v3] net: sfp: Unique GPIO interrupt names
  2020-07-07  1:27 [PATCH net-next v3] net: sfp: Unique GPIO interrupt names Chris Healy
@ 2020-07-07 19:45 ` David Miller
       [not found] ` <CAHp75VedcWazv9=KkWXU75SP3giPtBXvyDF3dQbCEETRM5bjaQ@mail.gmail.com>
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-07-07 19:45 UTC (permalink / raw)
  To: cphealy; +Cc: linux, andrew, f.fainelli, hkallweit1, kuba, netdev, linux-kernel

From: Chris Healy <cphealy@gmail.com>
Date: Mon,  6 Jul 2020 18:27:07 -0700

> From: Chris Healy <cphealy@gmail.com>
> 
> 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>
> 
> v3:
> - reverse Christmas tree new variable
> - fix spaces vs tabs
> v2:
> - added net-next to PATCH part of subject line
> - switched to devm_kasprintf()

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v3] net: sfp: Unique GPIO interrupt names
       [not found] ` <CAHp75VedcWazv9=KkWXU75SP3giPtBXvyDF3dQbCEETRM5bjaQ@mail.gmail.com>
@ 2020-07-07 19:52   ` Chris Healy
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Healy @ 2020-07-07 19:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux, andrew, f.fainelli, hkallweit1, davem, kuba, netdev, linux-kernel

On Mon, Jul 6, 2020 at 11:52 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
>
>
> On Tuesday, July 7, 2020, Chris Healy <cphealy@gmail.com> wrote:
>>
>> From: Chris Healy <cphealy@gmail.com>
>>
>> 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>
>>
>> v3:
>> - reverse Christmas tree new variable
>> - fix spaces vs tabs
>> 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(-)
>>
>> diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c
>> index 73c2969f11a4..7bdfcde98266 100644
>> --- a/drivers/net/phy/sfp.c
>> +++ b/drivers/net/phy/sfp.c
>> @@ -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]);
>
>
>
> No error check? Why?

Good point.  I will add this.  I see this patch was just applied so
I'll submit a follow on patch to add the appropriate error check.

>
>
>>
>> +
>>                 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;
>> --
>> 2.21.3
>>
>
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-07 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-07  1:27 [PATCH net-next v3] net: sfp: Unique GPIO interrupt names Chris Healy
2020-07-07 19:45 ` David Miller
     [not found] ` <CAHp75VedcWazv9=KkWXU75SP3giPtBXvyDF3dQbCEETRM5bjaQ@mail.gmail.com>
2020-07-07 19:52   ` Chris Healy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.