Преглед изворни кода

staging: panel: register reboot

we donot need the reboot notifier in module init section, as the
notifier is used after lcd is initialized. so lets register for the
reboot notifier only after we have successfully attached to the
parallel port. and similarly unregister at detach.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Acked-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee пре 10 година
родитељ
комит
bb046fef96
1 измењених фајлова са 3 додато и 4 уклоњено
  1. 3 4
      drivers/staging/panel/panel.c

+ 3 - 4
drivers/staging/panel/panel.c

@@ -2234,6 +2234,7 @@ static void panel_attach(struct parport *port)
 		if (misc_register(&keypad_dev))
 			goto err_lcd_unreg;
 	}
+	register_reboot_notifier(&panel_notifier);
 	return;
 
 err_lcd_unreg:
@@ -2255,6 +2256,8 @@ static void panel_detach(struct parport *port)
 		return;
 	}
 
+	unregister_reboot_notifier(&panel_notifier);
+
 	if (keypad.enabled && keypad_initialized) {
 		misc_deregister(&keypad_dev);
 		keypad_initialized = 0;
@@ -2321,7 +2324,6 @@ static int __init panel_init_module(void)
 		break;
 	}
 
-
 	/*
 	 * Overwrite selection with module param values (both keypad and lcd),
 	 * where the deprecated params have lower prio.
@@ -2391,8 +2393,6 @@ static int __init panel_init_module(void)
 		return -EIO;
 	}
 
-	register_reboot_notifier(&panel_notifier);
-
 	if (pprt)
 		pr_info("driver version " PANEL_VERSION
 			" registered on parport%d (io=0x%lx).\n", parport,
@@ -2408,7 +2408,6 @@ static int __init panel_init_module(void)
 
 static void __exit panel_cleanup_module(void)
 {
-	unregister_reboot_notifier(&panel_notifier);
 
 	if (scan_timer.function != NULL)
 		del_timer_sync(&scan_timer);