John Ulvr
John Ulvr

Reputation: 636

How do I detect reboot/shutdown from a linux driver

I have a loadable linux module which controls some hardware. I need to run some code before a soft reboot, however, I noticed the module destructor does not seem to be called in this situation, so I'm wondering how to have the driver informed before the reboot occurs.

Upvotes: 2

Views: 4660

Answers (1)

Femi
Femi

Reputation: 64700

You want register_reboot_notifier(). For an example you can look here: see lines 181, 142, 129.

Upvotes: 4

Related Questions