lkml.org 
[lkml]   [2021]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] watchdog: Add {min,max}_timeout sysfs nodes
Date
On 5/10/21 7:14 AM, Juerg Haefliger wrote:
> On Mon, 10 May 2021 06:45:15 -0700
> Guenter Roeck <linux@roeck-us.net> wrote:
>
>> On 5/10/21 6:16 AM, Juerg Haefliger wrote:
>>> The valid range for the 'timeout' value is useful information so expose
>>> the min and max timeout values via sysfs.
>>>
>>> Signed-off-by: Juerg Haefliger <juergh@canonical.com>
>>> ---
>>> drivers/watchdog/watchdog_dev.c | 20 ++++++++++++++++++++
>>> 1 file changed, 20 insertions(+)
>>>
>>> diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
>>> index 2946f3a63110..b84d53a79618 100644
>>> --- a/drivers/watchdog/watchdog_dev.c
>>> +++ b/drivers/watchdog/watchdog_dev.c
>>> @@ -525,6 +525,24 @@ static ssize_t timeout_show(struct device *dev, struct device_attribute *attr,
>>> }
>>> static DEVICE_ATTR_RO(timeout);
>>>
>>> +static ssize_t min_timeout_show(struct device *dev,
>>> + struct device_attribute *attr, char *buf)
>>> +{
>>> + struct watchdog_device *wdd = dev_get_drvdata(dev);
>>> +
>>> + return sprintf(buf, "%u\n", wdd->min_timeout);
>>> +}
>>> +static DEVICE_ATTR_RO(min_timeout);
>>> +
>>> +static ssize_t max_timeout_show(struct device *dev,
>>> + struct device_attribute *attr, char *buf)
>>> +{
>>> + struct watchdog_device *wdd = dev_get_drvdata(dev);
>>> +
>>> + return sprintf(buf, "%u\n", wdd->max_timeout);
>>
>> Makes sense, but please use sysfs_emit().
>
> OK. And maybe I should send a patch to convert the other occurrences of
> sprintf as well?
>

Sure, if you want to.

Guenter

\
 
 \ /
  Last update: 2021-05-10 17:23    [W:0.056 / U:1.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site