devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH net-next v2] dsa:mv88e6xxx: dispose irq mapping for chip->irq
       [not found] ` <1481106907-30908-1-git-send-email-volodymyr.bendiuga-qeDNsGSBLoYwFerOooGFRg@public.gmane.org>
@ 2016-12-07 14:11   ` Andrew Lunn
       [not found]     ` <20161207141144.GJ18817-g2DYL2Zd6BY@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2016-12-07 14:11 UTC (permalink / raw)
  To: Volodymyr Bendiuga
  Cc: vivien.didelot-4ysUXcep3aM1wj+D4I0NRVaTQe2KTcn/,
	f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA,
	volodymyr.bendiuga-Re5JQEeQqe8AvxtiuMwx3w, Rob Herring,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Wed, Dec 07, 2016 at 11:35:07AM +0100, Volodymyr Bendiuga wrote:
> Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga-qeDNsGSBLoYwFerOooGFRg@public.gmane.org>

You need some text in the Change log. Say why this change is needed,
etc.

Looking through other users of of_irq_get(), i don't see any disposing
of the mapping. It is not obvious you need to do this. The name does
not give any hint.

Maybe we should add an of_irq_put() which would clean up the mapping?

      Andrew


> ---
>  drivers/net/dsa/mv88e6xxx/chip.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
> index 173ea97..0c3271d 100644
> --- a/drivers/net/dsa/mv88e6xxx/chip.c
> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
> @@ -4483,7 +4483,7 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev)
>  		mutex_unlock(&chip->reg_lock);
>  
>  		if (err)
> -			goto out;
> +			goto out_dispose;
>  
>  		if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_G2_INT)) {
>  			err = mv88e6xxx_g2_irq_setup(chip);
> @@ -4513,6 +4513,9 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev)
>  		mv88e6xxx_g1_irq_free(chip);
>  		mutex_unlock(&chip->reg_lock);
>  	}
> +
> +out_dispose:
> +	irq_dispose_mapping(chip->irq);
>  out:
>  	return err;
>  }
> @@ -4530,6 +4533,7 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev)
>  		if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_G2_INT))
>  			mv88e6xxx_g2_irq_free(chip);
>  		mv88e6xxx_g1_irq_free(chip);
> +		irq_dispose_mapping(chip->irq);
>  	}
>  }
>  
> -- 
> 2.7.4
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH net-next v2] dsa:mv88e6xxx: dispose irq mapping for chip->irq
       [not found]     ` <20161207141144.GJ18817-g2DYL2Zd6BY@public.gmane.org>
@ 2016-12-07 16:40       ` Volodymyr Bendiuga
       [not found]         ` <4388a669-b425-97e0-346b-6b20f7f47f86-qeDNsGSBLoYwFerOooGFRg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Volodymyr Bendiuga @ 2016-12-07 16:40 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: vivien.didelot-4ysUXcep3aM1wj+D4I0NRVaTQe2KTcn/,
	f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA,
	volodymyr.bendiuga-Re5JQEeQqe8AvxtiuMwx3w, Rob Herring,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Yes, most of the users of of_irq_get() do not use irq_dispose_mapping().

But some of them do (some irq chips), and I believe the correct way of 
doing this is to

dispose irq mapping, as the description for this function says that it 
unmaps

the irq, which is mapped by of_irq_parse_and_map(). Not disposing irq 
might not make

any affect on most drivers, but some, that get EPROBE_DEFER error do 
need to dispose.

This is what I get when I run the code.

of_irq_put() could be implemented, and it would be a wrapper for 
irq_dispose_mapping()

as I can see it. Should I do it this way?


