Little kernel module to enable gpio-shutdown overlay

Hi,

For my pi I needed a button to safely shut it down. Found the gpio-shutdown overlay you can add in config.txt. This adds some stuff in the device tree. This little driver makes use of that.
Code is here.

Should I just leave it there, or add it to ports somehow? I would like a code review, because it is my first kernel module, I only wrote some bare metal drivers for embedded stuff before.
 
I have load the module on my OrangePi PC and pressed the button, I have the string "gpio_shutdown0: button pressed, shutting down" and even couple of terminated on signal 15 services, ssh is failed. But the OPi still answered on ping until I powered it off.
 
Back
Top