Skip to content

Commit

Permalink
leds: trigger: netdev: introduce check for possible hw control
Browse files Browse the repository at this point in the history
Introduce function to check if the requested mode can use hw control in
preparation for hw control support. Currently everything is handled in
software so can_hw_control will always return false.

Add knob with the new value hw_control in trigger_data struct to
set hw control possible. Useful for future implementation to implement
in set_baseline_state() the required function to set the requested mode
using LEDs hw control ops and in other function to reject set if hw
control is currently active.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Christian Marangi authored and David S. Miller committed May 31, 2023
1 parent 28a6a2e commit 4fd1b6d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/leds/trigger/ledtrig-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct led_netdev_data {

unsigned long mode;
bool carrier_link_up;
bool hw_control;
};

enum led_trigger_netdev_modes {
Expand Down Expand Up @@ -91,6 +92,11 @@ static void set_baseline_state(struct led_netdev_data *trigger_data)
}
}

static bool can_hw_control(struct led_netdev_data *trigger_data)
{
return false;
}

static ssize_t device_name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
Expand Down Expand Up @@ -204,6 +210,8 @@ static ssize_t netdev_led_attr_store(struct device *dev, const char *buf,
else
clear_bit(bit, &trigger_data->mode);

trigger_data->hw_control = can_hw_control(trigger_data);

set_baseline_state(trigger_data);

return size;
Expand Down

0 comments on commit 4fd1b6d

Please sign in to comment.