mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
leds: trigger: netdev: Implement hw_offloaded() callback
"netdev" can run in hardware control according to hardware capabilities and trigger options. Implement hw_offloaded() callback to provide its hardware control state to the LED core, and document the relation between the custom "offloaded" attribute and the generic "trigger_may_offload_to_hw" attribute. The callback mimics how the existing "offloaded" attribute does, i.e., locklessly reads hw_control, as it's just a hint and don't need to be accurate. Acked-by: Ike Panhc <ikepanhc@gmail.com> Signed-off-by: Rong Zhang <i@rong.moe> Link: https://patch.msgid.link/20260921-leds-trigger-hw-changed-v7-8-fe3cdb6dec51@rong.moe Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
f5005c7cec
commit
072e0e799b
|
|
@ -101,6 +101,9 @@ Description:
|
|||
- `[foo_trigger]`: the trigger is selected and offloaded to
|
||||
hardware.
|
||||
|
||||
The "netdev" trigger also provides a custom attribute to
|
||||
indicate its state, see `/sys/class/leds/<led>/offloaded`.
|
||||
|
||||
What: /sys/class/leds/<led>/inverted
|
||||
Date: January 2011
|
||||
KernelVersion: 2.6.38
|
||||
|
|
|
|||
|
|
@ -75,6 +75,9 @@ Description:
|
|||
If 1, the LED blinking in requested mode is offloaded to
|
||||
hardware.
|
||||
|
||||
LED trigger core also provides a generic attribute for this
|
||||
purpose, see `/sys/class/leds/<led>/trigger_may_offload_to_hw`.
|
||||
|
||||
What: /sys/class/leds/<led>/link_10
|
||||
Date: Jun 2023
|
||||
KernelVersion: 6.5
|
||||
|
|
|
|||
|
|
@ -795,10 +795,18 @@ static void netdev_trig_deactivate(struct led_classdev *led_cdev)
|
|||
kfree(trigger_data);
|
||||
}
|
||||
|
||||
static bool netdev_trig_hw_offloaded(struct led_classdev *led_cdev)
|
||||
{
|
||||
struct led_netdev_data *trigger_data = led_get_trigger_data(led_cdev);
|
||||
|
||||
return trigger_data->hw_control;
|
||||
}
|
||||
|
||||
static struct led_trigger netdev_led_trigger = {
|
||||
.name = "netdev",
|
||||
.activate = netdev_trig_activate,
|
||||
.deactivate = netdev_trig_deactivate,
|
||||
.hw_offloaded = netdev_trig_hw_offloaded,
|
||||
.groups = netdev_trig_groups,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user