Re: [PATCH] net: phy: leds: Trigger leds only if PHY speed is known

From: Andrew Lunn
Date: Fri Jul 16 2021 - 11:20:16 EST


On Fri, Jul 16, 2021 at 05:11:42PM +0300, Ivan T. Ivanov wrote:
> This prevents "No phy led trigger registered for speed(-1)"
> alert message which is coused by phy_led_trigger_chage_speed()
> being called during attaching phy to net_device where phy device
> speed could be still unknown.

Hi Ivan

It seems odd that when attaching the PHY we have link, but not the
speed. What PHY is this?

> - if (phy->speed == 0)
> + if (phy->speed == 0 || phy->speed == SPEED_UNKNOWN)
> return;

This change makes sense. But i'm wondering if the original logic is
sound. We have link, but no speed information. So the LED trigger is
left in an indeterminate state. Rather than a plain return, maybe
phy_led_trigger_no_link(phy) should be called?

Andrew