[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210526180020.13557-5-kabel@kernel.org>
Date: Wed, 26 May 2021 20:00:19 +0200
From: Marek Behún <kabel@...nel.org>
To: linux-leds@...r.kernel.org
Cc: netdev@...r.kernel.org, Pavel Machek <pavel@....cz>,
Dan Murphy <dmurphy@...com>,
Russell King <linux@...linux.org.uk>,
Andrew Lunn <andrew@...n.ch>,
Matthias Schiffer <matthias.schiffer@...tq-group.com>,
Jacek Anaszewski <jacek.anaszewski@...il.com>,
Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
Marek Behún <kabel@...nel.org>
Subject: [PATCH leds v1 4/5] leds: trigger: netdev: support HW offloading
Add support for HW offloading of the netdev trigger.
We need to export the netdev_led_trigger variable so that drivers may
check whether the LED is set to this trigger.
Signed-off-by: Marek Behún <kabel@...nel.org>
---
drivers/leds/trigger/ledtrig-netdev.c | 6 +++++-
include/linux/ledtrig.h | 2 ++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c
index a611ad755036..b6d51b24c213 100644
--- a/drivers/leds/trigger/ledtrig-netdev.c
+++ b/drivers/leds/trigger/ledtrig-netdev.c
@@ -52,6 +52,9 @@ static void set_baseline_state(struct led_netdev_data *trigger_data)
if (!led_cdev->blink_brightness)
led_cdev->blink_brightness = led_cdev->max_brightness;
+ if (!led_trigger_offload(led_cdev))
+ return;
+
if (!test_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode))
led_set_brightness(led_cdev, LED_OFF);
else {
@@ -411,12 +414,13 @@ static void netdev_trig_deactivate(struct led_classdev *led_cdev)
kfree(trigger_data);
}
-static struct led_trigger netdev_led_trigger = {
+struct led_trigger netdev_led_trigger = {
.name = "netdev",
.activate = netdev_trig_activate,
.deactivate = netdev_trig_deactivate,
.groups = netdev_trig_groups,
};
+EXPORT_SYMBOL_GPL(netdev_led_trigger);
static int __init netdev_trig_init(void)
{
diff --git a/include/linux/ledtrig.h b/include/linux/ledtrig.h
index 1cb7f03e6c16..a6a813bb154a 100644
--- a/include/linux/ledtrig.h
+++ b/include/linux/ledtrig.h
@@ -33,6 +33,8 @@ struct led_netdev_data {
#define NETDEV_LED_MODE_LINKUP 3
};
+extern struct led_trigger netdev_led_trigger;
+
#endif /* IS_ENABLED(CONFIG_LEDS_TRIGGER_NETDEV) */
#endif /* __LINUX_LEDTRIG_H__ */
--
2.26.3
Powered by blists - more mailing lists