Skip to content

Commit

Permalink
leds: trigger: netdev: add basic check for hw control support
Browse files Browse the repository at this point in the history
Add basic check for hw control support. Check if the required API are
defined and check if the defined trigger supported in hw control for the
LED driver match netdev.

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 4fd1b6d commit 6352f25
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/leds/trigger/ledtrig-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,22 @@ static void set_baseline_state(struct led_netdev_data *trigger_data)
}
}

static bool supports_hw_control(struct led_classdev *led_cdev)
{
if (!led_cdev->hw_control_get || !led_cdev->hw_control_set ||
!led_cdev->hw_control_is_supported)
return false;

return !strcmp(led_cdev->hw_control_trigger, led_cdev->trigger->name);
}

static bool can_hw_control(struct led_netdev_data *trigger_data)
{
struct led_classdev *led_cdev = trigger_data->led_cdev;

if (!supports_hw_control(led_cdev))
return false;

return false;
}

Expand Down

0 comments on commit 6352f25

Please sign in to comment.