From: Andrew Lunn <andrew@lunn.ch>
To: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
netdev@vger.kernel.org,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] net: phy: leds: Add support for "link" trigger
Date: Wed, 1 Nov 2017 13:37:05 +0100 [thread overview]
Message-ID: <20171101123705.GG12680@lunn.ch> (raw)
In-Reply-To: <b789b023-2e7b-1f5b-59a6-9676db74e850@maciej.szmigiero.name>
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
next prev parent reply other threads:[~2017-11-01 12:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 11:56 [PATCH v2] net: phy: leds: Add support for "link" trigger Maciej S. Szmigiero
2017-11-01 12:16 ` Andrew Lunn
2017-11-01 12:21 ` Maciej S. Szmigiero
2017-11-01 12:31 ` Andrew Lunn
2017-11-01 12:33 ` Maciej S. Szmigiero
2017-11-01 23:49 ` Maciej S. Szmigiero
2017-11-02 0:14 ` Andrew Lunn
2017-11-01 12:37 ` Andrew Lunn [this message]
2017-11-01 12:43 ` Maciej S. Szmigiero
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171101123705.GG12680@lunn.ch \
--to=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mail@maciej.szmigiero.name \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox