patch-2.4.0-test3 linux/drivers/char/serial.c
Next file: linux/drivers/char/specialix.c
Previous file: linux/drivers/char/rocket.c
Back to the patch index
Back to the overall index
- Lines: 166
- Date:
Sun Jul 9 22:21:41 2000
- Orig file:
v2.4.0-test2/linux/drivers/char/serial.c
- Orig date:
Fri Jun 23 21:55:08 2000
diff -u --recursive --new-file v2.4.0-test2/linux/drivers/char/serial.c linux/drivers/char/serial.c
@@ -46,6 +46,9 @@
* 5/00: Support for the RSA-DV II/S card added.
* Kiyokazu SUTO <suto@ks-and-ks.ne.jp>
*
+ * 6/00: Remove old-style timer, use timer_list
+ * Andrew Morton <andrewm@uow.edu.au>
+ *
* This module exports the following rs232 io functions:
*
* int rs_init(void);
@@ -232,6 +235,8 @@
static struct tty_driver serial_driver, callout_driver;
static int serial_refcount;
+static struct timer_list serial_timer;
+
/* serial subtype definitions */
#ifndef SERIAL_TYPE_NORMAL
#define SERIAL_TYPE_NORMAL 1
@@ -253,6 +258,8 @@
static int IRQ_timeout[NR_IRQS];
#ifdef CONFIG_SERIAL_CONSOLE
static struct console sercons;
+#endif
+#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) && !defined(MODULE)
static unsigned long break_pressed; /* break, really ... */
#endif
@@ -304,11 +311,10 @@
#if (defined(ENABLE_SERIAL_PCI) || defined(ENABLE_SERIAL_PNP))
#define NR_PCI_BOARDS 8
-#ifdef MODULE
/* We don't unregister PCI boards right now */
static struct pci_board_inst serial_pci_board[NR_PCI_BOARDS];
static int serial_pci_board_idx = 0;
-#endif
+
#ifndef IS_PCI_REGION_IOPORT
#define IS_PCI_REGION_IOPORT(dev, r) (pci_resource_flags((dev), (r)) & \
IORESOURCE_IO)
@@ -1023,7 +1029,7 @@
* passable results for a 16550A. (Although at the expense of much
* CPU overhead).
*/
-static void rs_timer(void)
+static void rs_timer(unsigned long dummy)
{
static unsigned long last_strobe = 0;
struct async_struct *info;
@@ -1057,8 +1063,7 @@
}
}
last_strobe = jiffies;
- timer_table[RS_TIMER].expires = jiffies + RS_STROBE_TIME;
- timer_active |= 1 << RS_TIMER;
+ mod_timer(&serial_timer, jiffies + RS_STROBE_TIME);
if (IRQ_ports[0]) {
save_flags(flags); cli();
@@ -1069,7 +1074,7 @@
#endif
restore_flags(flags);
- timer_table[RS_TIMER].expires = jiffies + IRQ_timeout[0] - 2;
+ mod_timer(&serial_timer, jiffies + IRQ_timeout[0] - 2);
}
}
@@ -1380,8 +1385,7 @@
/*
* Set up serial timers...
*/
- timer_table[RS_TIMER].expires = jiffies + 2*HZ/100;
- timer_active |= 1 << RS_TIMER;
+ mod_timer(&serial_timer, jiffies + 2*HZ/100);
/*
* Set up the tty->alt_speed kludge
@@ -2046,7 +2050,7 @@
new_port = new_serial.port;
if (HIGH_BITS_OFFSET)
- new_port += new_serial.port_high << HIGH_BITS_OFFSET;
+ new_port += (unsigned long) new_serial.port_high << HIGH_BITS_OFFSET;
change_irq = new_serial.irq != state->irq;
change_port = (new_port != ((int) state->port)) ||
@@ -4448,9 +4452,10 @@
{ PCI_VENDOR_ID_ROCKWELL, 0x1004,
0x1048, 0x1500,
SPCI_FL_BASE1, 1, 115200 },
-#if 0 /* No definition for PCI_DEVICE_ID_NEC_NILE4 */
+#ifdef CONFIG_DDB5074
/*
* NEC Vrc-5074 (Nile 4) builtin UART.
+ * Conditionally compiled in since this is a motherboard device.
*/
{ PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_NILE4,
PCI_ANY_ID, PCI_ANY_ID,
@@ -4979,12 +4984,12 @@
/*
* The serial driver boot-time initialization code!
*/
-int __init rs_init(void)
+static int __init rs_init(void)
{
int i;
struct serial_state * state;
- if (timer_table[RS_TIMER].fn) {
+ if (serial_timer.function) {
printk("RS_TIMER already set, another serial driver "
"already loaded?\n");
#ifdef MODULE
@@ -4995,8 +5000,9 @@
}
init_bh(SERIAL_BH, do_serial_bh);
- timer_table[RS_TIMER].fn = rs_timer;
- timer_table[RS_TIMER].expires = 0;
+ init_timer(&serial_timer);
+ serial_timer.function = rs_timer;
+ mod_timer(&serial_timer, jiffies + RS_STROBE_TIME);
for (i = 0; i < NR_IRQS; i++) {
IRQ_ports[i] = 0;
@@ -5169,7 +5175,7 @@
port = req->port;
if (HIGH_BITS_OFFSET)
- port += req->port_high << HIGH_BITS_OFFSET;
+ port += (unsigned long) req->port_high << HIGH_BITS_OFFSET;
save_flags(flags); cli();
for (i = 0; i < NR_PORTS; i++) {
@@ -5267,8 +5273,7 @@
restore_flags(flags);
}
-#ifdef MODULE
-void rs_fini(void)
+static void __exit rs_fini(void)
{
unsigned long flags;
int e1, e2;
@@ -5276,10 +5281,8 @@
struct async_struct *info;
/* printk("Unloading %s: version %s\n", serial_name, serial_version); */
+ del_timer_sync(&serial_timer);
save_flags(flags); cli();
- timer_active &= ~(1 << RS_TIMER);
- timer_table[RS_TIMER].fn = NULL;
- timer_table[RS_TIMER].expires = 0;
remove_bh(SERIAL_BH);
if ((e1 = tty_unregister_driver(&serial_driver)))
printk("serial: failed to unregister serial driver (%d)\n",
@@ -5325,7 +5328,6 @@
free_page(pg);
}
}
-#endif /* MODULE */
module_init(rs_init);
module_exit(rs_fini);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)