linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Juerg Haefliger <juerg.haefliger@canonical.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Juerg Haefliger <juerg.haefliger@canonical.com>,
	wim@linux-watchdog.org, linux-watchdog@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: Add {min,max}_timeout sysfs nodes
Date: Mon, 10 May 2021 16:14:06 +0200	[thread overview]
Message-ID: <20210510161406.1b32debd@gollum> (raw)
In-Reply-To: <695dfd0f-f090-653e-7580-e45484228781@roeck-us.net>

[-- Attachment #1: Type: text/plain, Size: 2051 bytes --]

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?

...Juerg


> Guenter
> 
> > +}
> > +static DEVICE_ATTR_RO(max_timeout);
> > +
> >   static ssize_t pretimeout_show(struct device *dev,
> >   			       struct device_attribute *attr, char *buf)
> >   {
> > @@ -609,6 +627,8 @@ static struct attribute *wdt_attrs[] = {
> >   	&dev_attr_state.attr,
> >   	&dev_attr_identity.attr,
> >   	&dev_attr_timeout.attr,
> > +	&dev_attr_min_timeout.attr,
> > +	&dev_attr_max_timeout.attr,
> >   	&dev_attr_pretimeout.attr,
> >   	&dev_attr_timeleft.attr,
> >   	&dev_attr_bootstatus.attr,
> >   
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-05-10 14:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 13:16 [PATCH] watchdog: Add {min,max}_timeout sysfs nodes Juerg Haefliger
2021-05-10 13:45 ` Guenter Roeck
2021-05-10 14:14   ` Juerg Haefliger [this message]
2021-05-10 14:56     ` Guenter Roeck
2021-05-11  6:29 ` [PATCH v2] " Juerg Haefliger
2021-05-11 13:35   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210510161406.1b32debd@gollum \
    --to=juerg.haefliger@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).