Re: [PATCH v2] net: phy: leds: Add support for "link" trigger

2017-11-01 Thread Andrew Lunn
On Thu, Nov 02, 2017 at 12:49:31AM +0100, Maciej S. Szmigiero wrote: > Hi Andrew, > > On 01.11.2017 13:33, Maciej S. Szmigiero wrote: > > On 01.11.2017 13:31, Andrew Lunn wrote: > >>> Yes, I did it the same way as the existing code did for > >>> phy->phy_led_triggers > >>> for reasons of both con

Re: [PATCH v2] net: phy: leds: Add support for "link" trigger

2017-11-01 Thread Maciej S. Szmigiero
Hi Andrew, On 01.11.2017 13:33, Maciej S. Szmigiero wrote: > On 01.11.2017 13:31, Andrew Lunn wrote: >>> Yes, I did it the same way as the existing code did for >>> phy->phy_led_triggers >>> for reasons of both consistency and also to be on the safe side because >>> maybe there is some non-obviou

Re: [PATCH v2] net: phy: leds: Add support for "link" trigger

2017-11-01 Thread Maciej S. Szmigiero
Hi Andrew, On 01.11.2017 13:37, Andrew Lunn wrote: > Hi Maciej > > I don't particularly like the > >if (!phy->link) > goto out_change_speed; > > part of the existing code. Makes me thing of BASIC. goto is good for > error handling, but this is not an error. > > If you f

Re: [PATCH v2] net: phy: leds: Add support for "link" trigger

2017-11-01 Thread Andrew Lunn
Hi Maciej I don't particularly like the if (!phy->link) goto out_change_speed; part of the existing code. Makes me thing of BASIC. goto is good for error handling, but this is not an error. If you feel like it, maybe you can refactor this code? Add a function like: phy_l

Re: [PATCH v2] net: phy: leds: Add support for "link" trigger

2017-11-01 Thread Maciej S. Szmigiero
Hi Andrew, On 01.11.2017 13:31, Andrew Lunn wrote: >> Yes, I did it the same way as the existing code did for phy->phy_led_triggers >> for reasons of both consistency and also to be on the safe side because >> maybe there is some non-obvious reason why it has to be freed >> explicitly (?). > > H

Re: [PATCH v2] net: phy: leds: Add support for "link" trigger

2017-11-01 Thread Andrew Lunn
> Yes, I did it the same way as the existing code did for phy->phy_led_triggers > for reasons of both consistency and also to be on the safe side because > maybe there is some non-obvious reason why it has to be freed > explicitly (?). Hi Maciej Occasionally, there is a need to call devm_kfree()

Re: [PATCH v2] net: phy: leds: Add support for "link" trigger

2017-11-01 Thread Maciej S. Szmigiero
Hi Andrew, On 01.11.2017 13:16, Andrew Lunn wrote: >> @@ -123,6 +153,10 @@ int phy_led_triggers_register(struct phy_device *phy) >> while (i--) >> phy_led_trigger_unregister(&phy->phy_led_triggers[i]); >> devm_kfree(&phy->mdio.dev, phy->phy_led_triggers); >> +out_unreg_link:

Re: [PATCH v2] net: phy: leds: Add support for "link" trigger

2017-11-01 Thread Andrew Lunn
> @@ -123,6 +153,10 @@ int phy_led_triggers_register(struct phy_device *phy) > while (i--) > phy_led_trigger_unregister(&phy->phy_led_triggers[i]); > devm_kfree(&phy->mdio.dev, phy->phy_led_triggers); > +out_unreg_link: > + phy_led_trigger_unregister(phy->led_link_trig

[PATCH v2] net: phy: leds: Add support for "link" trigger

2017-10-31 Thread Maciej S. Szmigiero
Currently, we create a LED trigger for any link speed known to a PHY. These triggers only fire when their exact link speed had been negotiated (they aren't cumulative, that is, they don't fire for "their or any higher" link speed). What we are missing, however, is a trigger which will fire on any