Skip to contentSkip to conversation

switch remaining serial drivers to initcalls

PATCH New Christoph Hellwig 1 participant 1 message Sep 22, 2003

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 switch remaining serial drivers to initcalls

All drivers that compile on ppc with CONFIG_ISA set (= all but some m68-only drivers), I looked at the compile warnings very closely and there are no new warnings or even errors this time :)

drivers/char/Makefile needed to be reordered big time to keep the intialization order the same.

arch/ppc/8260_io/uart.c +2 -5
@@ -18,10 +18,6 @@
  * It still needs lots of work........When it was easy, I included code
  * to support the SCCs.
  * Only the SCCs support modem control, so that is not complete either.
- *
- * This module exports the following rs232 io functions:
- *
- *	int rs_8xx_init(void);
  */
 
 #include <linux/config.h>
@@ -2507,7 +2503,7 @@
 /*
  * The serial driver boot-time initialization code!
  */
-int __init rs_8xx_init(void)
+static int __init rs_8xx_init(void)
 {
 	struct serial_state * state;
 	ser_info_t	*info;
@@ -2867,6 +2863,7 @@
 	}
 	return 0;
 }
+module_init(rs_8xx_init);
 
 /* This must always be called before the rs_8xx_init() function, otherwise
  * it blows away the port control information.
arch/ppc/8xx_io/uart.c +2 -5
@@ -12,10 +12,6 @@
  * It still needs lots of work........When it was easy, I included code
  * to support the SCCs, but this has never been tested, nor is it complete.
  * Only the SCCs support modem control, so that is not complete either.
- *
- * This module exports the following rs232 io functions:
- *
- *	int rs_8xx_init(void);
  */
 
 #include <linux/config.h>
@@ -2499,7 +2495,7 @@
 /*
  * The serial driver boot-time initialization code!
  */
-int __init rs_8xx_init(void)
+static int __init rs_8xx_init(void)
 {
 	struct serial_state * state;
 	ser_info_t	*info;
@@ -2846,6 +2842,7 @@
 
 	return 0;
 }
+module_init(rs_8xx_init);
 
 /* This must always be called before the rs_8xx_init() function, otherwise
  * it blows away the port control information.
drivers/char/Makefile +32 -31

70 lines not on this page · raw message

drivers/char/cyclades.c +4 -8
@@ -5433,7 +5433,7 @@
     .read_proc = cyclades_get_proc_info,
 };
 
-int __init
+static int __init
 cy_init(void)
 {
   struct cyclades_port  *info;
@@ -5660,13 +5660,10 @@
     
 } /* cy_init */
 
-#ifdef MODULE
-void
+static void __exit
 cy_cleanup_module(void)
 {
-    int i;
-    int e1, e2;
-    unsigned long flags;
+    int i, e1;
 
 #ifndef CONFIG_CYZ_INTR
     if (cyz_timeron){
@@ -5702,11 +5699,10 @@
     }
 } /* cy_cleanup_module */
 
-/* Module entry-points */
 module_init(cy_init);
 module_exit(cy_cleanup_module);
 
-#else /* MODULE */
+#ifndef MODULE
 /* called by linux/init/main.c to parse command line options */
 void
 cy_setup(char *str, int *ints)
drivers/char/ip2.c +4 -44

75 lines not on this page · raw message

drivers/char/moxa.c +26 -42

104 lines not on this page · raw message

drivers/char/pcxx.c +5 -9
@@ -200,13 +200,7 @@
 	}
 }
 
