Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromtorvalds/linux

Commitff198cd

Browse files
maciejsszmigierodavem330
authored andcommitted
net: phy: leds: Refactor "no link" handler into a separate function
Currently, phy_led_trigger_change_speed() is handling a "no link" conditionlike it was some kind of an error (using "goto" to a code at the functionend).However, having no link at PHY is an ordinary operational state, so let'shandle it in an appropriately named separate function so it is more obviouswhat the code is doing.Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>Signed-off-by: David S. Miller <davem@davemloft.net>
1 parentfffcefe commitff198cd

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

‎drivers/net/phy/phy_led_triggers.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,20 @@ static struct phy_led_trigger *phy_speed_to_led_trigger(struct phy_device *phy,
2727
returnNULL;
2828
}
2929

30+
staticvoidphy_led_trigger_no_link(structphy_device*phy)
31+
{
32+
if (phy->last_triggered) {
33+
led_trigger_event(&phy->last_triggered->trigger,LED_OFF);
34+
phy->last_triggered=NULL;
35+
}
36+
}
37+
3038
voidphy_led_trigger_change_speed(structphy_device*phy)
3139
{
3240
structphy_led_trigger*plt;
3341

3442
if (!phy->link)
35-
gotoout_change_speed;
43+
returnphy_led_trigger_no_link(phy);
3644

3745
if (phy->speed==0)
3846
return;
@@ -42,22 +50,14 @@ void phy_led_trigger_change_speed(struct phy_device *phy)
4250
netdev_alert(phy->attached_dev,
4351
"No phy led trigger registered for speed(%d)\n",
4452
phy->speed);
45-
gotoout_change_speed;
53+
returnphy_led_trigger_no_link(phy);
4654
}
4755

4856
if (plt!=phy->last_triggered) {
4957
led_trigger_event(&phy->last_triggered->trigger,LED_OFF);
5058
led_trigger_event(&plt->trigger,LED_FULL);
5159
phy->last_triggered=plt;
5260
}
53-
return;
54-
55-
out_change_speed:
56-
if (phy->last_triggered) {
57-
led_trigger_event(&phy->last_triggered->trigger,
58-
LED_OFF);
59-
phy->last_triggered=NULL;
60-
}
6161
}
6262
EXPORT_SYMBOL_GPL(phy_led_trigger_change_speed);
6363

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp