[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171101123705.GG12680@lunn.ch>
Date: Wed, 1 Nov 2017 13:37:05 +0100
From: Andrew Lunn <andrew@...n.ch>
To: "Maciej S. Szmigiero" <mail@...iej.szmigiero.name>
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 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.
Thanks
Andrew
Powered by blists - more mailing lists