On 2016-12-07 15:11, Andrew Lunn wrote:
> On Wed, Dec 07, 2016 at 11:35:07AM +0100, Volodymyr Bendiuga wrote:
>> Signed-off-by: Volodymyr Bendiuga <volodymyr.bendiuga-qeDNsGSBLoYwFerOooGFRg@public.gmane.org>
> You need some text in the Change log. Say why this change is needed,
> etc.
>
> Looking through other users of of_irq_get(), i don't see any disposing
> of the mapping. It is not obvious you need to do this. The name does
> not give any hint.
>
> Maybe we should add an of_irq_put() which would clean up the mapping?
>
>        Andrew
>
>
>> ---
>>   drivers/net/dsa/mv88e6xxx/chip.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
>> index 173ea97..0c3271d 100644
>> --- a/drivers/net/dsa/mv88e6xxx/chip.c
>> +++ b/drivers/net/dsa/mv88e6xxx/chip.c
>> @@ -4483,7 +4483,7 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev)
>>   		mutex_unlock(&chip->reg_lock);
>>   
>>   		if (err)
>> -			goto out;
>> +			goto out_dispose;
>>   
>>   		if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_G2_INT)) {
>>   			err = mv88e6xxx_g2_irq_setup(chip);
>> @@ -4513,6 +4513,9 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev)
>>   		mv88e6xxx_g1_irq_free(chip);
>>   		mutex_unlock(&chip->reg_lock);
>>   	}
>> +
>> +out_dispose:
>> +	irq_dispose_mapping(chip->irq);
>>   out:
>>   	return err;
>>   }
>> @@ -4530,6 +4533,7 @@ static void mv88e6xxx_remove(struct mdio_device *mdiodev)
>>   		if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_G2_INT))
>>   			mv88e6xxx_g2_irq_free(chip);
>>   		mv88e6xxx_g1_irq_free(chip);
>> +		irq_dispose_mapping(chip->irq);
>>   	}
>>   }
>>   
>> -- 
>> 2.7.4
>>

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH net-next v2] dsa:mv88e6xxx: dispose irq mapping for chip->irq
       [not found]         ` <4388a669-b425-97e0-346b-6b20f7f47f86-qeDNsGSBLoYwFerOooGFRg@public.gmane.org>
@ 2016-12-09 18:00           ` Andrew Lunn
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2016-12-09 18:00 UTC (permalink / raw)
  To: Volodymyr Bendiuga
  Cc: vivien.didelot-4ysUXcep3aM1wj+D4I0NRVaTQe2KTcn/,
	f.fainelli-Re5JQEeQqe8AvxtiuMwx3w, netdev-u79uwXL29TY76Z2rM5mHXA,
	volodymyr.bendiuga-Re5JQEeQqe8AvxtiuMwx3w, Rob Herring,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Wed, Dec 07, 2016 at 05:40:12PM +0100, Volodymyr Bendiuga wrote:
> Yes, most of the users of of_irq_get() do not use irq_dispose_mapping().
> 
> But some of them do (some irq chips), and I believe the correct way
> of doing this is to
> 
> dispose irq mapping, as the description for this function says that
> it unmaps
> 
> the irq, which is mapped by of_irq_parse_and_map(). Not disposing
> irq might not make
> 
> any affect on most drivers, but some, that get EPROBE_DEFER error do
> need to dispose.
> 
> This is what I get when I run the code.
> 
> of_irq_put() could be implemented, and it would be a wrapper for
> irq_dispose_mapping()
> 
> as I can see it. Should I do it this way?

Hi Volodymyr

Yes, i think having of_irq_put() would be good. It gives some symmetry
to the API.

   Andrew
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-12-09 18:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1481106907-30908-1-git-send-email-volodymyr.bendiuga@westermo.se>
     [not found] ` <1481106907-30908-1-git-send-email-volodymyr.bendiuga-qeDNsGSBLoYwFerOooGFRg@public.gmane.org>
2016-12-07 14:11   ` [PATCH net-next v2] dsa:mv88e6xxx: dispose irq mapping for chip->irq Andrew Lunn
     [not found]     ` <20161207141144.GJ18817-g2DYL2Zd6BY@public.gmane.org>
2016-12-07 16:40       ` Volodymyr Bendiuga
     [not found]         ` <4388a669-b425-97e0-346b-6b20f7f47f86-qeDNsGSBLoYwFerOooGFRg@public.gmane.org>
2016-12-09 18:00           ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).