[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH-L+nO12Gn4OGepr7KcCjLzMmisNYjYbFp13Aqu2Q14Rc77RA@mail.gmail.com>
Date: Tue, 20 Jun 2023 09:20:11 +0530
From: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@...adcom.com>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: Pavel Machek <pavel@....cz>, Lee Jones <lee@...nel.org>, Andrew Lunn <andrew@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Dan Carpenter <dan.carpenter@...aro.org>,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [net-next PATCH v5 3/3] leds: trigger: netdev: expose hw_control
status via sysfs
On Tue, Jun 20, 2023 at 2:18 AM Christian Marangi <ansuelsmth@...il.com>
wrote:
> Expose hw_control status via sysfs for the netdev trigger to give
> userspace better understanding of the current state of the trigger and
> the LED.
>
> Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
> Reviewed-by: Andrew Lunn <andrew@...n.ch>
> ---
> drivers/leds/trigger/ledtrig-netdev.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/leds/trigger/ledtrig-netdev.c
> b/drivers/leds/trigger/ledtrig-netdev.c
> index 2c1c9e95860e..32b66703068a 100644
> --- a/drivers/leds/trigger/ledtrig-netdev.c
> +++ b/drivers/leds/trigger/ledtrig-netdev.c
> @@ -406,6 +406,16 @@ static ssize_t interval_store(struct device *dev,
>
> static DEVICE_ATTR_RW(interval);
>
> +static ssize_t hw_control_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct led_netdev_data *trigger_data =
> led_trigger_get_drvdata(dev);
> +
> + return sprintf(buf, "%d\n", trigger_data->hw_control);
>
[Kalesh]: How about using sysfs_emit?
> +}
> +
> +static DEVICE_ATTR_RO(hw_control);
> +
> static struct attribute *netdev_trig_attrs[] = {
> &dev_attr_device_name.attr,
> &dev_attr_link.attr,
> @@ -417,6 +427,7 @@ static struct attribute *netdev_trig_attrs[] = {
> &dev_attr_rx.attr,
> &dev_attr_tx.attr,
> &dev_attr_interval.attr,
> + &dev_attr_hw_control.attr,
> NULL
> };
> ATTRIBUTE_GROUPS(netdev_trig);
> --
> 2.40.1
>
>
>
--
Regards,
Kalesh A P
Content of type "text/html" skipped
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4239 bytes)
Powered by blists - more mailing lists