drivers/tty/hvc: don't use module_init in non-modular hyp. console code
PATCH v2 1/1 drivers/tty/hvc: don't use module_init in non-modular hyp. console code
The HVC_OPAL/RTAS/UDBG/XEN options are all bool, and hence their support is either present or absent. It will never be modular, so using module_init as an alias for __initcall is rather misleading.
Fix this up now, so that we can relocate module_init from init.h into module.h in the future. If we don't do this, we'd have to add module.h to obviously non-modular code, and that would be a worse thing.
Note that direct use of __initcall is discouraged, vs. one of the priority categorized subgroups. As __initcall gets mapped onto device_initcall, our use of device_initcall directly in this change means that the runtime impact is zero -- it will remain at level 6 in initcall ordering.
Also the __exitcall functions have been outright deleted since they are only ever of interest to UML, and UML will never be using any of this code.
---
[v2: unchanged; just added xen guys to Cc list, as hvc_xen isnt
hooked into the MAINTAINERS file as of yet, so I forgot them.]
drivers/tty/hvc/hvc_opal.c +1 -7
@@ -255,13 +255,7 @@ static int __init hvc_opal_init(void)/* Register as a vio device to receive callbacks */ return platform_driver_register (&hvc_opal_driver); } -module_init (hvc_opal_init); - -static void __exit hvc_opal_exit(void) -{ -platform_driver_unregister (&hvc_opal_driver); -} -module_exit (hvc_opal_exit); +device_initcall (hvc_opal_init);static void udbg_opal_putc (char c) {
drivers/tty/hvc/hvc_rtas.c +1 -11
@@ -102,17 +102,7 @@ static int __init hvc_rtas_init(void)return 0 ; } -module_init (hvc_rtas_init); - -/* This will tear down the tty portion of the driver */ -static void __exit hvc_rtas_exit(void) -{ -/* Really the fun isn't over until the worker thread breaks down and -* the tty cleans up */ -if (hvc_rtas_dev) -hvc_remove (hvc_rtas_dev); -} -module_exit (hvc_rtas_exit); +device_initcall (hvc_rtas_init);/* This will happen prior to module init. There is no tty at this time? */ static int __init hvc_rtas_console_init (void )
drivers/tty/hvc/hvc_udbg.c +1 -8
@@ -80,14 +80,7 @@ static int __init hvc_udbg_init(void)return 0 ; } -module_init (hvc_udbg_init); - -static void __exit hvc_udbg_exit(void) -{ -if (hvc_udbg_dev) -hvc_remove (hvc_udbg_dev); -} -module_exit (hvc_udbg_exit); +device_initcall (hvc_udbg_init);static int __init hvc_udbg_console_init (void ) {
drivers/tty/hvc/hvc_xen.c +1 -16
@@ -561,18 +561,7 @@ static int __init xen_hvc_init(void)#endif return r; } - -static void __exit xen_hvc_fini(void) -{ -struct xencons_info *entry, *next; - -if (list_empty (&xenconsoles)) -return ; - -list_for_each_entry_safe (entry, next, &xenconsoles, list) { -xen_console_remove (entry); - } -} +device_initcall (xen_hvc_init);static int xen_cons_init (void ) {
@@ -598,10 +587,6 @@ static int xen_cons_init(void)hvc_instantiate (HVC_COOKIE ,0 , ops);return 0 ; } - - -module_init (xen_hvc_init); -module_exit (xen_hvc_fini);console_initcall (xen_cons_init);#ifdef CONFIG_EARLY_PRINTK
Signature · 1 line
1.8.5.2
Quoted 15 lines · Paul Gortmaker
The HVC_OPAL/RTAS/UDBG/XEN options are all bool, and hence their support is either present or absent. It will never be modular, so using
module_initas an alias for__initcallis rather misleading.Fix this up now, so that we can relocate
module_initfrominit.hintomodule.hin the future. If we don't do this, we'd have to addmodule.hto obviously non-modular code, and that would be a worse thing.Note that direct use of
__initcallis discouraged, vs. one of the priority categorized subgroups. As__initcallgets mapped ontodevice_initcall, our use ofdevice_initcalldirectly in this change means that the runtime impact is zero -- it will remain at level 6 in initcall ordering.
Quoted 3 lines
Also the
__exitcallfunctions have been outright deleted since they are only ever of interest to UML, and UML will never be using any of this code.
For the hvc_xen changes
Thanks
David
Quoted 15 lines · Paul Gortmaker
The HVC_OPAL/RTAS/UDBG/XEN options are all bool, and hence their support is either present or absent. It will never be modular, so using
module_initas an alias for__initcallis rather misleading.Fix this up now, so that we can relocate
module_initfrominit.hintomodule.hin the future. If we don't do this, we'd have to addmodule.hto obviously non-modular code, and that would be a worse thing.Note that direct use of
__initcallis discouraged, vs. one of the priority categorized subgroups. As__initcallgets mapped ontodevice_initcall, our use ofdevice_initcalldirectly in this change means that the runtime impact is zero -- it will remain at level 6 in initcall ordering.
Quoted 3 lines
Also the
__exitcallfunctions have been outright deleted since they are only ever of interest to UML, and UML will never be using any of this code.
For the hvc_xen changes
Thanks
David