diff -uNr serial-5.05/serial.c serial-5.05-fix2.2.18/serial.c --- serial-5.05/serial.c Thu Sep 14 17:40:26 2000 +++ serial-5.05-fix2.2.18/serial.c Mon Feb 19 18:05:39 2001 @@ -54,6 +54,12 @@ * 7/00: fix some returns on failure not using MOD_DEC_USE_COUNT. * Arnaldo Carvalho de Melo * + * 2/01: Fixes for kernel 2.2.18: + * Isolated compatibility #define for PCI_DEVICE_ID_OXSEMI_PCI954. + * Ignore extra calls to rs_init from tty_io.c or wherever during + * initialization. Ian Abbott (N.B. others found + * the bugs - I just localized the patches to the serial driver.) + * * This module exports the following rs232 io functions: * * int rs_init(void); @@ -5116,6 +5122,10 @@ #endif /* ENABLE_SERIAL_PNP */ +#ifdef SERIAL_FIX_MULTIPLE_INIT +static int serial_initialized __initdata = 0; +#endif + /* * The serial driver boot-time initialization code! */ @@ -5124,6 +5134,11 @@ int i; struct serial_state * state; +#ifdef SERIAL_FIX_MULTIPLE_INIT + if (serial_initialized) + return 0; + serial_initialized = 1; +#endif init_bh(SERIAL_BH, do_serial_bh); init_timer(&serial_timer); serial_timer.function = rs_timer; diff -uNr serial-5.05/serial_compat.h serial-5.05-fix2.2.18/serial_compat.h --- serial-5.05/serial_compat.h Thu Sep 14 16:16:06 2000 +++ serial-5.05-fix2.2.18/serial_compat.h Mon Feb 19 17:53:17 2001 @@ -201,6 +201,14 @@ #define module_init(x) /* nothing */ #define module_exit(x) /* nothing */ #endif +#else +#ifndef MODULE +/* Deal with crash caused by multiple calls of rs_init in kernel 2.2.x>=18 */ +#if (LINUX_VERSION_CODE >= 0x020212) && (LINUX_VERSION_CODE < 0x020300) +#define SERIAL_FIX_MULTIPLE_INIT +#endif +/* XXX May need to check 2.3.x series kernels for the same problem. */ +#endif #endif /* module_init */ @@ -387,6 +395,9 @@ #ifndef PCI_VENDOR_ID_OXSEMI #define PCI_VENDOR_ID_OXSEMI 0x1415 +#endif + +#ifndef PCI_DEVICE_ID_OXSEMI_16PCI954 #define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 #endif