[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <eeffcfd4-0d3c-79cb-7d26-ac84acaec1e8@maciej.szmigiero.name>
Date: Wed, 1 Nov 2017 13:43:03 +0100
From: "Maciej S. Szmigiero" <mail@...iej.szmigiero.name>
To: Andrew Lunn <andrew@...n.ch>
Cc: Florian Fainelli <f.fainelli@...il.com>, netdev@...r.kernel.org,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] net: phy: leds: Add support for "link" trigger
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 feel like it, maybe you can refactor this code? Add a function like:
>
> phy_led_trigger_no_link(struct phy_device *phy)
> {
> if (phy->last_triggered) {
> led_trigger_event(&phy->last_triggered->trigger,
> LED_OFF);
> phy->last_triggered = NULL;
> }
> }
>
> and call it, rather than using goto? It then becomes a lot more
> obvious what your change is doing, turning the LED off when there is
> no link.
All right, will do this, too.
> Thanks
> Andrew
>
Maciej
Powered by blists - more mailing lists