linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: linux-watchdog@vger.kernel.org, Chris Healy <cphealy@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Wim Van Sebroeck <wim@iguana.be>,
	Guenter Roeck <linux@roeck-us.net>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] watchdog: core: Make use of devm_register_reboot_notifier()
Date: Tue, 4 Apr 2017 18:47:44 +0300	[thread overview]
Message-ID: <CAHp75VfeNMQNwdW0VYmAYic6RgV3nUXO8r7URPxiqWW16HzS4w@mail.gmail.com> (raw)
In-Reply-To: <20170404141048.16828-1-andrew.smirnov@gmail.com>

On Tue, Apr 4, 2017 at 5:10 PM, Andrey Smirnov <andrew.smirnov@gmail.com> wrote:
> Save a bit of cleanup code by leveraging newly added
> devm_register_reboot_notifier().

> @@ -247,7 +247,8 @@ static int __watchdog_register_device(struct watchdog_device *wdd)
>         if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status)) {
>                 wdd->reboot_nb.notifier_call = watchdog_reboot_notifier;
>
> -               ret = register_reboot_notifier(&wdd->reboot_nb);

> +               ret = devm_register_reboot_notifier(wdd->parent,
> +                                                   &wdd->reboot_nb);

I'm not sure it's logically correct. Perhaps binding to the actual
watchdog device would be better.
Though, Guenter can correct me.

Could it be one line after all?

>                 if (ret) {
>                         pr_err("watchdog%d: Cannot register reboot notifier (%d)\n",
>                                wdd->id, ret);
> @@ -302,9 +303,6 @@ static void __watchdog_unregister_device(struct watchdog_device *wdd)
>         if (wdd->ops->restart)
>                 unregister_restart_handler(&wdd->restart_nb);
>
> -       if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status))
> -               unregister_reboot_notifier(&wdd->reboot_nb);
> -

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2017-04-04 15:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 14:10 [PATCH] watchdog: core: Make use of devm_register_reboot_notifier() Andrey Smirnov
2017-04-04 15:47 ` Andy Shevchenko [this message]
2017-04-04 16:51   ` Guenter Roeck
2017-04-04 16:56     ` Andy Shevchenko
2017-04-04 16:39 ` 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=CAHp75VfeNMQNwdW0VYmAYic6RgV3nUXO8r7URPxiqWW16HzS4w@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrew.smirnov@gmail.com \
    --cc=cphealy@gmail.com \
    --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).