1 From 4fd1b6d47a7a38e81fdc6f8be2ccd4216b3f93db Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Mon, 29 May 2023 18:32:35 +0200
4 Subject: [PATCH 05/13] leds: trigger: netdev: introduce check for possible hw
7 Introduce function to check if the requested mode can use hw control in
8 preparation for hw control support. Currently everything is handled in
9 software so can_hw_control will always return false.
11 Add knob with the new value hw_control in trigger_data struct to
12 set hw control possible. Useful for future implementation to implement
13 in set_baseline_state() the required function to set the requested mode
14 using LEDs hw control ops and in other function to reject set if hw
15 control is currently active.
17 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
18 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
19 Signed-off-by: David S. Miller <davem@davemloft.net>
21 drivers/leds/trigger/ledtrig-netdev.c | 8 ++++++++
22 1 file changed, 8 insertions(+)
24 --- a/drivers/leds/trigger/ledtrig-netdev.c
25 +++ b/drivers/leds/trigger/ledtrig-netdev.c
26 @@ -51,6 +51,7 @@ struct led_netdev_data {
33 enum led_trigger_netdev_modes {
34 @@ -91,6 +92,11 @@ static void set_baseline_state(struct le
38 +static bool can_hw_control(struct led_netdev_data *trigger_data)
43 static ssize_t device_name_show(struct device *dev,
44 struct device_attribute *attr, char *buf)
46 @@ -204,6 +210,8 @@ static ssize_t netdev_led_attr_store(str
48 clear_bit(bit, &trigger_data->mode);
50 + trigger_data->hw_control = can_hw_control(trigger_data);
52 set_baseline_state(trigger_data);