-/*****************************************************************************/
-
-#ifdef MODULE
-
-/*****************************************************************************/
-
-static void pcxe_cleanup()
+static void __exit pcxe_cleanup(void)
 {
 
 	unsigned long	flags;
@@ -232,7 +226,6 @@
  */
 module_init(pcxe_init);
 module_cleanup(pcxe_cleanup);
-#endif
 
 static inline struct channel *chan(register struct tty_struct *tty)
 {
@@ -1018,6 +1011,9 @@
 }
 #endif
 
+module_init(pcxe_init)
+module_exit(pcxe_exit)
+
 static struct tty_operations pcxe_ops = {
 	.open = pcxe_open,
 	.close = pcxe_close,
@@ -1040,7 +1036,7 @@
  * function to initialize the driver with the given parameters, which are either
  * the default values from this file or the parameters given at boot.
  */
-int __init pcxe_init(void)
+static int __init pcxe_init(void)
 {
 	ulong memory_seg=0, memory_size=0;
 	int lowwater, enabled_cards=0, i, crd, shrinkmem=0, topwin = 0xff00L, botwin=0x100L;
drivers/char/pty.c +2 -1
@@ -313,7 +313,7 @@
 	.set_termios = pty_set_termios,
 };
 
-int __init pty_init(void)
+static int __init pty_init(void)
 {
 	/* Traditional BSD devices */
 
@@ -414,3 +414,4 @@
 #endif
 	return 0;
 }
+module_init(pty_init);
drivers/char/ser_a2232.c +5 -12
@@ -122,8 +122,6 @@
 /* Initialize and register TTY drivers. */
 /* returns 0 IFF successful */
 static int a2232_init_drivers(void); 
-/* Initialize all A2232 boards; main entry point. */
-int a2232board_init(void);
 
 /* BEGIN GENERIC_SERIAL PROTOTYPES */
 static void a2232_disable_tx_interrupts(void *ptr);
@@ -720,7 +718,7 @@
 	return 0;
 }
 
-int a2232board_init(void)
+static int __init a2232board_init(void)
 {
 	struct zorro_dev *z;
 
@@ -813,13 +811,7 @@
 	return 0;
 }
 
-#ifdef MODULE
-int init_module(void)
-{
-	return a2232board_init();
-}
-
-void cleanup_module(void)
+static void __exit a2232board_exit(void)
 {
 	int i;
 
@@ -831,8 +823,9 @@
 	put_tty_driver(a2232_driver);
 	free_irq(IRQ_AMIGA_VERTB, a2232_driver_ID);
 }
-#endif
-/***************************** End of Functions *********************/
+
+module_init(a2232board_init);
+module_exit(a2232board_exit);
 
 MODULE_AUTHOR("Enver Haase");
 MODULE_DESCRIPTION("Amiga A2232 multi-serial board driver");

===== drivers/char/serial167.c 1.29 vs edited =====

drivers/char/serial167.c +3 -5
@@ -23,10 +23,6 @@
  *
  * This version does not support shared irq's.
  *
- * This module exports the following rs232 io functions:
- *   int cy_init(void);
- *   int  cy_open(struct tty_struct *tty, struct file *filp);
- *
  * $Log: cyclades.c,v $
  * Revision 1.36.1.4  1995/03/29  06:14:14  bentson
  * disambiguate between Cyclom-16Y and Cyclom-32Ye;
@@ -2321,7 +2317,7 @@
     If there are more cards with more ports than have been statically
     allocated above, a warning is printed and the extra ports are ignored.
  */
-int
+static int __init
 serial167_init(void)
 {
   struct cyclades_port *info;
@@ -2496,6 +2492,8 @@
     put_tty_driver(cy_serial_driver);
     return ret;
 } /* serial167_init */
+
+module_init(serial167_init);
 
 
 #ifdef CYCLOM_SHOW_STATUS

===== drivers/char/serial_tx3912.c 1.18 vs edited =====

drivers/char/serial_tx3912.c +2 -1
@@ -812,7 +812,7 @@
 }
 
 
-void __init tx3912_rs_init(void)
+static void __init tx3912_rs_init(void)
 {
 	int rc;
 
@@ -877,6 +877,7 @@
 
 	func_exit();
 }
+module_init(tx3912_rs_init);
 
 /*
  * Begin serial console routines

===== drivers/char/specialix.c 1.25 vs edited =====

drivers/char/specialix.c +6 -7
@@ -1362,7 +1362,6 @@
 	int error;
 	struct specialix_port * port;
 	struct specialix_board * bp;
-	unsigned long flags;
 	
 	board = SX_BOARD(tty->index);
 
@@ -2205,7 +2204,7 @@
 /* 
  * This routine must be called by kernel at boot time 
  */
-int specialix_init(void) 
+static int __init specialix_init(void) 
 {
 	int i;
 	int found = 0;
@@ -2263,7 +2262,6 @@
 	return 0;
 }
 
