All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pratyush Anand <panand@redhat.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: linux-watchdog@vger.kernel.org, Dave Young <dyoung@redhat.com>,
	Don Zickus <dzickus@redhat.com>
Subject: Re: Query: Best way to know if a watchdog is active (kicked)
Date: Fri, 21 Aug 2015 22:35:37 +0530	[thread overview]
Message-ID: <20150821170537.GA3013@dhcppc13.redhat.com> (raw)
In-Reply-To: <20150821151903.GA23661@roeck-us.net>

On 21/08/2015:08:19:03 AM, Guenter Roeck wrote:
> On Fri, Aug 21, 2015 at 02:22:17PM +0530, Pratyush Anand wrote:
> > On 18/08/2015:07:23:38 AM, Guenter Roeck wrote:
> > > Sounds good. We should have a 'name' attribute as well. We'll also need
> > > 'timeout', 'keepalive' to ping the watchdog, 'timeleft', and 'bootstatus'.
> > > Not sure what else.
> > > 
> > > The attributes should be implemented as class attributes, to ensure
> > > that they are created and removed automatically. That may require
> > > the watchdog class to be static instead of a pointer.
> > 
> > Should n't attributes be implemented as device attribute as they are properties
> > of each device. Under the class watchdog_class, we can have multiple device on a
> > system, and these attributes would be different for different devices. So, what
> > I am thinking is to create device in __watchdog_register_device using
> > device_create_with_groups instead of device_create. Here we can link a
> > attribute_group with all attributes you suggested.
> > 
> Class attibutes are created automatically for each device registered which is
> a member of the class. They are attached to the device, not to the class.

Not sure, if we both are referring to same thing..
So, I did a basic testing. I changed "static struct class *watchdog_class;" to "tatic
struct class watchdog_class" and other than .name and .owner I added
.class_attrs and then further added one node "state" in this class_attrs.

I have two watchdog in my system, so I was expecting
/sys/class/watchdog/watchdog0/state and /sys/class/watchdog/watchdog1/state. But
I see that there is only /sys/class/watchdog/state with the above approach.

> In other words, the infrastructure creates the attributes, the driver doesn't
> have to do it, and there is no race condition where the device exists but
> the attributes are not yet there.

Yes, I agree that individual driver does not need to do anything.
watchdog_core.c and watchdog_dev.c will take care for each of the device
registered with it. I am able to do that, but not using .class_attrs,
rather using device_create_with_groups.

> 
> Not sure what you mean with "different". Can you elaborate ?

As I said above, with the "different" I meant that we should have state in each
/sys/class/watchdog/watchdogn.

~Pratyush

  reply	other threads:[~2015-08-21 17:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-18  5:15 Query: Best way to know if a watchdog is active (kicked) Pratyush Anand
2015-08-18  5:39 ` Guenter Roeck
2015-08-18  6:57   ` Pratyush Anand
2015-08-18  9:13     ` Dave Young
2015-08-18  9:52       ` Pratyush Anand
2015-08-18 12:50     ` Guenter Roeck
2015-08-18 13:08       ` Pratyush Anand
2015-08-18 14:23         ` Guenter Roeck
2015-08-21  8:52           ` Pratyush Anand
2015-08-21 15:19             ` Guenter Roeck
2015-08-21 17:05               ` Pratyush Anand [this message]
2015-08-21 17:13                 ` Guenter Roeck
2015-08-21 17:19                   ` 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=20150821170537.GA3013@dhcppc13.redhat.com \
    --to=panand@redhat.com \
    --cc=dyoung@redhat.com \
    --cc=dzickus@redhat.com \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.