1 From b655892ffd6d89b0c7407e099c40dbde82ee3f03 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Mon, 19 Jun 2023 22:47:00 +0200
4 Subject: [PATCH 3/3] leds: trigger: netdev: expose hw_control status via sysfs
6 Expose hw_control status via sysfs for the netdev trigger to give
7 userspace better understanding of the current state of the trigger and
10 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
11 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
12 Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
13 Acked-by: Lee Jones <lee@kernel.org>
14 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
16 drivers/leds/trigger/ledtrig-netdev.c | 11 +++++++++++
17 1 file changed, 11 insertions(+)
19 --- a/drivers/leds/trigger/ledtrig-netdev.c
20 +++ b/drivers/leds/trigger/ledtrig-netdev.c
21 @@ -406,6 +406,16 @@ static ssize_t interval_store(struct dev
23 static DEVICE_ATTR_RW(interval);
25 +static ssize_t hw_control_show(struct device *dev,
26 + struct device_attribute *attr, char *buf)
28 + struct led_netdev_data *trigger_data = led_trigger_get_drvdata(dev);
30 + return sprintf(buf, "%d\n", trigger_data->hw_control);
33 +static DEVICE_ATTR_RO(hw_control);
35 static struct attribute *netdev_trig_attrs[] = {
36 &dev_attr_device_name.attr,
38 @@ -417,6 +427,7 @@ static struct attribute *netdev_trig_att
41 &dev_attr_interval.attr,
42 + &dev_attr_hw_control.attr,
45 ATTRIBUTE_GROUPS(netdev_trig);