-#ifdef MODULE
 int iobase[SX_NBOARD]  = {0,};
 
 int irq [SX_NBOARD] = {0,};
@@ -2280,7 +2278,7 @@
  * only use 4 different interrupts. 
  *
  */
-int init_module(void) 
+static int __init specialix_init_module(void) 
 {
 	int i;
 
@@ -2294,8 +2292,7 @@
 	return specialix_init();
 }
 	
-
-void cleanup_module(void)
+static void __exit specialix_exit_module(void)
 {
 	int i;
 	
@@ -2308,6 +2305,8 @@
 #endif
 	
 }
-#endif /* MODULE */
+
+module_init(specialix_init_module);
+module_exit(specialix_exit_module);
 
 MODULE_LICENSE("GPL");
drivers/char/tty_io.c +0 -52

65 lines not on this page · raw message

drivers/char/vme_scc.c +3 -5
@@ -396,14 +396,10 @@
 #endif
 
 
-int vme_scc_init(void)
+static int vme_scc_init(void)
 {
 	int res = -ENODEV;
-	static int called = 0;
 
-	if (called)
-		return res;
-	called = 1;
 #ifdef CONFIG_MVME147_SCC
 	if (MACH_IS_MVME147)
 		res = mvme147_scc_init();
@@ -418,6 +414,8 @@
 #endif
 	return res;
 }
+
+module_init(vme_scc_init);
 
 
 /*---------------------------------------------------------------------------
drivers/macintosh/macserial.c +1 -2
@@ -2490,8 +2490,7 @@
 	.read_proc = macserial_read_proc,
 };
 
-/* rs_init inits the driver */
-int macserial_init(void)
+static int macserial_init(void)
 {
 	int channel, i;
 	struct mac_serial *info;
drivers/s390/char/tuball.c +14 -19
@@ -74,8 +74,6 @@
 	  0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
 	  0xf8, 0xf9, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f };
 
-int tub3270_init(void);
-
 #ifndef MODULE
 
 /*
@@ -193,31 +191,18 @@
 	return rc;
 }
 #endif /* CONFIG_TN3270_CONSOLE */
-#else /* If generated as a MODULE */
-/*
- * module init:  find tubes; get a major nbr
- */
-int
-init_module(void)
-{
-	if (tubnummins != 0) {
-		printk(KERN_ERR "EEEK!!  Tube driver cobbigling!!\n");
-		return -1;
-	}
-	return tub3270_init();
-}
+#endif
 
 /*
  * remove driver:  unregister the major number
  */
-void
-cleanup_module(void)
+static void __exit
+tub3270_exit(void)
 {
 	fs3270_fini();
 	tty3270_fini();
 	tubfiniminors();
 }
-#endif /* Not a MODULE or a MODULE */
 
 static int
 tub3270_is_ours(s390_dev_info_t *dp)
@@ -232,12 +217,19 @@
 /*
  * tub3270_init() called by kernel or module initialization
  */
-int
+static int __init
 tub3270_init(void)
 {
 	s390_dev_info_t d;
 	int i, rc;
 
+#ifdef MODULE
+	if (tubnummins != 0) {
+		printk(KERN_ERR "EEEK!!  Tube driver cobbigling!!\n");
+		return -1;
+	}
+#endif
+
 	/*
 	 * Copy and correct ebcdic - ascii translate tables
 	 */
@@ -624,3 +616,6 @@
 		tubirqs = NULL;
 	}
 }
+
+module_init(tub3270_init);
+module_exit(tub3270_exit);
include/linux/tty.h +0 -16
@@ -348,23 +348,7 @@
 extern int kmsg_redirect;
 
 extern void console_init(void);
-
-extern int lp_init(void);
-extern int pty_init(void);
-extern int mxser_init(void);
-extern int moxa_init(void);
-extern int ip2_init(void);
-extern int pcxe_init(void);
-extern int pc_init(void);
 extern int vcs_init(void);
-extern int rp_init(void);
-extern int cy_init(void);
-extern int stl_init(void);
-extern int stli_init(void);
-extern int specialix_init(void);
-extern int espserial_init(void);
-extern int macserial_init(void);
-extern int a2232board_init(void);
 
 extern int tty_paranoia_check(struct tty_struct *tty, struct inode *inode,
 			      const char *routine);