patch-2.4.0-test12 linux/drivers/char/riscom8.c

Next file: linux/drivers/char/riscom8.h
Previous file: linux/drivers/char/rio/host.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test11/linux/drivers/char/riscom8.c linux/drivers/char/riscom8.c
@@ -77,7 +77,7 @@
 
 #define RS_EVENT_WRITE_WAKEUP	0
 
-DECLARE_TASK_QUEUE(tq_riscom);
+static DECLARE_TASK_QUEUE(tq_riscom);
 
 #define RISCOM_TYPE_NORMAL	1
 #define RISCOM_TYPE_CALLOUT	2
@@ -146,38 +146,38 @@
  */
 
 /* Get board number from pointer */
-extern inline int board_No (struct riscom_board const * bp)
+static inline int board_No (struct riscom_board const * bp)
 {
 	return bp - rc_board;
 }
 
 /* Get port number from pointer */
-extern inline int port_No (struct riscom_port const * port)
+static inline int port_No (struct riscom_port const * port)
 {
 	return RC_PORT(port - rc_port); 
 }
 
 /* Get pointer to board from pointer to port */
-extern inline struct riscom_board * port_Board(struct riscom_port const * port)
+static inline struct riscom_board * port_Board(struct riscom_port const * port)
 {
 	return &rc_board[RC_BOARD(port - rc_port)];
 }
 
 /* Input Byte from CL CD180 register */
-extern inline unsigned char rc_in(struct riscom_board const * bp, unsigned short reg)
+static inline unsigned char rc_in(struct riscom_board const * bp, unsigned short reg)
 {
 	return inb(bp->base + RC_TO_ISA(reg));
 }
 
 /* Output Byte to CL CD180 register */
