[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230427001541.18704-7-ansuelsmth@gmail.com>
Date: Thu, 27 Apr 2023 02:15:36 +0200
From: Christian Marangi <ansuelsmth@...il.com>
To: Jonathan Corbet <corbet@....net>, Pavel Machek <pavel@....cz>,
Lee Jones <lee@...nel.org>, Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Christian Marangi <ansuelsmth@...il.com>,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-leds@...r.kernel.org, netdev@...r.kernel.org
Subject: [PATCH 06/11] leds: trigger: netdev: add knob to set hw control possible
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@...il.com>
---
drivers/leds/trigger/ledtrig-netdev.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c
index 81e0b0083f2f..28c4465a2584 100644
--- a/drivers/leds/trigger/ledtrig-netdev.c
+++ b/drivers/leds/trigger/ledtrig-netdev.c
@@ -51,6 +51,7 @@ struct led_netdev_data {
unsigned long mode;
bool carrier_link_up;
+ bool hw_control;
};
enum led_trigger_netdev_modes {
@@ -92,7 +93,7 @@ static void set_baseline_state(struct led_netdev_data *trigger_data)
}
static int validate_requested_mode(struct led_netdev_data *trigger_data,
- unsigned long mode)
+ unsigned long mode, bool *can_use_hw_control)
{
return 0;
}
@@ -175,6 +176,7 @@ static ssize_t netdev_led_attr_store(struct device *dev, const char *buf,
{
struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
unsigned long state, new_mode = trigger_data->mode;
+ bool can_use_hw_control = false;
int ret;
int bit;
@@ -197,13 +199,15 @@ static ssize_t netdev_led_attr_store(struct device *dev, const char *buf,
else
clear_bit(bit, &new_mode);
- ret = validate_requested_mode(trigger_data, new_mode);
+ ret = validate_requested_mode(trigger_data, new_mode,
+ &can_use_hw_control);
if (ret)
return ret;
cancel_delayed_work_sync(&trigger_data->work);
trigger_data->mode = new_mode;
+ trigger_data->hw_control = can_use_hw_control;
set_baseline_state(trigger_data);
--
2.39.2
Powered by blists - more mailing lists