diff options
author | Andrew Lunn <andrew@lunn.ch> | 2023-08-08 23:04:33 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-08-10 17:35:00 -0700 |
commit | 7df1f14c04cbb1950e79c19793420f87227c3e80 (patch) | |
tree | 2a3714a3ff26f55e7bde0c6d08ac5380d684d9ed /drivers/leds/trigger | |
parent | 215c44fa69d7a873e058b2e1c451c12025d94bee (diff) | |
download | linux-stable-7df1f14c04cbb1950e79c19793420f87227c3e80.tar.gz linux-stable-7df1f14c04cbb1950e79c19793420f87227c3e80.tar.bz2 linux-stable-7df1f14c04cbb1950e79c19793420f87227c3e80.zip |
led: trig: netdev: Fix requesting offload device
When the netdev trigger is activates, it tries to determine what
device the LED blinks for, and what the current blink mode is.
The documentation for hw_control_get() says:
* Return 0 on success, a negative error number on failing parsing the
* initial mode. Error from this function is NOT FATAL as the device
* may be in a not supported initial state by the attached LED trigger.
*/
For the Marvell PHY and the Armada 370-rd board, the initial LED blink
mode is not supported by the trigger, so it returns an error. This
resulted in not getting the device the LED is blinking for. As a
result, the device is unknown and offloaded is never performed.
Change to condition to always get the device if offloading is
supported, and reduce the scope of testing for an error from
hw_control_get() to skip setting trigger internal state if there is an
error.
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Daniel Golle <daniel@makrotopia.org>
Link: https://lore.kernel.org/r/20230808210436.838995-2-andrew@lunn.ch
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/leds/trigger')
-rw-r--r-- | drivers/leds/trigger/ledtrig-netdev.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c index c9bc5a91ec83..3d215a556e20 100644 --- a/drivers/leds/trigger/ledtrig-netdev.c +++ b/drivers/leds/trigger/ledtrig-netdev.c @@ -564,15 +564,17 @@ static int netdev_trig_activate(struct led_classdev *led_cdev) /* Check if hw control is active by default on the LED. * Init already enabled mode in hw control. */ - if (supports_hw_control(led_cdev) && - !led_cdev->hw_control_get(led_cdev, &mode)) { + if (supports_hw_control(led_cdev)) { dev = led_cdev->hw_control_get_device(led_cdev); if (dev) { const char *name = dev_name(dev); set_device_name(trigger_data, name, strlen(name)); trigger_data->hw_control = true; - trigger_data->mode = mode; + + rc = led_cdev->hw_control_get(led_cdev, &mode); + if (!rc) + trigger_data->mode = mode; } } |