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: dyoung@redhat.com, dzickus@redhat.com,
	linux-watchdog@vger.kernel.org,
	open list:  ABI/API <linux-api@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Wim Van Sebroeck <wim@iguana.be>
Subject: Re: [PATCH V2] watchdog: Add watchdog device control through sysfs attributes
Date: Wed, 2 Sep 2015 10:37:10 +0530	[thread overview]
Message-ID: <20150902050710.GC31796@dhcppc13.redhat.com> (raw)
In-Reply-To: <55E68053.3060006@roeck-us.net>

On 01/09/2015:09:51:31 PM, Guenter Roeck wrote:
> On 09/01/2015 09:47 PM, Pratyush Anand wrote:
> >Hi Guenter,
> >
> >Thanks for review and explaining it.
> >
> >On 01/09/2015:08:27:11 PM, Guenter Roeck wrote:
> >>Playing with it, I see two alternatives (2a/2b), both of which I prefer.
> >
> >OK..I will make the changes as you prefer. May be I will keep these changes as
> >1st patch and another patch to add sysfs attributes.
> >
> >>
> >>1) Move struct class watchdog_class to watchdog_dev.c, and initialize it there.
> >>    Attach the groups to the .dev_groups variable in watchdog_class.
> >>2a) Make watchdog_class global, and use a pointer to it in watchdog_core.c.
> >>     Use class_register / class_unregister instead of class_create / class_destroy.
> >>2b) Make watchdog_class static in watchdog_dev.c. Move its registration and de-registration
> >>     to watchdog_dev_init() and watchdog_dev_exit(). Again, use class_register
> >>     and class_unregister.
> >>     Have watchdog_dev_init return a pointer to watchdog_class (and ERR_PTR on errors).
> >>3) Keep the rest of the code in place as-is, specifically keep using device_create()
> >>    as is in __watchdog_register_device().
> >>
> >>Maybe 1 / 2b / 3 so we don't need to introduce a new global ?
> >
> >But with 2b, we will still have to move device_create() to
> >watchdog_dev_register, because it needs watchdog_class. So, are you OK
> >with that? Else I can implement 2a, if that seems more suitable to you.
> >
> 
> Not if you return the pointer to the watchdog class from watchdog_dev_init().

But in that case another static class * will be needed to share the  returned
value in __watchdog_register_device().

> That avoids making it global (though I don't really have a problem with
> making it global).

OK Thanks.. Then I will send a V3 with 2a.

~Pratyush

      parent reply	other threads:[~2015-09-02  5:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-31  6:34 [PATCH V2] watchdog: Add watchdog device control through sysfs attributes Pratyush Anand
     [not found] ` <55E66C8F.1020309@roeck-us.net>
2015-09-02  4:47   ` Pratyush Anand
     [not found]     ` <55E68053.3060006@roeck-us.net>
2015-09-02  5:07       ` Pratyush Anand [this message]

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=20150902050710.GC31796@dhcppc13.redhat.com \
    --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).