TTY:vt: convert remain take_over_console's users to do_take_over_console
Subsystems (9)
PATCH 1/1 TTY:vt: convert remain take_over_console's users to do_take_over_console
Impact:
1:convert all remain take_over_console to do_take_over_console 2:update take_over_console to do_take_over_console in comment
Commit dc9641895abb ("vt: delete unneeded functions register_con_driver|take_over_console") delete take_over_console, but forget to convert remain take_over_console's users to new API do_take_over_console, this patch fix it.
---
Sorry for my mistake, I believe I do the full
kernel source find|grep, but the reality is I
forget take_over_console.
I will send the patch to update DOC tonight.
arch/alpha/kernel/console.c | 4 +++- arch/alpha/kernel/process.c | 4 +++- arch/mips/pci/pci-bcm1480.c | 4 +++- arch/mips/pci/pci-sb1250.c | 4 +++- arch/parisc/kernel/setup.c | 2 +- drivers/tty/vt/vt.c | 2 +- drivers/usb/misc/sisusbvga/sisusb_con.c | 18 +++++++++++------- drivers/video/console/fbcon.c | 2 +- drivers/video/console/mdacon.c | 8 ++++++-- drivers/video/console/newport_con.c | 9 ++++++--- drivers/video/console/sticon.c | 6 +++++- 11 files changed, 43 insertions(+), 20 deletions(-)
arch/alpha/kernel/console.c +3 -1
@@ -61,7 +61,9 @@ locate_and_init_vga(void *(*sel_func)(void *, void *))/* Set the VGA hose and init the new console. */ pci_vga_hose = hose; -take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_lock (); +do_take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_unlock (); }void __init
arch/alpha/kernel/process.c +3 -1
@@ -117,7 +117,9 @@ common_shutdown_1(void *generic_ptr)if (in_interrupt ())irq_exit ();/* This has the effect of resetting the VGA video origin. */ -take_over_console (&dummy_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_lock (); +do_take_over_console (&dummy_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_unlock ();#endif pci_restore_srm_config ();set_hae (srm_hae);
arch/mips/pci/pci-bcm1480.c +3 -1
@@ -257,7 +257,9 @@ static int __init bcm1480_pcibios_init(void)register_pci_controller (&bcm1480_controller);#ifdef CONFIG_VGA_CONSOLE -take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_lock (); +do_take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_unlock ();#endif return 0 ; }
arch/mips/pci/pci-sb1250.c +3 -1
@@ -283,7 +283,9 @@ static int __init sb1250_pcibios_init(void)register_pci_controller (&sb1250_controller);#ifdef CONFIG_VGA_CONSOLE -take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_lock (); +do_take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_unlock ();#endif return 0 ; }
arch/parisc/kernel/setup.c +1 -1
@@ -155,7 +155,7 @@ void __init setup_arch(char **cmdline_p)#endif #if defined(CONFIG_VT ) && defined(CONFIG_DUMMY_CONSOLE ) - conswitchp = &dummy_con;/* we use take_over_console() later ! */ + conswitchp = &dummy_con;/* we use do_take_over_console() later ! */ #endif }
drivers/tty/vt/vt.c +1 -1
@@ -3592,7 +3592,7 @@ EXPORT_SYMBOL_GPL(do_unregister_con_driver);* when a driver wants to take over some existing consoles * and become default driver for newly opened ones. * -* take_over_console is basically a register followed by unbind +* do_take_over_console is basically a register followed by unbind */ int do_take_over_console (const struct consw *csw,int first,int last,int deflt) {
drivers/usb/misc/sisusbvga/sisusb_con.c +11 -7
@@ -208,7 +208,7 @@ sisusbcon_init(struct vc_data *c, int init)struct sisusb_usb_data *sisusb;int cols, rows; -/* This is called by take_over_console(), +/* This is called by do_take_over_console(), * ie by us/under our control. It is * only called after text mode and fonts * are set up/restored.
@@ -273,7 +273,7 @@ sisusbcon_deinit(struct vc_data *c)struct sisusb_usb_data *sisusb;int i; -/* This is called by take_over_console() +/* This is called by do_take_over_console() * and others, ie not under our control. */
@@ -1490,8 +1490,9 @@ sisusb_console_init(struct sisusb_usb_data *sisusb, int first, int last)mutex_unlock (&sisusb->lock);/* Now grab the desired console(s) */ - ret =take_over_console (&sisusb_con, first -1 , last -1 ,0 ); - +console_lock (); + ret =do_take_over_console (&sisusb_con, first -1 , last -1 ,0 ); +console_unlock ();if (!ret) sisusb->haveconsole =1 ;else {
@@ -1535,11 +1536,14 @@ sisusb_console_exit(struct sisusb_usb_data *sisusb)if (sisusb->haveconsole) {for (i =0 ; i <MAX_NR_CONSOLES ; i++) -if (sisusb->havethisconsole[i]) -take_over_console (&sisusb_dummy_con, i, i,0 ); +if (sisusb->havethisconsole[i]) { +console_lock (); +do_take_over_console (&sisusb_dummy_con, i, i,0 ); +console_unlock ();/* At this point, con_deinit for all our -* consoles is executed by take_over_console(). +* consoles is executed by do_take_over_console(). */ + } sisusb->haveconsole =0 ; }
drivers/video/console/fbcon.c +1 -1
@@ -873,7 +873,7 @@ static int set_con2fb_map(int unit, int newidx, int user)/* * Low Level Operations */ -/* NOTE: fbcon cannot be __init: it may be called from take_over_console later */ +/* NOTE: fbcon cannot be __init: it may be called from do_take_over_console later */ static int var_to_display (struct display *disp,struct fb_var_screeninfo *var,struct fb_info *info)
drivers/video/console/mdacon.c +6 -2
@@ -585,10 +585,14 @@ static const struct consw mda_con = {int __init mda_console_init (void ) { +int err; +if (mda_first_vc > mda_last_vc)return 1 ; - -return take_over_console (&mda_con, mda_first_vc-1 , mda_last_vc-1 ,0 ); +console_lock (); + err =do_take_over_console (&mda_con, mda_first_vc-1 , mda_last_vc-1 ,0 ); +console_unlock (); +return err; } static void __exit mda_console_exit(void)
drivers/video/console/newport_con.c +6 -3
@@ -297,7 +297,7 @@ static void newport_exit(void)newport_set_def_font (i,NULL ); } -/* Can't be __init, take_over_console may call it later */ +/* Can't be __init, do_take_over_console may call it later */ static const char *newport_startup (void ) {int i;
@@ -746,6 +746,7 @@ static int newport_probe(struct gio_device *dev, const struct gio_device_id *id) {unsigned long newport_addr; +int err;if (!dev->resource.start)return -EINVAL ;
@@ -759,8 +760,10 @@ static int newport_probe(struct gio_device *dev, npregs = (struct newport_regs *)/* ioremap cannot fail */ ioremap (newport_addr,sizeof (struct newport_regs )); - -return take_over_console (&newport_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_lock (); + err =do_take_over_console (&newport_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_unlock (); +return err; }static void newport_remove (struct gio_device *dev)
drivers/video/console/sticon.c +5 -1
@@ -372,6 +372,7 @@ static const struct consw sti_con = {static int __init sticonsole_init (void ) { +int err;/* already initialized ? */ if (sticon_sti)return 0 ;
@@ -382,7 +383,10 @@ static int __init sticonsole_init(void)if (conswitchp == &dummy_con) {printk (KERN_INFO "sticon: Initializing STI text console.\n" ); -return take_over_console (&sti_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_lock (); + err =do_take_over_console (&sti_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_unlock (); +return err; }return 0 ; }
Signature · 1 line
1.7.12.4.dirty
Quoted 9 lines · Wang YanQing
Impact:
1:convert all remaintake_over_consoletodo_take_over_console2:updatetake_over_consoletodo_take_over_consolein commentCommit
dc9641895abb("vt: delete unneeded functions register_con_driver|take_over_console") deletetake_over_console, but forget to convert remain take_over_console's users to new APIdo_take_over_console, this patch fix it.
Quoted 5 lines
Signed-off-by Wang YanQing <[email protected]>---
Sorry for my mistake, I believe I do the full
kernel source find|grep, but the reality is I
forgettake_over_console.
I would rather revert dc9641895abb which purported to delete _unneeded_ functions than have this. Obviously the functions were needed.
Regards,
Peter Hurley
Quoted 4 lines · Peter Hurley
I would rather revert
dc9641895abbwhich purported to delete _unneeded_ functions than have this. Obviously the functions were needed.
Hi Peter, this series patches' goal is to reduce codes' redundance and function duplication. But if we keep take_over_console, then we have to rewrite it as a trivial wrapper over do_take_over_console, or we have to keep bind_con_driver and register_con_driver, and this will bring use codes' redundance.
And if we rewrite take_over_console as a wrapper over do_take_over_console, it is so trivial, delete it and let kernel use the unified version of APIs will simplify the APIs.
Thanks.
Quoted 12 lines · Wang YanQing
Quoted 4 lines · Peter Hurley
I would rather revert
dc9641895abbwhich purported to delete _unneeded_ functions than have this. Obviously the functions were needed.Hi Peter, this series patches' goal is to reduce codes' redundance and function duplication. But if we keep
take_over_console, then we have to rewrite it as a trivial wrapper overdo_take_over_console, or we have to keepbind_con_driverandregister_con_driver, and this will bring use codes' redundance.
Quoted 3 lines
And if we rewrite
take_over_consoleas a wrapper overdo_take_over_console, it is so trivial, delete it and let kernel use the unified version of APIs will simplify the APIs.
Except now you're spreading the brokenness that is console_lock() over many more source files than the single-use case of do_take_over_console().
The actual interface is take_over_console(); the _workaround_ is exposing do_take_over_console() for fbcon to wrap.
Regards,
Peter Hurley
Quoted 17 lines · Peter Hurley
Quoted 12 lines · Wang YanQing
Quoted 4 lines · Peter Hurley
I would rather revert
dc9641895abbwhich purported to delete _unneeded_ functions than have this. Obviously the functions were needed.Hi Peter, this series patches' goal is to reduce codes' redundance and function duplication. But if we keep
take_over_console, then we have to rewrite it as a trivial wrapper overdo_take_over_console, or we have to keepbind_con_driverandregister_con_driver, and this will bring use codes' redundance.Quoted 3 lines
And if we rewrite
take_over_consoleas a wrapper overdo_take_over_console, it is so trivial, delete it and let kernel use the unified version of APIs will simplify the APIs.
Quoted 6 lines
Except now you're spreading the brokenness that is
console_lock()over many more source files than the single-use case ofdo_take_over_console().The actual interface is
take_over_console(); the _workaround_ is exposingdo_take_over_console()for fbcon to wrap.
This _workaround_ willn't work, take_over_console will hold console_lock internal, but do_take_over_console need caller hold console_lock, then we can't rewrite do_take_over_console as a wrap base on take_over_console.
But the reverse is ok. So if we have to do it, then the actual interface is do_take_over_console, and the "_workaround_" is exposing take_over_console as a wrap base on do_take_over_console.
Quoted 7 lines · Wang YanQing
Quoted 6 lines
Except now you're spreading the brokenness that is
console_lock()over many more source files than the single-use case ofdo_take_over_console().The actual interface is
take_over_console(); the _workaround_ is exposingdo_take_over_console()for fbcon to wrap.
Quoted 7 lines
This _workaround_ willn't work,
take_over_consolewill holdconsole_lockinternal, butdo_take_over_consoleneed caller holdconsole_lock, then we can't rewritedo_take_over_consoleas a wrap base ontake_over_console.But the reverse is ok. So if we have to do it, then the actual interface is
do_take_over_console, and the "_workaround_" is exposingtake_over_consoleas a wrap base ondo_take_over_console.
But if we do this, then we have two version functions do the same thing except caller/callee hold lock, I can't see much sense to have them at the same time.
Thanks.
Quoted 11 lines · Wang YanQing
Quoted 10 lines · Wang YanQing
Quoted 6 lines
Except now you're spreading the brokenness that is
console_lock()over many more source files than the single-use case ofdo_take_over_console().The actual interface is
take_over_console(); the _workaround_ is exposingdo_take_over_console()for fbcon to wrap.This _workaround_ willn't work,
take_over_consolewill holdconsole_lockinternal, butdo_take_over_consoleneed caller holdconsole_lock, then we can't rewritedo_take_over_consoleas a wrap base ontake_over_console.
The workaround I'm referring to is commit 50e244cc793 which exposed do_take_over_console() as an interface to band aid the lock problems.
I'm ok with take_over_console() being a lock wrapper around do_take_over_console(), if you are trying to preserve your other changes.
Regards,
Peter Hurley
Quoted 2 lines · Wang YanQing
Impact:
1:convert all remaintake_over_consoletodo_take_over_console
This is step backwards.
arch/alpha/kernel/console.c locate_and_init_vga(void *(*sel_func)(void *, void *)) · line 67
Quoted 11 lines
arch/alpha/kernel/console.c +3
-1@@ -61,7 +61,9 @@ locate_and_init_vga(void *(*sel_func)(void *, void *))/* Set the VGA hose and init the new console. */ pci_vga_hose = hose; -take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_lock (); +do_take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_unlock (); }
Original was better.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 5 lines · Pavel Machek
Quoted 2 lines · Wang YanQing
Impact:
1:convert all remaintake_over_consoletodo_take_over_consoleThis is step backwards.
What is step backwards? do_take_over_console appear MUCH MUCH later in kernel than take_over_console, do_take_over_console is the new API, I can't understand what is step backwards.
Quoted 4 lines
Quoted 4 lines
arch/alpha/kernel/console.c +0
-0@@ -61,7 +61,9 @@ locate_and_init_vga(void *(*sel_func)(void *, void *))
Quoted 9 lines
arch/alpha/kernel/console.c locate_and_init_vga(void *(*sel_func)(void *, void *)) · line 67
Quoted 7 lines
arch/alpha/kernel/console.c +3
-1/* Set the VGA hose and init the new console. */ pci_vga_hose = hose; -take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_lock (); +do_take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_unlock (); }Original was better.
Except reduce some console_lock/unlock scatter scattered in kernel, I can't see the "BETTER", and it is not a BIG problem for the benefit to unify the API.
Thanks.
Quoted 10 lines · Wang YanQing
Quoted 5 lines · Pavel Machek
Quoted 2 lines · Wang YanQing
Impact:
1:convert all remaintake_over_consoletodo_take_over_consoleThis is step backwards.
What is step backwards?
do_take_over_consoleappear MUCH MUCH later in kernel thantake_over_console,do_take_over_consoleis the new API, I can't understand what is step backwards.
"do_*" is internal api, "*" is external api. You sprinkle internal api all over the place.
Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
arch/alpha/kernel/console.c +0
-0@@ -61,7 +61,9 @@ locate_and_init_vga(void *(*sel_func)(void *, void *))Quoted 9 lines
arch/alpha/kernel/console.c locate_and_init_vga(void *(*sel_func)(void *, void *)) · line 67
Quoted 7 lines
arch/alpha/kernel/console.c +3
-1/* Set the VGA hose and init the new console. */ pci_vga_hose = hose; -take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_lock (); +do_take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_unlock (); }Original was better.
Quoted 3 lines
Except reduce some console_lock/unlock scatter scattered in kernel, I can't see the "BETTER", and it is not a BIG problem for the benefit to unify the API.
You replaced "calling exported function" with "calling internal-sounding function and adding locking too".
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 6 lines · Pavel Machek
Quoted 5 lines · Wang YanQing
Quoted 4 lines · Pavel Machek
Quoted 2 lines · Wang YanQing
Impact:
1:convert all remaintake_over_consoletodo_take_over_console
Quoted 9 lines
Quoted 5 lines
Quoted 1 line
This is step backwards.
What is step backwards?
do_take_over_consoleappear MUCH MUCH later in kernel thantake_over_console,do_take_over_consoleis the new API, I can't understand what is step backwards."do_*" is internal api, "*" is external api. You sprinkle internal api all over the place.
internal vs external? No, they only have one difference, callee vs caller hold the console lock.
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
arch/alpha/kernel/console.c locate_and_init_vga(void *(*sel_func)(void *, void *)) · line 67
Quoted 11 lines
arch/alpha/kernel/console.c +3
-1@@ -61,7 +61,9 @@ locate_and_init_vga(void *(*sel_func)(void *, void *))/* Set the VGA hose and init the new console. */ pci_vga_hose = hose; -take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_lock (); +do_take_over_console (&vga_con,0 ,MAX_NR_CONSOLES -1 ,1 ); +console_unlock (); }Original was better.
Quoted 6 lines
Quoted 3 lines
Except reduce some console_lock/unlock scatter scattered in kernel, I can't see the "BETTER", and it is not a BIG problem for the benefit to unify the API.
You replaced "calling exported function" with "calling internal-sounding function and adding locking too".
do_take_over_console is also exported by:
EXPORT_SYMBOL_GPL(do_take_over_console)