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开发者_如何学Go this situation, so I'm wondering how to have the driver informed before the reboot occurs.
You want register_reboot_notifier()
. For an example you can look here: see lines 181, 142, 129.
精彩评论