kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Should I return NOTIFY_DONE always from restart handler?
@ 2020-03-24 16:06 Tomek The Messenger
  2020-03-24 16:16 ` Pranay Srivastava
  0 siblings, 1 reply; 2+ messages in thread
From: Tomek The Messenger @ 2020-03-24 16:06 UTC (permalink / raw)
  To: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 697 bytes --]

Hi
There is such struct as 'notifier_block'. It has member 'notifier_call'
where You assign pointer to your function (handler) and priority. Then You
register such notifier block to restart handler list.
Then when You type in linux reboot Your function might be invoked (depends
on priority you set and if You don't have registered arm_pm_restart
function which is typically done through device tree) .
My question is should I always return NOTIFY_DONE from my restart handler?
Or can I return some error code? In fact this doesn't make sense to return
any other code value as Your restart handler has to succeed always in order
not to halt system and not to do manually recovery by power off/on.

[-- Attachment #1.2: Type: text/html, Size: 779 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Should I return NOTIFY_DONE always from restart handler?
  2020-03-24 16:06 Should I return NOTIFY_DONE always from restart handler? Tomek The Messenger
@ 2020-03-24 16:16 ` Pranay Srivastava
  0 siblings, 0 replies; 2+ messages in thread
From: Pranay Srivastava @ 2020-03-24 16:16 UTC (permalink / raw)
  To: Tomek The Messenger; +Cc: kernelnewbies

Hello,

I believe you'll break the "chain" if you return an error. You might
have registered as the last
one so probably nothing would break but if someone registers on the
notifier after your module
did then that won't receive the notification if you throw an error and
break the chain.

Regards,

On Tue, Mar 24, 2020 at 9:37 PM Tomek The Messenger
<tomekthemessenger@gmail.com> wrote:
>
> Hi
> There is such struct as 'notifier_block'. It has member 'notifier_call' where You assign pointer to your function (handler) and priority. Then You register such notifier block to restart handler list.
> Then when You type in linux reboot Your function might be invoked (depends on priority you set and if You don't have registered arm_pm_restart function which is typically done through device tree) .
> My question is should I always return NOTIFY_DONE from my restart handler? Or can I return some error code? In fact this doesn't make sense to return any other code value as Your restart handler has to succeed always in order not to halt system and not to do manually recovery by power off/on.
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



-- 
        ---P.K.S

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-24 16:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-24 16:06 Should I return NOTIFY_DONE always from restart handler? Tomek The Messenger
2020-03-24 16:16 ` Pranay Srivastava

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).