leds: trigger: netdev: Display only supported link speed attribute
authorChristian Marangi <ansuelsmth@gmail.com>
Thu, 11 Jan 2024 16:04:54 +0000 (17:04 +0100)
committerLee Jones <lee@kernel.org>
Thu, 7 Mar 2024 08:47:57 +0000 (08:47 +0000)
commit06cdca014eca3449d8c34bf7c2fcb796a114a0b8
treebdcb6663f120256d4bd7dca803c174591fe56fff
parent66601a29bb23b61f9676f51c0b4b78b38c601536
leds: trigger: netdev: Display only supported link speed attribute

With the addition of more link speed mode to the netdev trigger, it was
pointed out that there may be a problem with bloating the attribute list
with modes that won't ever be supported by the trigger as the attached
device name doesn't support them.

To clear and address this problem, change the logic where these
additional trigger modes are listed.

Since the netdev trigger REQUIRE a device name to be set, attach to the
device name change function additional logic to parse the supported link
speed modes using ethtool APIs and show only the supported link speed
modes attribute.

Link speed attribute are refreshed on device_name set and on
NETDEV_CHANGE events.

This only apply to the link speed modes and every other mode is still
provided by default.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Marek BehĂșn <kabel@kernel.org>
Link: https://lore.kernel.org/r/20240111160501.1774-1-ansuelsmth@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/trigger/ledtrig-netdev.c