linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pratyush Anand <panand@redhat.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-watchdog@vger.kernel.org, dyoung@redhat.com,
	dzickus@redhat.com,
	open list:  ABI/API <linux-api@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Wim Van Sebroeck <wim@iguana.be>
Subject: Re: [RFC] watchdog: Add watchdog device control through sysfs attributes
Date: Mon, 31 Aug 2015 08:34:10 +0530	[thread overview]
Message-ID: <20150831030410.GB4660@dhcppc13> (raw)
In-Reply-To: <55E34DEA.7010206@roeck-us.net>

On 30/08/2015:11:39:38 AM, Guenter Roeck wrote:
> On 08/30/2015 11:17 AM, Pratyush Anand wrote:
> >Hi Guenter,
> >On 30/08/2015:07:58:27 AM, Guenter Roeck wrote:
> >>
> >>I can only see a single caller of watchdog_dev_register().
> >>Changing that one call should not be such a problem.
> >
> >Sure..Probably I was sleeping when I greped watchdog_dev_register :(
> >
> >>
> >>Also, you could name the groups variable something like wdc_class_dev_groups,
> >>make it public, and assign it in watchdog_core.c as follows.
> >
> >I will avoid making public whereever possible.
> >
> Your argument seems to be that it is better to introduce a new public
> single-use API function to avoid introducing a public variable.
> 
> Not sure if I understand the logic.

Sorry, if it was not clear..I agreed to change watchdog_dev_register instead of
introducing a new public variable.

> 
> >>
> >>static struct class watchdog_class = {
> >>	.name = "watchdog",
> >>	.owner = THIS_MODULE,
> >>	.dev_groups = wdc_class_dev_groups,
> >>};
> >>
> >>Then use class_register() and class_unregister() instead of class_create()
> >>and class_destroy(), and you would be done w/o any further API change.
> >>
> >>>>
> >>>>>+		return size;
> >>>>>+}
> >>>>>+
> >>>>>+static ssize_t timeout_show(struct device *dev,
> >>>>>+		struct device_attribute *attr, char *buf)
> >>>>>+{
> >>>>>+	struct watchdog_device *wdd = dev_get_drvdata(dev);
> >>>>>+	ssize_t status;
> >>>>>+
> >>>>>+	mutex_lock(&wdd->lock);
> >>>>>+	if (wdd->timeout == 0)
> >>>>>+		status = -EOPNOTSUPP;
> >>>>
> >>>>Why ?
> >>>
> >>>It has been copied from case WDIOC_GETTIMEOUT: which says:
> >>>timeout == 0 means that we don't know the timeout.
> >>>
> >>
> >>Just return 0 to mean "the timeout is unknown", and make it part of the
> >>sysfs ABI. Returning an error just makes user space code more complicated.
> >
> >Now the new code will check wdd->timeout == 0 in is_visible. So should be fine.
> >What do you say.?
> >
> timeout can be configured through ioctl, unless I am missing something,
> so I am not sure if I agree. It could still end up being 0.

Hummm..it did not allow to set timeout=0 for iTCO_wdt..but I can see that there
are some devices which sets min_timeout=0 and so your argument seems to be
correct and I will change as you suggested.
However, I am wondering should a device be allowed to set timeout=0. What
purpose will that serve?... may be for testing purpose can be used..

~Pratyush

  parent reply	other threads:[~2015-08-31  3:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21 17:48 [PATCH RFC] watchdog: Add watchdog device control through sysfs attributes Pratyush Anand
2015-08-25 16:45 ` Pratyush Anand
     [not found]   ` <55DCA3C1.5050307@roeck-us.net>
2015-08-25 23:19     ` Pratyush Anand
2015-08-29 16:51 ` [RFC] " Guenter Roeck
2015-08-30 14:16   ` Pratyush Anand
     [not found]     ` <55E31A13.80503@roeck-us.net>
2015-08-30 18:17       ` Pratyush Anand
     [not found]         ` <55E34DEA.7010206@roeck-us.net>
2015-08-31  3:04           ` Pratyush Anand [this message]
2015-08-31  3:11   ` Pratyush Anand
     [not found]     ` <55E3CDBC.2040109@roeck-us.net>
2015-08-31  5:26       ` Pratyush Anand

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=20150831030410.GB4660@dhcppc13 \
    --to=panand@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=dzickus@redhat.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wim@iguana.be \
    /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).