Commit 7b0db1f8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] move some more initializations out of drivers/char/mem.c

From: Christoph Hellwig <hch@lst.de>

keeping init order the same..
parent e1d8d04d
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# #
FONTMAPFILE = cp437.uni FONTMAPFILE = cp437.uni
obj-y += mem.o tty_io.o n_tty.o tty_ioctl.o pty.o misc.o random.o obj-y += mem.o random.o tty_io.o n_tty.o tty_ioctl.o pty.o misc.o
obj-$(CONFIG_VT) += vt_ioctl.o vc_screen.o consolemap.o consolemap_deftbl.o selection.o keyboard.o obj-$(CONFIG_VT) += vt_ioctl.o vc_screen.o consolemap.o consolemap_deftbl.o selection.o keyboard.o
obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap.o obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap.o
......
...@@ -55,14 +55,24 @@ char ft_rev[] __initdata = "$Revision: 1.8 $"; ...@@ -55,14 +55,24 @@ char ft_rev[] __initdata = "$Revision: 1.8 $";
char ft_dat[] __initdata = "$Date: 1997/11/06 00:38:08 $"; char ft_dat[] __initdata = "$Date: 1997/11/06 00:38:08 $";
#ifndef CONFIG_FT_NO_TRACE_AT_ALL
static int ft_tracing = -1;
#endif
/* Called by modules package when installing the driver /* Called by modules package when installing the driver
* or by kernel during the initialization phase * or by kernel during the initialization phase
*/ */
int __init ftape_init(void) static int __init ftape_init(void)
{ {
TRACE_FUN(ft_t_flow); TRACE_FUN(ft_t_flow);
#ifdef MODULE #ifdef MODULE
#ifndef CONFIG_FT_NO_TRACE_AT_ALL
if (ft_tracing != -1) {
ftape_tracing = ft_tracing;
}
#endif
printk(KERN_INFO FTAPE_VERSION "\n"); printk(KERN_INFO FTAPE_VERSION "\n");
if (TRACE_LEVEL >= ft_t_info) { if (TRACE_LEVEL >= ft_t_info) {
printk( printk(
...@@ -112,13 +122,6 @@ KERN_INFO "Compiled for Linux version %s\n", UTS_RELEASE); ...@@ -112,13 +122,6 @@ KERN_INFO "Compiled for Linux version %s\n", UTS_RELEASE);
#endif #endif
TRACE_EXIT 0; TRACE_EXIT 0;
} }
#ifdef MODULE
#ifndef CONFIG_FT_NO_TRACE_AT_ALL
static int ft_tracing = -1;
#endif
#define FT_MOD_PARM(var,type,desc) \ #define FT_MOD_PARM(var,type,desc) \
MODULE_PARM(var,type); MODULE_PARM_DESC(var,desc) MODULE_PARM(var,type); MODULE_PARM_DESC(var,desc)
...@@ -141,21 +144,7 @@ MODULE_DESCRIPTION( ...@@ -141,21 +144,7 @@ MODULE_DESCRIPTION(
"QIC-117 driver for QIC-40/80/3010/3020 floppy tape drives."); "QIC-117 driver for QIC-40/80/3010/3020 floppy tape drives.");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
/* Called by modules package when installing the driver static void __exit ftape_exit(void)
*/
int init_module(void)
{
#ifndef CONFIG_FT_NO_TRACE_AT_ALL
if (ft_tracing != -1) {
ftape_tracing = ft_tracing;
}
#endif
return ftape_init();
}
/* Called by modules package when removing the driver
*/
void cleanup_module(void)
{ {
TRACE_FUN(ft_t_flow); TRACE_FUN(ft_t_flow);
...@@ -166,4 +155,6 @@ void cleanup_module(void) ...@@ -166,4 +155,6 @@ void cleanup_module(void)
printk(KERN_INFO "ftape: unloaded.\n"); printk(KERN_INFO "ftape: unloaded.\n");
TRACE_EXIT; TRACE_EXIT;
} }
#endif /* MODULE */
module_init(ftape_init);
module_exit(ftape_exit);
...@@ -680,17 +680,8 @@ static int __init chr_dev_init(void) ...@@ -680,17 +680,8 @@ static int __init chr_dev_init(void)
S_IFCHR | devlist[i].mode, devlist[i].name); S_IFCHR | devlist[i].mode, devlist[i].name);
} }
rand_initialize();
#if defined (CONFIG_FB) #if defined (CONFIG_FB)
fbmem_init(); fbmem_init();
#endif
tty_init();
#ifdef CONFIG_M68K_PRINTER
lp_m68k_init();
#endif
misc_init();
#ifdef CONFIG_FTAPE
ftape_init();
#endif #endif
return 0; return 0;
} }
......
...@@ -277,7 +277,7 @@ int misc_deregister(struct miscdevice * misc) ...@@ -277,7 +277,7 @@ int misc_deregister(struct miscdevice * misc)
EXPORT_SYMBOL(misc_register); EXPORT_SYMBOL(misc_register);
EXPORT_SYMBOL(misc_deregister); EXPORT_SYMBOL(misc_deregister);
int __init misc_init(void) static int __init misc_init(void)
{ {
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
struct proc_dir_entry *ent; struct proc_dir_entry *ent;
...@@ -320,3 +320,4 @@ int __init misc_init(void) ...@@ -320,3 +320,4 @@ int __init misc_init(void)
} }
return 0; return 0;
} }
module_init(misc_init);
...@@ -1493,16 +1493,16 @@ static void init_std_data(struct entropy_store *r) ...@@ -1493,16 +1493,16 @@ static void init_std_data(struct entropy_store *r)
} }
} }
void __init rand_initialize(void) static int __init rand_initialize(void)
{ {
int i; int i;
if (create_entropy_store(DEFAULT_POOL_SIZE, &random_state)) if (create_entropy_store(DEFAULT_POOL_SIZE, &random_state))
return; /* Error, return */ goto err;
if (batch_entropy_init(BATCH_ENTROPY_SIZE, random_state)) if (batch_entropy_init(BATCH_ENTROPY_SIZE, random_state))
return; /* Error, return */ goto err;
if (create_entropy_store(SECONDARY_POOL_SIZE, &sec_random_state)) if (create_entropy_store(SECONDARY_POOL_SIZE, &sec_random_state))
return; /* Error, return */ goto err;
clear_entropy_store(random_state); clear_entropy_store(random_state);
clear_entropy_store(sec_random_state); clear_entropy_store(sec_random_state);
init_std_data(random_state); init_std_data(random_state);
...@@ -1515,7 +1515,11 @@ void __init rand_initialize(void) ...@@ -1515,7 +1515,11 @@ void __init rand_initialize(void)
memset(&mouse_timer_state, 0, sizeof(struct timer_rand_state)); memset(&mouse_timer_state, 0, sizeof(struct timer_rand_state));
memset(&extract_timer_state, 0, sizeof(struct timer_rand_state)); memset(&extract_timer_state, 0, sizeof(struct timer_rand_state));
extract_timer_state.dont_count_entropy = 1; extract_timer_state.dont_count_entropy = 1;
return 0;
err:
return -1;
} }
module_init(rand_initialize);
void rand_initialize_irq(int irq) void rand_initialize_irq(int irq)
{ {
......
...@@ -2423,7 +2423,7 @@ static struct cdev vc0_cdev; ...@@ -2423,7 +2423,7 @@ static struct cdev vc0_cdev;
* Ok, now we can initialize the rest of the tty devices and can count * Ok, now we can initialize the rest of the tty devices and can count
* on memory allocations, interrupts etc.. * on memory allocations, interrupts etc..
*/ */
void __init tty_init(void) static int __init tty_init(void)
{ {
strcpy(tty_cdev.kobj.name, "dev.tty"); strcpy(tty_cdev.kobj.name, "dev.tty");
cdev_init(&tty_cdev, &tty_fops); cdev_init(&tty_cdev, &tty_fops);
...@@ -2512,4 +2512,6 @@ void __init tty_init(void) ...@@ -2512,4 +2512,6 @@ void __init tty_init(void)
#ifdef CONFIG_A2232 #ifdef CONFIG_A2232
a2232board_init(); a2232board_init();
#endif #endif
return 0;
} }
module_init(tty_init);
...@@ -199,8 +199,6 @@ typedef union { ...@@ -199,8 +199,6 @@ typedef union {
#define ABS(a) ((a) < 0 ? -(a) : (a)) #define ABS(a) ((a) < 0 ? -(a) : (a))
#define NR_ITEMS(x) (int)(sizeof(x)/ sizeof(*x)) #define NR_ITEMS(x) (int)(sizeof(x)/ sizeof(*x))
extern int ftape_init(void);
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif #endif
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
#define TUN_MINOR 200 #define TUN_MINOR 200
extern int misc_init(void);
struct miscdevice struct miscdevice
{ {
int minor; int minor;
......
...@@ -42,7 +42,6 @@ struct rand_pool_info { ...@@ -42,7 +42,6 @@ struct rand_pool_info {
#ifdef __KERNEL__ #ifdef __KERNEL__
extern void rand_initialize(void);
extern void rand_initialize_irq(int irq); extern void rand_initialize_irq(int irq);
extern void batch_entropy_store(u32 a, u32 b, int num); extern void batch_entropy_store(u32 a, u32 b, int num);
......
...@@ -351,7 +351,6 @@ extern void console_init(void); ...@@ -351,7 +351,6 @@ extern void console_init(void);
extern int lp_init(void); extern int lp_init(void);
extern int pty_init(void); extern int pty_init(void);
extern void tty_init(void);
extern int mxser_init(void); extern int mxser_init(void);
extern int moxa_init(void); extern int moxa_init(void);
extern int ip2_init(void); extern int ip2_init(void);
......
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