Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1616136

Re: [PATCH] watchdog: core: Make use of devm_register_reboot_notifier()

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] watchdog: core: Make use of devm_register_reboot_notifier()
Date 2017-04-04 17:50 +0200
Message-ID <tsySu-6KL-29@gated-at.bofh.it> (permalink)
References <tsxtn-5Xs-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] watchdog: core: Make use of devm_register_reboot_notifier() Andrey Smirnov <andrew.smirnov@gmail.com> - 2017-04-04 16:20 +0200
  Re: [PATCH] watchdog: core: Make use of devm_register_reboot_notifier() Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-04-04 17:50 +0200
    Re: [PATCH] watchdog: core: Make use of  devm_register_reboot_notifier() Guenter Roeck <linux@roeck-us.net> - 2017-04-04 19:00 +0200
      Re: [PATCH] watchdog: core: Make use of devm_register_reboot_notifier() Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-04-04 19:00 +0200
  Re: [PATCH] watchdog: core: Make use of  devm_register_reboot_notifier() Guenter Roeck <linux@roeck-us.net> - 2017-04-04 18:40 +0200

csiph-web