Commit 6352f25f authored by Christian Marangi's avatar Christian Marangi Committed by David S. Miller

leds: trigger: netdev: add basic check for hw control support

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: default avatarChristian Marangi <ansuelsmth@gmail.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4fd1b6d4
...@@ -92,8 +92,22 @@ static void set_baseline_state(struct led_netdev_data *trigger_data) ...@@ -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) 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; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment