Commit b6fed5fc authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] clean up all the console inits using an initcall variant

Dave Woodhouse did this a while ago and its been kicking around in my
tree just fine. This gets rid of a lot of the init lists of functions
still left in the kernel by having an __init type array built up for the
consoles as well
parent 69550c78
......@@ -63,6 +63,13 @@ SECTIONS
.init.ramfs : { *(.init.ramfs) }
__initramfs_end = .;
. = ALIGN(8)
.con_initcall.init: {
__con_initcall_start = .;
*(.con_initcall.init)
__con_initcall_end = .;
}
. = ALIGN(64);
__per_cpu_start = .;
.data.percpu : { *(.data.percpu) }
......
......@@ -38,6 +38,9 @@ SECTIONS
*(.initcall6.init)
*(.initcall7.init)
__initcall_end = .;
__con_initcall_start = .;
*(.con_initcall.init)
__con_initcall_end = .;
. = ALIGN(32768);
__init_end = .;
}
......
......@@ -45,6 +45,9 @@ SECTIONS
*(.initcall6.init)
*(.initcall7.init)
__initcall_end = .;
__con_initcall_start = .;
*(.con_initcall.init)
__con_initcall_end = .;
. = ALIGN(32);
__initramfs_start = .;
usr/built-in.o(.init.ramfs)
......
......@@ -69,7 +69,12 @@ SECTIONS
*(.initcall6.init);
*(.initcall7.init);
__initcall_end = .;
}
.con_initcall.init : {
__con_initcall_start = .;
*(.con_initcall.init)
__con_initcall_end = .;
/* We fill to the next page, so we can discard all init
pages without needing to consider what payload might be
appended to the kernel image. */
......
......@@ -74,6 +74,9 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(4096);
__initramfs_start = .;
.init.ramfs : { *(.init.ramfs) }
......
......@@ -133,6 +133,10 @@ SECTIONS
*(.initcall7.init)
__initcall_end = .;
}
__con_initcall_start = .;
.con_initcall.init : AT(ADDR(.con_initcall.init) - PAGE_OFFSET)
{ *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(PAGE_SIZE);
__init_end = .;
......
......@@ -60,6 +60,9 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(8192);
__initramfs_start = .;
.init.ramfs : { *(.init.ramfs) }
......
......@@ -53,6 +53,9 @@ __init_begin = .;
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(8192);
__initramfs_start = .;
.init.ramfs : { *(.init.ramfs) }
......
......@@ -63,7 +63,8 @@ static struct console arc_cons = {
* Register console.
*/
void __init arc_console_init(void)
static void __init arc_console_init(void)
{
register_console(&arc_cons);
}
console_initcall(arc_console_init);
......@@ -3054,10 +3054,11 @@ static struct console sercons = {
/*
* Register console.
*/
void __init au1000_serial_console_init(void)
static void __init au1000_serial_console_init(void)
{
register_console(&sercons);
}
console_initcall(au1000_serial_console_init);
#endif
/*
......
......@@ -51,6 +51,9 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(4096); /* Align double page for init_task_union */
__init_end = .;
......
......@@ -50,6 +50,9 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(4096); /* Align double page for init_task_union */
__init_end = .;
......
......@@ -73,6 +73,9 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(4096);
__initramfs_start = .;
.init.ramfs : { *(.init.ramfs) }
......
......@@ -2522,12 +2522,11 @@ static kdev_t serial_console_device(struct console *c)
/*
* Register console.
*/
long __init console_8xx_init(long kmem_start, long kmem_end)
static void __init console_8xx_init(long kmem_start, long kmem_end)
{
register_console(&sercons);
return kmem_start;
}
console_initcall(console_8xx_init);
#endif
/* Index in baud rate table of the default console baud rate.
......
......@@ -107,6 +107,10 @@ SECTIONS
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
__start___ftr_fixup = .;
__ftr_fixup : { *(__ftr_fixup) }
__stop___ftr_fixup = .;
......
......@@ -97,6 +97,9 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(4096);
__initramfs_start = .;
.init.ramfs : { *(.init.ramfs) }
......
......@@ -78,6 +78,9 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(256);
__initramfs_start = .;
.init.ramfs : { *(.init.initramfs) }
......
......@@ -78,6 +78,9 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(256);
__initramfs_start = .;
.init.ramfs : { *(.init.initramfs) }
......
......@@ -68,6 +68,9 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
__machvec_start = .;
.machvec.init : { *(.machvec.init) }
__machvec_end = .;
......
......@@ -55,6 +55,9 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(4096);
__initramfs_start = .;
.init.ramfs : { *(.init.ramfs) }
......
......@@ -61,6 +61,9 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(8192);
__initramfs_start = .;
.init.ramfs : { *(.init.ramfs) }
......
......@@ -214,12 +214,13 @@ static struct console stdiocons = INIT_CONSOLE("tty", console_write,
console_device, console_setup,
CON_PRINTBUFFER);
void stdio_console_init(void)
static void __init stdio_console_init(void)
{
INIT_LIST_HEAD(&vts[0].chan_list);
list_add(&init_console_chan.list, &vts[0].chan_list);
register_console(&stdiocons);
}
console_initcall(stdio_console_init);
static int console_chan_setup(char *str)
{
......
......@@ -98,6 +98,9 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
__con_initcall_start = .;
.con_initcall.init : { *(.con_initcall.init) }
__con_initcall_end = .;
. = ALIGN(4096);
__initramfs_start = .;
.init.ramfs : { *(.init.ramfs) }
......
......@@ -2320,10 +2320,11 @@ static struct console sercons = {
/*
* Register console.
*/
void __init serial_console_init(void)
static void __init amiserial_console_init(void)
{
register_console(&sercons);
}
console_initcall(amiserial_console_init);
#endif
MODULE_LICENSE("GPL");
......@@ -75,7 +75,7 @@ __initcall(rs_init);
/* serial_console_init handles the special case of starting
* up the console on the serial port
*/
void __init serial_console_init(void)
static void __init decserial_console_init(void)
{
#if defined(CONFIG_ZS) && defined(CONFIG_DZ)
if (IOASIC)
......@@ -94,5 +94,6 @@ void __init serial_console_init(void)
#endif
}
console_initcall(decserial_console_init);
#endif
......@@ -346,11 +346,12 @@ struct console hvc_con_driver = {
.index = -1,
};
int __init hvc_console_init(void)
static int __init hvc_console_init(void)
{
register_console(&hvc_con_driver);
return 0;
}
console_initcall(hvc_console_init);
module_init(hvc_init);
module_exit(hvc_exit);
......@@ -2836,7 +2836,7 @@ static struct console sercons = {
};
void __init serial167_console_init(void)
static void __init serial167_console_init(void)
{
if (vme_brdtype == VME_TYPE_MVME166 ||
vme_brdtype == VME_TYPE_MVME167 ||
......@@ -2845,6 +2845,7 @@ void __init serial167_console_init(void)
register_console(&sercons);
}
}
console_initcall(serial167_console_init);
#ifdef CONFIG_REMOTE_DEBUG
void putDebugChar (int c)
......
......@@ -1054,9 +1054,10 @@ static struct console sercons = {
.index = -1
};
void __init tx3912_console_init(void)
static void __init tx3912_console_init(void)
{
register_console(&sercons);
}
console_initcall(tx3912_console_init);
#endif
......@@ -1275,7 +1275,7 @@ static struct console sercons = {
extern void sh_console_unregister (void);
#endif
void __init sci_console_init(void)
static void __init sci_console_init(void)
{
register_console(&sercons);
#ifdef CONFIG_SH_EARLY_PRINTK
......@@ -1285,4 +1285,6 @@ void __init sci_console_init(void)
sh_console_unregister();
#endif
}
console_initcall(sci_console_init);
#endif /* CONFIG_SERIAL_CONSOLE */
......@@ -113,7 +113,15 @@
#define TTY_PARANOIA_CHECK 1
#define CHECK_TTY_COUNT 1
struct termios tty_std_termios; /* for the benefit of tty drivers */
struct termios tty_std_termios = { /* for the benefit of tty drivers */
.c_iflag = ICRNL | IXON,
.c_oflag = OPOST | ONLCR,
.c_cflag = B38400 | CS8 | CREAD | HUPCL,
.c_lflag = ISIG | ICANON | ECHO | ECHOE | ECHOK |
ECHOCTL | ECHOKE | IEXTEN,
.c_cc = INIT_C_CC
};
LIST_HEAD(tty_drivers); /* linked list of tty drivers */
struct tty_ldisc ldiscs[NR_LDISCS]; /* line disc dispatch table */
......@@ -141,26 +149,13 @@ int tty_ioctl(struct inode * inode, struct file * file,
unsigned int cmd, unsigned long arg);
static int tty_fasync(int fd, struct file * filp, int on);
extern int vme_scc_init (void);
extern long vme_scc_console_init(void);
extern int serial167_init(void);
extern long serial167_console_init(void);
extern void console_8xx_init(void);
extern int rs_8xx_init(void);
extern void mac_scc_console_init(void);
extern void sclp_console_init(void);
extern void sclp_tty_init(void);
extern void con3215_init(void);
extern void tub3270_con_init(void);
extern void hwc_tty_init(void);
extern void tty3215_init(void);
extern void tub3270_init(void);
extern void uart_console_init(void);
extern void sgi_serial_console_init(void);
extern void sci_console_init(void);
extern void m68328_console_init(void);
extern void mcfrs_console_init(void);
extern void rs_360_init(void);
extern void tx3912_console_init(void);
extern void tx3912_rs_init(void);
extern void hvc_console_init(void);
static struct tty_struct *alloc_tty_struct(void)
{
......@@ -306,13 +301,9 @@ static int tty_set_ldisc(struct tty_struct *tty, int ldisc)
if (tty->ldisc.open)
retval = (tty->ldisc.open)(tty);
if (retval < 0) {
module_put(tty->ldisc.owner);
tty->ldisc = o_ldisc;
tty->termios->c_line = tty->ldisc.num;
if (tty->ldisc.open && (tty->ldisc.open(tty) < 0)) {
module_put(tty->ldisc.owner);
tty->ldisc = ldiscs[N_TTY];
tty->termios->c_line = N_TTY;
if (tty->ldisc.open) {
......@@ -2206,22 +2197,11 @@ int tty_unregister_driver(struct tty_driver *driver)
*/
void __init console_init(void)
{
initcall_t *call;
/* Setup the default TTY line discipline. */
memset(ldiscs, 0, sizeof(ldiscs));
(void) tty_register_ldisc(N_TTY, &tty_ldisc_N_TTY);
/*
* Set up the standard termios. Individual tty drivers may
* deviate from this; this is used as a template.
*/
memset(&tty_std_termios, 0, sizeof(struct termios));
memcpy(tty_std_termios.c_cc, INIT_C_CC, NCCS);
tty_std_termios.c_iflag = ICRNL | IXON;
tty_std_termios.c_oflag = OPOST | ONLCR;
tty_std_termios.c_cflag = B38400 | CS8 | CREAD | HUPCL;
tty_std_termios.c_lflag = ISIG | ICANON | ECHO | ECHOE | ECHOK |
ECHOCTL | ECHOKE | IEXTEN;
/*
* set up the console device so that later boot sequences can
* inform about problems etc..
......@@ -2229,68 +2209,16 @@ void __init console_init(void)
#ifdef CONFIG_EARLY_PRINTK
disable_early_printk();
#endif
#ifdef CONFIG_VT
con_init();
#endif
#ifdef CONFIG_AU1000_SERIAL_CONSOLE
au1000_serial_console_init();
#endif
#ifdef CONFIG_SERIAL_CONSOLE
#if (defined(CONFIG_8xx) || defined(CONFIG_8260))
console_8xx_init();
#elif defined(CONFIG_MAC_SERIAL)
mac_scc_console_init();
#elif defined(CONFIG_PARISC)
pdc_console_init();
#elif defined(CONFIG_SERIAL)
serial_console_init();
#endif /* CONFIG_8xx */
#ifdef CONFIG_SGI_SERIAL
sgi_serial_console_init();
#endif
#if defined(CONFIG_MVME162_SCC) || defined(CONFIG_BVME6000_SCC) || defined(CONFIG_MVME147_SCC)
vme_scc_console_init();
#endif
#if defined(CONFIG_SERIAL167)
serial167_console_init();
#endif
#if defined(CONFIG_SH_SCI)
sci_console_init();
#endif
#endif
#ifdef CONFIG_TN3270_CONSOLE
tub3270_con_init();
#endif
#ifdef CONFIG_TN3215_CONSOLE
con3215_init();
#endif
#ifdef CONFIG_SCLP_CONSOLE
sclp_console_init();
#endif
#ifdef CONFIG_STDIO_CONSOLE
stdio_console_init();
#endif
#ifdef CONFIG_SERIAL_CORE_CONSOLE
uart_console_init();
#endif
#ifdef CONFIG_ARC_CONSOLE
arc_console_init();
#endif
#ifdef CONFIG_SERIAL_68328
m68328_console_init();
#endif
#ifdef CONFIG_SERIAL_COLDFIRE
mcfrs_console_init();
#endif
#ifdef CONFIG_SERIAL_68360
rs_360_init();
#endif
#ifdef CONFIG_SERIAL_TX3912_CONSOLE
tx3912_console_init();
#endif
#ifdef CONFIG_HVC_CONSOLE
hvc_console_init();
/* This is not a console initcall. I know not what it's doing here.
So I haven't moved it. dwmw2 */
rs_360_init();
#endif
call = &__con_initcall_start;
while (call < &__con_initcall_end) {
(*call)();
call++;
}
}
static struct tty_driver dev_tty_driver, dev_syscons_driver;
......
......@@ -1091,7 +1091,7 @@ static struct console sercons = {
};
void __init vme_scc_console_init(void)
static void __init vme_scc_console_init(void)
{
if (vme_brdtype == VME_TYPE_MVME147 ||
vme_brdtype == VME_TYPE_MVME162 ||
......@@ -1100,4 +1100,4 @@ void __init vme_scc_console_init(void)
vme_brdtype == VME_TYPE_BVME6000)
register_console(&sercons);
}
console_initcall(vme_scc_console_init);
......@@ -2443,7 +2443,7 @@ static void vc_init(unsigned int currcons, unsigned int rows, unsigned int cols,
struct tty_driver console_driver;
static int console_refcount;
void __init con_init(void)
static void __init con_init(void)
{
const char *display_desc = NULL;
unsigned int currcons = 0;
......@@ -2492,6 +2492,7 @@ void __init con_init(void)
register_console(&vt_console_driver);
#endif
}
console_initcall(con_init);
int __init vty_init(void)
{
......
......@@ -3043,10 +3043,12 @@ static struct console sercons = {
/*
* Register console.
*/
void __init mac_scc_console_init(void)
static void __init mac_scc_console_init(void)
{
register_console(&sercons);
}
console_initcall(mac_scc_console_init);
#endif /* ifdef CONFIG_SERIAL_CONSOLE */
#ifdef CONFIG_KGDB
......
......@@ -862,7 +862,7 @@ con3215_unblank(void)
spin_unlock_irqrestore(raw->lock, flags);
}
static int __init
static int __init
con3215_consetup(struct console *co, char *options)
{
return 0;
......@@ -884,7 +884,7 @@ static struct console con3215 = {
* 3215 console initialization code called from console_init().
* NOTE: This is called before kmalloc is available.
*/
void __init
static void __init
con3215_init(void)
{
struct ccw_device *cdev;
......@@ -1122,6 +1122,7 @@ tty3215_unthrottle(struct tty_struct * tty)
spin_unlock_irqrestore(raw->lock, flags);
}
}
console_initcall(con3215_init);
/*
* Disable writing to a 3215 tty
......
......@@ -237,3 +237,5 @@ sclp_console_init(void)
/* enable printk-access to this driver */
register_console(&sclp_console);
}
console_initcall(sclp_console_init);
......@@ -797,3 +797,6 @@ sclp_tty_init(void)
if (tty_register_driver(&sclp_tty_driver))
panic("Couldn't register sclp_tty driver\n");
}
console_initcall(sclp_tty_init);
......@@ -131,7 +131,7 @@ __initfunc (long tub3270_con_init(long kmem_start, long kmem_end))
#else
#define tub3270_con_devno console_device
void __init tub3270_con_init(void)
static void __init tub3270_con_init(void)
{
tub3270_con_bcb.bc_len = 65536;
if (!CONSOLE_IS_3270)
......@@ -140,6 +140,8 @@ void __init tub3270_con_init(void)
tub3270_con_bcb.bc_len);
register_console(&tub3270_con);
}
console_initcall(tub3270_con_init);
#endif
static kdev_t
......
......@@ -501,11 +501,12 @@ static struct console serial21285_console =
.index = -1,
};
void __init rs285_console_init(void)
static void __init rs285_console_init(void)
{
serial21285_setup_ports();
register_console(&serial21285_console);
}
console_initcall(rs285_console_init);
#define SERIAL_21285_CONSOLE &serial21285_console
#else
......
......@@ -1691,8 +1691,9 @@ static struct console m68328_driver = {
};
void m68328_console_init(void)
static void __init m68328_console_init(void)
{
register_console(&m68328_driver);
}
console_initcall(m68328_console_init);
......@@ -1982,11 +1982,12 @@ static struct console serial8250_console = {
.index = -1,
};
void __init serial8250_console_init(void)
static void __init serial8250_console_init(void)
{
serial8250_isa_init_ports();
register_console(&serial8250_console);
}
console_initcall(serial8250_console_init);
#define SERIAL8250_CONSOLE &serial8250_console
#else
......
......@@ -705,10 +705,11 @@ static struct console amba_console = {
.index = -1,
};
void __init ambauart_console_init(void)
static void __init ambauart_console_init(void)
{
register_console(&amba_console);
}
console_initcall(ambauart_console_init);
#define AMBA_CONSOLE &amba_console
#else
......
......@@ -502,11 +502,12 @@ static struct console anakin_console = {
.index = -1,
};
void __init
static void __init
anakin_console_init(void)
{
register_console(&anakin_console);
}
console_initcall(anakin_console_init);
#define ANAKIN_CONSOLE &anakin_console
#else
......
......@@ -567,10 +567,11 @@ static struct console clps711x_console = {
.index = -1,
};
void __init clps711xuart_console_init(void)
static void __init clps711xuart_console_init(void)
{
register_console(&clps711x_console);
}
console_initcall(clps711xuart_console_init);
#define CLPS711X_CONSOLE &clps711x_console
#else
......
......@@ -1890,42 +1890,6 @@ uart_set_options(struct uart_port *port, struct console *co,
return 0;
}
extern void ambauart_console_init(void);
extern void anakin_console_init(void);
extern void clps711xuart_console_init(void);
extern void rs285_console_init(void);
extern void sa1100_rs_console_init(void);
extern void serial8250_console_init(void);
extern void uart00_console_init(void);
/*
* Central "initialise all serial consoles" container. Needs to be killed.
*/
void __init uart_console_init(void)
{
#ifdef CONFIG_SERIAL_AMBA_CONSOLE
ambauart_console_init();
#endif
#ifdef CONFIG_SERIAL_ANAKIN_CONSOLE
anakin_console_init();
#endif
#ifdef CONFIG_SERIAL_CLPS711X_CONSOLE
clps711xuart_console_init();
#endif
#ifdef CONFIG_SERIAL_21285_CONSOLE
rs285_console_init();
#endif
#ifdef CONFIG_SERIAL_SA1100_CONSOLE
sa1100_rs_console_init();
#endif
#ifdef CONFIG_SERIAL_8250_CONSOLE
serial8250_console_init();
#endif
#ifdef CONFIG_SERIAL_UART00_CONSOLE
uart00_console_init();
#endif
}
#endif /* CONFIG_SERIAL_CORE_CONSOLE */
#ifdef CONFIG_PM
......
......@@ -1853,9 +1853,11 @@ struct console mcfrs_console = {
.index = -1,
};
void __init mcfrs_console_init(void)
static void __init mcfrs_console_init(void)
{
register_console(&mcfrs_console);
}
console_initcall(mcfrs_console_init);
/****************************************************************************/
......@@ -835,11 +835,12 @@ static struct console sa1100_console = {
.index = -1,
};
void __init sa1100_rs_console_init(void)
static void __init sa1100_rs_console_init(void)
{
sa1100_init_ports();
register_console(&sa1100_console);
}
console_initcall(sa1100_rs_console_init);
#define SA1100_CONSOLE &sa1100_console
#else
......
......@@ -645,10 +645,11 @@ static struct console uart00_console = {
.index = 0,
};
void __init uart00_console_init(void)
static void __init uart00_console_init(void)
{
register_console(&uart00_console);
}
console_initcall(uart00_console_init);
#define UART00_CONSOLE &uart00_console
#else
......
......@@ -2269,8 +2269,10 @@ static struct console sgi_console_driver = {
/*
* Register console.
*/
void __init sgi_serial_console_init(void)
static void __init sgi_serial_console_init(void)
{
register_console(&sgi_console_driver);
}
console_initcall(sgi_serial_console_init);
__initcall(rs_init);
......@@ -62,8 +62,10 @@
*/
typedef int (*initcall_t)(void);
typedef void (*exitcall_t)(void);
#endif
extern initcall_t __con_initcall_start, __con_initcall_end;
#endif
#ifndef MODULE
#ifndef __ASSEMBLY__
......@@ -91,6 +93,9 @@ typedef void (*exitcall_t)(void);
#define __exitcall(fn) \
static exitcall_t __exitcall_##fn __exit_call = fn
#define console_initcall(fn) \
static initcall_t __initcall_##fn __attribute__ ((unused,__section__ (".con_initcall.init")))=fn
struct obs_kernel_param {
const char *str;
int (*setup_func)(char *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment