[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 4 Apr 2017 09:51:57 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Andy Shevchenko <andy.shevchenko@...il.com>,
Andrey Smirnov <andrew.smirnov@...il.com>
Cc: linux-watchdog@...r.kernel.org, Chris Healy <cphealy@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Wim Van Sebroeck <wim@...ana.be>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] watchdog: core: Make use of
devm_register_reboot_notifier()
On 04/04/2017 08:47 AM, Andy Shevchenko wrote:
> On Tue, Apr 4, 2017 at 5:10 PM, Andrey Smirnov <andrew.smirnov@...il.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.
>
As mentioned in my other reply, it doesn't work since wdd->parent can be NULL.
It might be possible to move the code into watchdog_dev_register() and tie it
to the watchdog device, but I have not explored what that would require.
Guenter
> 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);
>> -
>
Powered by blists - more mailing lists