-extern inline void rc_out(struct riscom_board const * bp, unsigned short reg,
+static inline void rc_out(struct riscom_board const * bp, unsigned short reg,
 			  unsigned char val)
 {
 	outb(val, bp->base + RC_TO_ISA(reg));
 }
 
 /* Wait for Channel Command Register ready */
-extern inline void rc_wait_CCR(struct riscom_board const * bp)
+static inline void rc_wait_CCR(struct riscom_board const * bp)
 {
 	unsigned long delay;
 
@@ -193,7 +193,7 @@
  *  RISCom/8 probe functions.
  */
 
-extern inline int rc_check_io_range(struct riscom_board * const bp)
+static inline int rc_check_io_range(struct riscom_board * const bp)
 {
 	int i;
 	
@@ -206,7 +206,7 @@
 	return 0;
 }
 
-extern inline void rc_request_io_range(struct riscom_board * const bp)
+static inline void rc_request_io_range(struct riscom_board * const bp)
 {
 	int i;
 	
@@ -214,7 +214,7 @@
 		request_region(RC_TO_ISA(rc_ioport[i]) + bp->base, 1, "RISCom/8" );
 }
 
-extern inline void rc_release_io_range(struct riscom_board * const bp)
+static inline void rc_release_io_range(struct riscom_board * const bp)
 {
 	int i;
 	
@@ -224,7 +224,7 @@
 
 	
 /* Must be called with enabled interrupts */
-extern inline void rc_long_delay(unsigned long delay)
+static inline void rc_long_delay(unsigned long delay)
 {
 	unsigned long i;
 	
@@ -326,7 +326,7 @@
  * 
  */
 
-extern inline void rc_mark_event(struct riscom_port * port, int event)
+static inline void rc_mark_event(struct riscom_port * port, int event)
 {
 	/* 
          * I'm not quite happy with current scheme all serial
@@ -341,7 +341,7 @@
 	mark_bh(RISCOM8_BH);
 }
 
-extern inline struct riscom_port * rc_get_port(struct riscom_board const * bp,
+static inline struct riscom_port * rc_get_port(struct riscom_board const * bp,
 					       unsigned char const * what)
 {
 	unsigned char channel;
@@ -359,7 +359,7 @@
 	return NULL;
 }
 
-extern inline void rc_receive_exc(struct riscom_board const * bp)
+static inline void rc_receive_exc(struct riscom_board const * bp)
 {
 	struct riscom_port *port;
 	struct tty_struct *tty;
@@ -422,7 +422,7 @@
 	queue_task(&tty->flip.tqueue, &tq_timer);
 }
 
-extern inline void rc_receive(struct riscom_board const * bp)
+static inline void rc_receive(struct riscom_board const * bp)
 {
 	struct riscom_port *port;
 	struct tty_struct *tty;
@@ -452,7 +452,7 @@
 	queue_task(&tty->flip.tqueue, &tq_timer);
 }
 
-extern inline void rc_transmit(struct riscom_board const * bp)
+static inline void rc_transmit(struct riscom_board const * bp)
 {
 	struct riscom_port *port;
 	struct tty_struct *tty;
@@ -521,7 +521,7 @@
 		rc_mark_event(port, RS_EVENT_WRITE_WAKEUP);
 }
 
-extern inline void rc_check_modem(struct riscom_board const * bp)
+static inline void rc_check_modem(struct riscom_board const * bp)
 {
 	struct riscom_port *port;
 	struct tty_struct *tty;
@@ -537,8 +537,11 @@
 		if (rc_in(bp, CD180_MSVR) & MSVR_CD) 
 			wake_up_interruptible(&port->open_wait);
 		else if (!((port->flags & ASYNC_CALLOUT_ACTIVE) &&
-			   (port->flags & ASYNC_CALLOUT_NOHUP)))
-			queue_task(&port->tqueue_hangup,  &tq_scheduler);      
+			   (port->flags & ASYNC_CALLOUT_NOHUP))) {
+			MOD_INC_USE_COUNT;
+			if (schedule_task(&port->tqueue_hangup) == 0)
+				MOD_DEC_USE_COUNT;
+		}
 	}
 	
 #ifdef RISCOM_BRAIN_DAMAGED_CTS
@@ -634,7 +637,7 @@
  */
 
 /* Called with disabled interrupts */
-extern inline int rc_setup_board(struct riscom_board * bp)
+static inline int rc_setup_board(struct riscom_board * bp)
 {
 	int error;
 
@@ -657,7 +660,7 @@
 }
 
 /* Called with disabled interrupts */
-extern inline void rc_shutdown_board(struct riscom_board *bp)
+static inline void rc_shutdown_board(struct riscom_board *bp)
 {
 	if (!(bp->flags & RC_BOARD_ACTIVE))
 		return;
@@ -1399,7 +1402,7 @@
 	return 0;
 }
 
-extern inline void rc_send_break(struct riscom_port * port, unsigned long length)
+static inline void rc_send_break(struct riscom_port * port, unsigned long length)
 {
 	struct riscom_board *bp = port_Board(port);
 	unsigned long flags;
@@ -1417,7 +1420,7 @@
 	restore_flags(flags);
 }
 
-extern inline int rc_set_serial_info(struct riscom_port * port,
+static inline int rc_set_serial_info(struct riscom_port * port,
 				     struct serial_struct * newinfo)
 {
 	struct serial_struct tmp;
@@ -1467,7 +1470,7 @@
 	return 0;
 }
 
-extern inline int rc_get_serial_info(struct riscom_port * port,
+static inline int rc_get_serial_info(struct riscom_port * port,
 				     struct serial_struct * retinfo)
 {
 	struct serial_struct tmp;
@@ -1648,10 +1651,9 @@
 	struct tty_struct	*tty;
 	
 	tty = port->tty;
-	if (!tty)
-		return;
-
-	tty_hangup(tty);
+	if (tty)
+		tty_hangup(tty);	/* FIXME: module removal race still here */
+	MOD_DEC_USE_COUNT;
 }
 
 static void rc_hangup(struct tty_struct * tty)
@@ -1820,7 +1822,7 @@
  * addresses in this case.
  *
  */ 
-void __init riscom8_setup(char *str, int * ints)
+static void __init riscom8_setup(char *str, int * ints)
 {
 	int i;
 
@@ -1831,12 +1833,14 @@
 			rc_board[i].base = 0;
 	}
 }
+
+__setup("riscom8=", riscom8_setup);
 #endif
 
 /* 
  * This routine must be called by kernel at boot time 
  */
-int __init  riscom8_init(void)
+static int __init riscom8_init(void)
 {
 	int i;
 	int found = 0;
@@ -1859,22 +1863,24 @@
 }
 
 #ifdef MODULE
-int iobase  = 0;
-int iobase1 = 0;
-int iobase2 = 0;
-int iobase3 = 0;
+static int iobase;
+static int iobase1;
+static int iobase2;
+static int iobase3;
 MODULE_PARM(iobase, "i");
 MODULE_PARM(iobase1, "i");
 MODULE_PARM(iobase2, "i");
 MODULE_PARM(iobase3, "i");
+#endif /* MODULE */
 
 /*
  * You can setup up to 4 boards (current value of RC_NBOARD)
  * by specifying "iobase=0xXXX iobase1=0xXXX ..." as insmod parameter.
  *
  */
-int init_module(void) 
+static int __init riscom8_init_module (void)
 {
+#ifdef MODULE
 	int i;
 
 	if (iobase || iobase1 || iobase2 || iobase3) {
@@ -1890,11 +1896,12 @@
 		rc_board[2].base = iobase2;
 	if (iobase3)
 		rc_board[3].base = iobase3;
-	
+#endif /* MODULE */
+
 	return riscom8_init();
 }
 	
-void cleanup_module(void)
+static void __exit riscom8_exit_module (void)
 {
 	int i;
 	
@@ -1904,4 +1911,7 @@
 			rc_release_io_range(&rc_board[i]);
 	
 }
-#endif /* MODULE */
+
+module_init(riscom8_init_module);
+module_exit(riscom8_exit_module);
+

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)