staging: panel: register driver after checking device
register the driver only if lcd or keypad has been enabled and if both are disabled then just exit. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Acked-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9ab81fb7a9
commit
f43de77c9d
@ -2377,23 +2377,17 @@ static int __init panel_init_module(void)
|
|||||||
/* tells various subsystems about the fact that we are initializing */
|
/* tells various subsystems about the fact that we are initializing */
|
||||||
init_in_progress = 1;
|
init_in_progress = 1;
|
||||||
|
|
||||||
|
if (!lcd.enabled && !keypad.enabled) {
|
||||||
|
/* no device enabled, let's exit */
|
||||||
|
pr_err("driver version " PANEL_VERSION " disabled.\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
if (parport_register_driver(&panel_driver)) {
|
if (parport_register_driver(&panel_driver)) {
|
||||||
pr_err("could not register with parport. Aborting.\n");
|
pr_err("could not register with parport. Aborting.\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lcd.enabled && !keypad.enabled) {
|
|
||||||
/* no device enabled, let's release the parport */
|
|
||||||
if (pprt) {
|
|
||||||
parport_release(pprt);
|
|
||||||
parport_unregister_device(pprt);
|
|
||||||
pprt = NULL;
|
|
||||||
}
|
|
||||||
parport_unregister_driver(&panel_driver);
|
|
||||||
pr_err("driver version " PANEL_VERSION " disabled.\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
register_reboot_notifier(&panel_notifier);
|
register_reboot_notifier(&panel_notifier);
|
||||||
|
|
||||||
if (pprt)
|
if (pprt)
|
||||||
|
Loading…
Reference in New Issue
Block a user