/* Register a function to be called on shutdown. Only use this if you can't reset your device in the second kernel.  */
int crash_shutdown_register(crash_shutdown_t handler)
/* Register a function to be called on shutdown. Only use this if you can't reset your device in the second kernel.  */
int crash_shutdown_register(crash_shutdown_t handler)
{
	unsigned int i, rc;
	spin_lock(&crash_handlers_lock);
	for (i = 0 ; i < CRASH_HANDLER_MAX; i++)
		if (!crash_shutdown_handles[i]) {
			crash_shutdown_handles[i] = handler;
			rc = 0;
			break;
		}
	if (i == CRASH_HANDLER_MAX) {
		printk(KERN_ERR "Crash shutdown handles full, "
		       "not registered.\n");
		rc = 1;
	}
	spin_unlock(&crash_handlers_lock);
	return rc;
}