## Automatically generated incremental diff
## From:   linux-2.2.20-pre5
## To:     linux-2.2.20-pre6
## Robot:  $Id: make-incremental-diff,v 1.8 2001/12/04 06:05:04 hpa Exp $

diff -urN linux-2.2.20-pre5/CREDITS linux/CREDITS
--- linux-2.2.20-pre5/CREDITS	Mon Dec  3 22:19:34 2001
+++ linux/CREDITS	Mon Dec  3 22:19:41 2001
@@ -1833,14 +1833,15 @@
 S: France
 
 N: Rik van Riel
-E: riel@nl.linux.org
-W: http://www.nl.linux.org/~riel/
+E: riel@conectiva.com.br
+W: http://www.surriel.com/
 D: Linux-MM site, Documentation/sysctl/*, swap/mm readaround
 D: clustering contributor, kswapd fixes, random kernel hacker,
-D: nl.linux.org maintainer, minor scheduler additions
-S: IJsselstraat 23a
-S: 9725 GA  Groningen
-S: The Netherlands
+D: nl.linux.org administrator, minor scheduler additions
+S: Conectiva S.A.
+S: R. Tocantins, 89 - Cristo Rei
+S: 80050-430 - Curitiba - Paraná
+S: Brazil
 
 N: William E. Roadcap
 E: roadcapw@cfw.com
diff -urN linux-2.2.20-pre5/Documentation/Configure.help linux/Documentation/Configure.help
--- linux-2.2.20-pre5/Documentation/Configure.help	Mon Dec  3 22:19:34 2001
+++ linux/Documentation/Configure.help	Mon Dec  3 22:19:41 2001
@@ -758,6 +758,39 @@
   say M here and read Documentation/modules.txt.  The module will be
   called DAC960.o. 
 
+3ware Hardware ATA-RAID support
+CONFIG_BLK_DEV_3W_XXXX_RAID
+  3ware is the only hardware ATA-Raid product in Linux to date.
+  This card is 2,4, or 8 channel master mode support only.
+  SCSI support required!!!
+
+  <http://www.3ware.com/>
+
+  Please read the comments at the top of drivers/scsi/3w-xxxx.c
+
+RapIDE interface support
+CONFIG_BLK_DEV_IDE_RAPIDE
+  Say Y here if you want to support the Yellowstone RapIDE controller
+  manufactured for use with Acorn computers.
+
+WarpEngine SCSI support
+CONFIG_WARPENGINE_SCSI
+  Support for MacroSystem Development's WarpEngine Amiga SCSI-2 controller.
+  Info at <http://www.lysator.liu.se/amiga/ar/guide/ar310.guide?FEATURE5>.
+
+PowerMac IDE DMA support
+CONFIG_BLK_DEV_IDEDMA_PMAC
+  This option allows the driver for the built-in IDE controller on
+  Power Macintoshes and PowerBooks to use DMA (direct memory access)
+  to transfer data to and from memory.  Saying Y is safe and improves
+  performance.
+
+ICS IDE interface support
+CONFIG_BLK_DEV_IDE_ICSIDE
+  On Acorn systems, say Y here if you wish to use the ICS IDE
+  interface card.  This is not required for ICS partition support.
+  If you are unsure, say N to this.
+
 Parallel port IDE device support
 CONFIG_PARIDE
   There are many external CD-ROM and disk devices that connect through
@@ -1123,6 +1156,34 @@
   board uses the R4300 and a R5230 CPUs. For more information about
   this board see http://www.algor.co.uk.
 
+Support for BAGET MIPS series
+CONFIG_BAGET_MIPS
+  This enables support for the Baget, a Russian embedded system.  For
+  more details about the Baget see the Linux/MIPS FAQ on
+  <http://oss.sgi.com/mips>.
+
+Baget AMD LANCE support
+CONFIG_BAGETLANCE
+  Say Y to enable kernel support for AMD Lance Ethernet cards on the
+  MIPS-32-based Baget embedded system.  This chipset is better known
+  via the NE2100 cards.
+
+Support for DECstations
+CONFIG_DECSTATION
+  This enables support for DEC's MIPS based workstations.  For details
+  see the Linux/MIPS FAQ on <http://oss.sgi.com/mips> and the
+  DECstation porting pages on <http://decstation.unix-ag.org>.
+
+  If you have one of the following DECstation Models you definitely
+  want to choose R4xx0 for the CPU Type:
+
+	DECstation 5000/50
+	DECstation 5000/150
+	DECstation 5000/260
+	DECsystem 5900/260
+
+  otherwise choose R3000.
+
 IDE card support
 CONFIG_BLK_DEV_IDE_CARDS
   On Acorn systems, enable this if you wish to use an IDE interface
@@ -1157,6 +1218,44 @@
   http://lena.fnet.fr/ (To browse the WWW, you need to have access to
   a machine on the Internet that has a program like lynx or netscape).
 
+Support for SNI RM200 PCI
+CONFIG_SNI_RM200_PCI
+  The SNI RM200 PCI was a MIPS-based platform manufactured by Siemens
+  Nixdorf Informationssysteme (SNI), parent company of Pyramid Technology
+  and now in turn merged with Fujitsu.  Say Y here to support this machine
+  type.
+
+MIPS JAZZ onboard SONIC Ethernet support
+CONFIG_MIPS_JAZZ_SONIC
+  This is the driver for the onboard card of MIPS Magnum 4000,
+  Acer PICA, Olivetti M700-10 and a few other identical OEM systems.
+
+MIPS JAZZ FAS216 SCSI support
+CONFIG_JAZZ_ESP
+  This is the driver for the onboard SCSI host adapter of MIPS Magnum
+  4000, Acer PICA, Olivetti M700-10 and a few other identical OEM
+  systems.
+
+SGI PROM Console Support
+CONFIG_SGI_PROM_CONSOLE
+  Say Y here to set up the boot console on serial port 0.
+
+DZ11 Serial Support
+CONFIG_DZ
+  DZ11-family serial controllers for VAXstations, including the DC7085,
+  M7814, and M7819.
+
+TURBOchannel support
+CONFIG_TC
+  TurboChannel is a DEC (now Compaq) bus for Alpha and MIPS processors.
+  Documentation on writing device drivers for TurboChannel is available at:
+  <http://www.cs.arizona.edu/computer.help/policy/DIGITAL_unix/AA-PS3HD-TET1_html/TITLE.html>.
+
+Z85C30 Serial Support
+CONFIG_ZS
+  Documentation on the Zilog 85C350 serial communications controller is
+  downloadable at <http://www.zilog.com/pdfs/serial/z85c30.pdf>.
+
 CPU type
 CONFIG_CPU_R3000
   Give the type of your machine's MIPS CPU. For this question, it
@@ -1164,6 +1263,55 @@
   In case of doubt select the R3000 CPU. The kernel will then run on
   other MIPS machines but with slightly reduced performance.
 
+  R3000    MIPS Technologies R3000-series processors,
+           including the 3041, 3051, and 3081.
+
+  R6000    MIPS Technologies R6000-series processors,
+           including the 64474, 64475, 64574 and 64575.
+
+  R4300    MIPS Technologies R4300-series processors.
+
+  R4x00    MIPS Technologies R4000-series processors other than 4300,
+           including the 4640, 4650, and 4700.
+
+  R5000    MIPS Technologies R5000-series processors other than the Nevada.
+
+  R52xx    MIPS Technologies R52x0-series ("Nevada") processors.
+
+  R8000    MIPS Technologies R8000-series processors.
+
+  R10000   MIPS Technologies R10000-series processors.
+
+R6000
+CONFIG_CPU_R6000
+  MIPS Technologies R6000-series processors, including the 64474,
+  64475, 64574 and 64575.
+
+R4300
+CONFIG_CPU_R4300
+  MIPS Technologies R4300-series processors.
+
+R4x00
+CONFIG_CPU_R4X00
+  MIPS Technologies R4000-series processors other than 4300, including
+  the 4640, 4650, and 4700.
+
+R5000
+CONFIG_CPU_R5000
+  MIPS Technologies R5000-series processors other than the Nevada.
+
+R52xx
+CONFIG_CPU_NEVADA
+  MIPS Technologies R52x0-series ("Nevada") processors.
+
+R8000
+CONFIG_CPU_R8000
+  MIPS Technologies R8000-series processors.
+
+R10000
+CONFIG_CPU_R10000
+  MIPS Technologies R10000-series processors.
+
 Compile the kernel into the ECOFF object format
 CONFIG_ECOFF_KERNEL
   Some machines require a kernel in the ECOFF format. You will have to
@@ -1176,6 +1324,12 @@
   byte order. These modes require different kernels. Say Y if your
   machine is little endian, N if it's a big endian machine.
 
+Use power LED as a heartbeat
+CONFIG_HEARTBEAT
+  Use the power-on LED on your machine as a load meter. The exact
+  behavior is platform-dependent, but normally the flash frequency is a
+  hyperbolic function of the 5-minute load average.
+
 Kernel support for IRIX binaries
 CONFIG_BINFMT_IRIX
   If you say Y here, the kernel will support running of IRIX binaries.
@@ -1322,6 +1476,136 @@
   Takara              Takara
 
   If you don't know what to do, choose "generic".
+
+# Most of the information on these variants is from
+# http://www.alphalinux.org/docs/alpha-howto.html
+Alcor/Alpha-XLT
+CONFIG_ALPHA_ALCOR
+  For systems using the Digital ALCOR chipset: 5 chips (4, 64-bit data slices
+  (Data Switch, DSW) - 208-pin PQFP and 1 control (Control, I/O Address, CIA)
+  - a 383 pin plastic PGA). It provides a DRAM controller (256-bit memory
+  bus) and a PCI interface. It also does all the work required to support an
+  external Bcache and to maintain memory coherence when a PCI device DMAs
+  into (or out of) memory.
+
+Alpha-XL
+CONFIG_ALPHA_XL
+  XL-233 and XL-266-based Alpha systems.
+
+AlphaBook1
+CONFIG_ALPHA_BOOK1
+  Dec AlphaBook1/Burns Alpha-based laptops.
+
+Avanti
+CONFIG_ALPHA_AVANTI
+  Avanti AS 200, AS 205, AS 250, AS 255, AS 300, and AS 400-based Alphas.
+  Info at <http://www.unix-ag.org/Linux-Alpha/Architectures/Avanti.html>.
+
+Cabriolet
+CONFIG_ALPHA_CABRIOLET
+  Cabriolet AlphaPC64, AlphaPCI64 systems.  Derived from EB64+ but now
+  baby-AT with Flash boot ROM, no on-board SCSI or Ethernet. 3 ISA slots,
+  4 PCI slots (one pair are on a shared slot), uses plug-in Bcache SIMMs.
+  Requires power supply with 3.3V output.
+
+DP264
+CONFIG_ALPHA_DP264
+  Hard Data HD-DP264-based Alpha systems.  There is a Hard Data website at
+  <http://www.harddata.com/alpha/>.
+
+EB164
+CONFIG_ALPHA_EB164
+  EB164 21164 evaluation board from DEC.  Uses 21164 and ALCOR. Has ISA and
+  PCI expansion (3 ISA slots, 2 64-bit PCI slots (one is shared with an ISA
+  slot) and 2 32-bit PCI slots. Uses plus-in Bcache SIMMs. I/O sub-system
+  provides SuperI/O (2S, 1P, FD), KBD, MOUSE (PS2 style), RTC/NVRAM. Boot
+  ROM is Flash. PC-AT-sized motherboard. Requires power supply with 3.3V
+  output.
+
+EB64+
+CONFIG_ALPHA_EB64P
+  Uses 21064 or 21064A and APECs. Has ISA and PCI expansion (3 ISA, 2 PCI,
+  one pair are on a shared slot). Supports 36-bit DRAM SIMs. ISA bus
+  generated by Intel SaturnI/O PCI-ISA bridge. On-board SCSI (NCR 810 on
+  PCI) Ethernet (Digital 21040), KBD, MOUSE (PS2 style), SuperI/O (2S,
+  1P, FD), RTC/NVRAM. Boot ROM is EPROM. PC-AT size. Runs from standard
+  PC power supply.
+
+EB66
+CONFIG_ALPHA_EB66
+  A Digital DS group board. Uses 21066 or 21066A. I/O sub-system is identical
+  to EB64+. Baby PC-AT size. Runs from standard PC power supply. The EB66
+  schematic was published as a marketing poster advertising the 21066 as "the
+  first microprocessor in the world with embedded PCI"
+
+EB66+
+CONFIG_ALPHA_EB66P
+  Later variant of the EB66 board.
+
+Eiger
+CONFIG_ALPHA_EIGER
+  Apparently an obscure OEM single-board computer based on the
+  Typhoon/Tsunami chipset family. Information on it is scanty.
+
+Jensen
+CONFIG_ALPHA_JENSEN
+  DEC PC 150 AXP (aka Jensen): This is a very old Digital system - one
+  of the first-generation Alpha systems. A number of these systems
+  seem to be available on the second- hand market. The Jensen is a
+  floor-standing tower system which originally used a 150MHz 21064 It
+  used programmable logic to interface a 486 EISA I/O bridge to the
+  CPU.
+
+LX164
+CONFIG_ALPHA_LX164
+  A technical overview of this board is available at
+  <http://www.unix-ag.org/Linux-Alpha/Architectures/LX164.html>.
+
+Miata
+CONFIG_ALPHA_MIATA
+  The Digital PersonalWorkStation (PWS 433a, 433au, 500a, 500au, 600a,
+  or 600au).  There is an Installation HOWTO for this hardware at
+  <http://members.brabant.chello.nl/~s.vandereijk/miata.html>.
+
+Mikasa
+CONFIG_ALPHA_MIKASA
+  AlphaServer 1000-based Alpha systems.
+
+Nautilus
+CONFIG_ALPHA_NAUTILUS
+  Alpha systems based on the AMD 751 & ALI 1543C chipsets.
+
+Noname
+CONFIG_ALPHA_NONAME
+  The AXPpci33 (aka NoName), is based on the EB66 (includes the Multia
+  UDB).  This design was produced by Digital's Technical OEM (TOEM)
+  group. It uses the 21066 processor running at 166MHz or 233MHz. It
+  is a baby-AT size, and runs from a standard PC power supply. It has
+  5 ISA slots and 3 PCI slots (one pair are a shared slot). There are
+  2 versions, with either PS/2 or large DIN connectors for the
+  keyboard.
+
+Noritake
+CONFIG_ALPHA_NORITAKE
+  AlphaServer 1000A, AlphaServer 600A, and AlphaServer 800-based systems.
+
+Rawhide
+CONFIG_ALPHA_RAWHIDE
+  AlphaServer 1200, AlphaServer 4000 and AlphaServer 4100 machines.
+  See HOWTO at <http://www.alphalinux.org/docs/rawhide/4100_install.shtml>.
+
+Ruffian
+CONFIG_ALPHA_RUFFIAN
+   Samsung APC164UX.  There is a page on known problems and workarounds
+   at <http://www.alphalinux.org/faq/FAQ-11.html>.
+
+Sable
+CONFIG_ALPHA_SABLE
+  Digital AlphaServer 2000 and 2100-based systems.
+
+Takara
+CONFIG_ALPHA_TAKARA
+  Alpha 11164-based OEM single-board computer.
 
 EV5 CPU daughtercard
 CONFIG_ALPHA_PRIMO
diff -urN linux-2.2.20-pre5/Makefile linux/Makefile
--- linux-2.2.20-pre5/Makefile	Mon Dec  3 22:19:34 2001
+++ linux/Makefile	Mon Dec  3 22:19:41 2001
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 2
 SUBLEVEL = 20
-EXTRAVERSION = pre5
+EXTRAVERSION = pre6
 
 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
 
diff -urN linux-2.2.20-pre5/drivers/isdn/Config.in linux/drivers/isdn/Config.in
--- linux-2.2.20-pre5/drivers/isdn/Config.in	Sun Mar 25 08:37:31 2001
+++ linux/drivers/isdn/Config.in	Mon Dec  3 22:19:41 2001
@@ -132,7 +132,7 @@
    dep_tristate '  AVM T1/T1-B ISA support' CONFIG_ISDN_DRV_AVMB1_T1ISA $CONFIG_ISDN_CAPI
    dep_tristate '  AVM B1/M1/M2 PCMCIA support' CONFIG_ISDN_DRV_AVMB1_B1PCMCIA $CONFIG_ISDN_CAPI $CONFIG_PCMCIA
    dep_tristate '  AVM T1/T1-B PCI support' CONFIG_ISDN_DRV_AVMB1_T1PCI $CONFIG_ISDN_CAPI $CONFIG_PCI
-   dep_tristate '  AVM C4 support' CONFIG_ISDN_DRV_AVMB1_C4 $CONFIG_ISDN_CAPI $CONFIG_PCI
+   dep_tristate '  AVM C4/C2 support' CONFIG_ISDN_DRV_AVMB1_C4 $CONFIG_ISDN_CAPI $CONFIG_PCI
 fi
 
 # HYSDN
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/avmcard.h linux/drivers/isdn/avmb1/avmcard.h
--- linux-2.2.20-pre5/drivers/isdn/avmb1/avmcard.h	Sun Mar 25 08:37:31 2001
+++ linux/drivers/isdn/avmb1/avmcard.h	Mon Dec  3 22:19:41 2001
@@ -1,57 +1,8 @@
 /*
- * $Id: avmcard.h,v 1.8 2000/10/10 17:44:19 kai Exp $
+ * $Id: avmcard.h,v 1.8.6.3 2001/05/17 21:15:33 kai Exp $
  *
  * Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
  *
- * $Log: avmcard.h,v $
- * Revision 1.8  2000/10/10 17:44:19  kai
- * changes from/for 2.2.18
- *
- * Revision 1.7  2000/01/25 14:33:38  calle
- * - Added Support AVM B1 PCI V4.0 (tested with prototype)
- *   - splitted up t1pci.c into b1dma.c for common function with b1pciv4
- *   - support for revision register
- *
- * Revision 1.6  1999/11/05 16:38:01  calle
- * Cleanups before kernel 2.4:
- * - Changed all messages to use card->name or driver->name instead of
- *   constant string.
- * - Moved some data from struct avmcard into new struct avmctrl_info.
- *   Changed all lowlevel capi driver to match the new structur.
- *
- * Revision 1.5  1999/09/07 09:02:53  calle
- * SETDATA removed. Now inside the kernel the datapart of DATA_B3_REQ and
- * DATA_B3_IND is always directly after the CAPI message. The "Data" member
- * ist never used inside the kernel.
- *
- * Revision 1.4  1999/08/04 10:10:08  calle
- * Bugfix: corrected /proc functions, added structure for new AVM cards.
- *
- * Revision 1.3  1999/07/23 08:41:47  calle
- * prepared for new AVM cards.
- *
- * Revision 1.2  1999/07/05 15:09:45  calle
- * - renamed "appl_release" to "appl_released".
- * - version und profile data now cleared on controller reset
- * - extended /proc interface, to allow driver and controller specific
- *   informations to include by driver hackers.
- *
- * Revision 1.1  1999/07/01 15:26:22  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
  */
 
 #ifndef _AVMCARD_H_
@@ -59,7 +10,6 @@
 
 #define	AVMB1_PORTLEN		0x1f
 #define AVM_MAXVERSION		8
-#define AVM_NAPPS		30
 #define AVM_NCCI_PER_CHANNEL	4
 
 /*
@@ -83,7 +33,8 @@
 	avm_m2,
 	avm_t1isa,
 	avm_t1pci,
-	avm_c4
+	avm_c4,
+	avm_c2
 };
 
 typedef struct avmcard_dmainfo {
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/b1.c linux/drivers/isdn/avmb1/b1.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/b1.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/b1.c	Mon Dec  3 22:19:41 2001
@@ -1,111 +1,9 @@
 /*
- * $Id: b1.c,v 1.20.6.3 2001/03/21 08:52:20 kai Exp $
+ * $Id: b1.c,v 1.20.6.6 2001/05/17 21:15:33 kai Exp $
  * 
  * Common module for AVM B1 cards.
  * 
  * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
- * 
- * $Log: b1.c,v $
- * Revision 1.20.6.3  2001/03/21 08:52:20  kai
- * merge from main branch: fix buffer for revision string (calle)
- *
- * Revision 1.20.6.2  2001/03/15 15:11:23  kai
- * *** empty log message ***
- *
- * Revision 1.20.6.1  2001/02/13 11:43:29  kai
- * more compatility changes for 2.2.19
- *
- * Revision 1.20  2000/11/23 20:45:14  kai
- * fixed module_init/exit stuff
- * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
- *
- * Revision 1.19  2000/11/19 17:02:47  kai
- * compatibility cleanup - part 3
- *
- * Revision 1.18  2000/11/19 17:01:53  kai
- * compatibility cleanup - part 2
- *
- * Revision 1.17  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.16  2000/08/04 15:36:31  calle
- * copied wrong from file to file :-(
- *
- * Revision 1.15  2000/08/04 12:20:08  calle
- * - Fix unsigned/signed warning in the right way ...
- *
- * Revision 1.14  2000/06/19 16:51:53  keil
- * don't free skb in irq context
- *
- * Revision 1.13  2000/01/25 14:33:38  calle
- * - Added Support AVM B1 PCI V4.0 (tested with prototype)
- *   - splitted up t1pci.c into b1dma.c for common function with b1pciv4
- *   - support for revision register
- *
- * Revision 1.12  1999/11/05 16:38:01  calle
- * Cleanups before kernel 2.4:
- * - Changed all messages to use card->name or driver->name instead of
- *   constant string.
- * - Moved some data from struct avmcard into new struct avmctrl_info.
- *   Changed all lowlevel capi driver to match the new structur.
- *
- * Revision 1.11  1999/10/11 22:04:12  keil
- * COMPAT_NEED_UACCESS (no include in isdn_compat.h)
- *
- * Revision 1.10  1999/09/15 08:16:03  calle
- * Implementation of 64Bit extention complete.
- *
- * Revision 1.9  1999/09/07 09:02:53  calle
- * SETDATA removed. Now inside the kernel the datapart of DATA_B3_REQ and
- * DATA_B3_IND is always directly after the CAPI message. The "Data" member
- * ist never used inside the kernel.
- *
- * Revision 1.8  1999/08/22 20:26:22  calle
- * backported changes from kernel 2.3.14:
- * - several #include "config.h" gone, others come.
- * - "struct device" changed to "struct net_device" in 2.3.14, added a
- *   define in isdn_compat.h for older kernel versions.
- *
- * Revision 1.7  1999/08/04 10:10:09  calle
- * Bugfix: corrected /proc functions, added structure for new AVM cards.
- *
- * Revision 1.6  1999/07/23 08:51:04  calle
- * small fix and typo in checkin before.
- *
- * Revision 1.5  1999/07/23 08:41:48  calle
- * prepared for new AVM cards.
- *
- * Revision 1.4  1999/07/09 15:05:38  keil
- * compat.h is now isdn_compat.h
- *
- * Revision 1.3  1999/07/06 07:41:59  calle
- * - changes in /proc interface
- * - check and changed calls to [dev_]kfree_skb and [dev_]alloc_skb.
- *
- * Revision 1.2  1999/07/05 15:09:47  calle
- * - renamed "appl_release" to "appl_released".
- * - version und profile data now cleared on controller reset
- * - extended /proc interface, to allow driver and controller specific
- *   informations to include by driver hackers.
- *
- * Revision 1.1  1999/07/01 15:26:23  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
  *
  */
 
@@ -117,6 +15,7 @@
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/capi.h>
+#include <linux/kernelcapi.h>
 #include <asm/io.h>
 #include <linux/init.h>
 #include <linux/isdn_compat.h>
@@ -127,7 +26,7 @@
 #include "capicmd.h"
 #include "capiutil.h"
 
-static char *revision = "$Revision: 1.20.6.3 $";
+static char *revision = "$Revision: 1.20.6.6 $";
 
 /* ------------------------------------------------------------- */
 
@@ -372,7 +271,7 @@
 	cli();
 	b1_setinterrupt(port, card->irq, card->cardtype);
 	b1_put_byte(port, SEND_INIT);
-	b1_put_word(port, AVM_NAPPS);
+	b1_put_word(port, CAPI_MAXAPPL);
 	b1_put_word(port, AVM_NCCI_PER_CHANNEL*2);
 	b1_put_word(port, ctrl->cnr - 1);
 	restore_flags(flags);
@@ -687,6 +586,7 @@
 	case avm_t1isa: s = "T1 ISA (HEMA)"; break;
 	case avm_t1pci: s = "T1 PCI"; break;
 	case avm_c4: s = "C4"; break;
+	case avm_c2: s = "C2"; break;
 	default: s = "???"; break;
 	}
 	len += sprintf(page+len, "%-16s %s\n", "type", s);
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/b1dma.c linux/drivers/isdn/avmb1/b1dma.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/b1dma.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/b1dma.c	Mon Dec  3 22:19:41 2001
@@ -1,56 +1,10 @@
 /*
- * $Id: b1dma.c,v 1.11.6.3 2001/03/21 08:52:21 kai Exp $
+ * $Id: b1dma.c,v 1.11.6.6 2001/05/17 21:15:33 kai Exp $
  * 
  * Common module for AVM B1 cards that support dma with AMCC
  * 
  * (c) Copyright 2000 by Carsten Paeth (calle@calle.in-berlin.de)
  * 
- * $Log: b1dma.c,v $
- * Revision 1.11.6.3  2001/03/21 08:52:21  kai
- * merge from main branch: fix buffer for revision string (calle)
- *
- * Revision 1.11.6.2  2001/03/15 15:11:23  kai
- * *** empty log message ***
- *
- * Revision 1.11.6.1  2001/02/13 11:43:29  kai
- * more compatility changes for 2.2.19
- *
- * Revision 1.11  2000/11/19 17:02:47  kai
- * compatibility cleanup - part 3
- *
- * Revision 1.10  2000/11/19 17:01:53  kai
- * compatibility cleanup - part 2
- *
- * Revision 1.9  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.8  2000/10/10 17:44:19  kai
- * changes from/for 2.2.18
- *
- * Revision 1.7  2000/08/04 12:20:08  calle
- * - Fix unsigned/signed warning in the right way ...
- *
- * Revision 1.6  2000/06/29 13:59:06  calle
- * Bugfix: reinit txdma without interrupt will confuse some AMCC chips.
- *
- * Revision 1.5  2000/06/19 16:51:53  keil
- * don't free skb in irq context
- *
- * Revision 1.4  2000/04/03 16:38:05  calle
- * made suppress_pollack static.
- *
- * Revision 1.3  2000/02/26 01:00:53  keil
- * changes from 2.3.47
- *
- * Revision 1.2  2000/01/25 14:44:47  calle
- * typo in b1pciv4_detect().
- *
- * Revision 1.1  2000/01/25 14:36:43  calle
- * common function for  T1 PCI and B1 PCI V4.
- *
- *
  */
 
 #include <linux/config.h>
@@ -62,6 +16,7 @@
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/capi.h>
+#include <linux/kernelcapi.h>
 #include <asm/io.h>
 #include <linux/init.h>
 #include <linux/isdn_compat.h>
@@ -72,7 +27,7 @@
 #include "capicmd.h"
 #include "capiutil.h"
 
-static char *revision = "$Revision: 1.11.6.3 $";
+static char *revision = "$Revision: 1.11.6.6 $";
 
 /* ------------------------------------------------------------- */
 
@@ -729,7 +684,7 @@
 	_put_byte(&p, 0);
 	_put_byte(&p, 0);
 	_put_byte(&p, SEND_INIT);
-	_put_word(&p, AVM_NAPPS);
+	_put_word(&p, CAPI_MAXAPPL);
 	_put_word(&p, AVM_NCCI_PER_CHANNEL*30);
 	_put_word(&p, card->cardnr - 1);
 	skb_put(skb, (__u8 *)p - (__u8 *)skb->data);
@@ -908,6 +863,7 @@
 	case avm_t1isa: s = "T1 ISA (HEMA)"; break;
 	case avm_t1pci: s = "T1 PCI"; break;
 	case avm_c4: s = "C4"; break;
+	case avm_c2: s = "C2"; break;
 	default: s = "???"; break;
 	}
 	len += sprintf(page+len, "%-16s %s\n", "type", s);
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/b1isa.c linux/drivers/isdn/avmb1/b1isa.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/b1isa.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/b1isa.c	Mon Dec  3 22:19:41 2001
@@ -1,83 +1,10 @@
 /*
- * $Id: b1isa.c,v 1.10.6.4 2001/03/21 08:52:21 kai Exp $
+ * $Id: b1isa.c,v 1.10.6.5 2001/05/17 20:41:51 kai Exp $
  * 
  * Module for AVM B1 ISA-card.
  * 
  * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
  * 
- * $Log: b1isa.c,v $
- * Revision 1.10.6.4  2001/03/21 08:52:21  kai
- * merge from main branch: fix buffer for revision string (calle)
- *
- * Revision 1.10.6.3  2001/03/15 15:11:23  kai
- * *** empty log message ***
- *
- * Revision 1.10.6.2  2001/02/16 16:43:23  kai
- * Changes from -ac16, little bug fixes, typos and the like
- *
- * Revision 1.10.6.1  2001/02/13 11:43:29  kai
- * more compatility changes for 2.2.19
- *
- * Revision 1.10  2000/11/23 20:45:14  kai
- * fixed module_init/exit stuff
- * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
- *
- * Revision 1.9  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.8  2000/04/03 13:29:24  calle
- * make Tim Waugh happy (module unload races in 2.3.99-pre3).
- * no real problem there, but now it is much cleaner ...
- *
- * Revision 1.7  2000/02/02 18:36:03  calle
- * - Modules are now locked while init_module is running
- * - fixed problem with memory mapping if address is not aligned
- *
- * Revision 1.6  2000/01/25 14:37:39  calle
- * new message after successful detection including card revision and
- * used resources.
- *
- * Revision 1.5  1999/11/05 16:38:01  calle
- * Cleanups before kernel 2.4:
- * - Changed all messages to use card->name or driver->name instead of
- *   constant string.
- * - Moved some data from struct avmcard into new struct avmctrl_info.
- *   Changed all lowlevel capi driver to match the new structur.
- *
- * Revision 1.4  1999/08/22 20:26:24  calle
- * backported changes from kernel 2.3.14:
- * - several #include "config.h" gone, others come.
- * - "struct device" changed to "struct net_device" in 2.3.14, added a
- *   define in isdn_compat.h for older kernel versions.
- *
- * Revision 1.3  1999/07/09 15:05:40  keil
- * compat.h is now isdn_compat.h
- *
- * Revision 1.2  1999/07/05 15:09:49  calle
- * - renamed "appl_release" to "appl_released".
- * - version und profile data now cleared on controller reset
- * - extended /proc interface, to allow driver and controller specific
- *   informations to include by driver hackers.
- *
- * Revision 1.1  1999/07/01 15:26:27  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
- *
  */
 
 #include <linux/module.h>
@@ -96,7 +23,7 @@
 #include "capilli.h"
 #include "avmcard.h"
 
-static char *revision = "$Revision: 1.10.6.4 $";
+static char *revision = "$Revision: 1.10.6.5 $";
 
 /* ------------------------------------------------------------- */
 
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/b1pci.c linux/drivers/isdn/avmb1/b1pci.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/b1pci.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/b1pci.c	Mon Dec  3 22:19:41 2001
@@ -1,108 +1,10 @@
 /*
- * $Id: b1pci.c,v 1.29.6.2 2001/03/21 08:52:21 kai Exp $
+ * $Id: b1pci.c,v 1.29.6.4 2001/05/17 20:41:51 kai Exp $
  * 
  * Module for AVM B1 PCI-card.
  * 
  * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
  * 
- * $Log: b1pci.c,v $
- * Revision 1.29.6.2  2001/03/21 08:52:21  kai
- * merge from main branch: fix buffer for revision string (calle)
- *
- * Revision 1.29.6.1  2000/11/28 12:02:45  kai
- * MODULE_DEVICE_TABLE for 2.4
- *
- * Revision 1.29.2.2  2000/11/26 17:47:53  kai
- * added PCI_DEV_TABLE for 2.4
- *
- * Revision 1.29.2.1  2000/11/26 17:14:19  kai
- * fix device ids
- * also needs patches to include/linux/pci_ids.h
- *
- * Revision 1.29  2000/11/23 20:45:14  kai
- * fixed module_init/exit stuff
- * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
- *
- * Revision 1.28  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.27  2000/08/08 09:24:19  calle
- * calls to pci_enable_device surounded by #ifndef COMPAT_HAS_2_2_PCI
- *
- * Revision 1.26  2000/07/20 10:21:21  calle
- * Bugfix: driver will not be unregistered, if not cards were detected.
- *         this result in an oops in kcapi.c
- *
- * Revision 1.25  2000/05/29 12:29:18  keil
- * make pci_enable_dev compatible to 2.2 kernel versions
- *
- * Revision 1.24  2000/05/19 15:43:22  calle
- * added calls to pci_device_start().
- *
- * Revision 1.23  2000/05/06 00:52:36  kai
- * merged changes from kernel tree
- * fixed timer and net_device->name breakage
- *
- * Revision 1.22  2000/04/21 13:01:33  calle
- * Revision in b1pciv4 driver was missing.
- *
- * Revision 1.21  2000/04/03 13:29:24  calle
- * make Tim Waugh happy (module unload races in 2.3.99-pre3).
- * no real problem there, but now it is much cleaner ...
- *
- * Revision 1.20  2000/02/02 18:36:03  calle
- * - Modules are now locked while init_module is running
- * - fixed problem with memory mapping if address is not aligned
- *
- * Revision 1.19  2000/01/25 14:33:38  calle
- * - Added Support AVM B1 PCI V4.0 (tested with prototype)
- *   - splitted up t1pci.c into b1dma.c for common function with b1pciv4
- *   - support for revision register
- *
- * Revision 1.18  1999/11/05 16:38:01  calle
- * Cleanups before kernel 2.4:
- * - Changed all messages to use card->name or driver->name instead of
- *   constant string.
- * - Moved some data from struct avmcard into new struct avmctrl_info.
- *   Changed all lowlevel capi driver to match the new structur.
- *
- * Revision 1.17  1999/10/05 06:50:07  calle
- * Forgot SA_SHIRQ as argument to request_irq.
- *
- * Revision 1.16  1999/08/11 21:01:07  keil
- * new PCI codefix
- *
- * Revision 1.15  1999/08/10 16:02:27  calle
- * struct pci_dev changed in 2.3.13. Made the necessary changes.
- *
- * Revision 1.14  1999/07/09 15:05:41  keil
- * compat.h is now isdn_compat.h
- *
- * Revision 1.13  1999/07/05 15:09:50  calle
- * - renamed "appl_release" to "appl_released".
- * - version und profile data now cleared on controller reset
- * - extended /proc interface, to allow driver and controller specific
- *   informations to include by driver hackers.
- *
- * Revision 1.12  1999/07/01 15:26:29  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
- *
  */
 
 #include <linux/config.h>
@@ -123,7 +25,7 @@
 #include "capilli.h"
 #include "avmcard.h"
 
-static char *revision = "$Revision: 1.29.6.2 $";
+static char *revision = "$Revision: 1.29.6.4 $";
 
 /* ------------------------------------------------------------- */
 
@@ -322,7 +224,7 @@
 
 	div4->detach_ctr(ctrl);
 	free_irq(card->irq, card);
-	iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK));
+	iounmap(card->mbase);
 	release_region(card->port, AVMB1_PORTLEN);
 	ctrl->driverdata = 0;
 	kfree(card->ctrlinfo);
@@ -353,7 +255,6 @@
 
 static int b1pciv4_add_card(struct capi_driver *driver, struct capicardparams *p)
 {
-	unsigned long base, page_offset;
 	avmcard *card;
 	avmctrl_info *cinfo;
 	int retval;
@@ -404,12 +305,8 @@
 		return -EBUSY;
 	}
 
-	base = card->membase & PAGE_MASK;
-	page_offset = card->membase - base;
-	card->mbase = ioremap_nocache(base, page_offset + 64);
-	if (card->mbase) {
-		card->mbase += page_offset;
-	} else {
+	card->mbase = ioremap_nocache(card->membase, 64);
+	if (!card->mbase) {
 		printk(KERN_NOTICE "%s: can't remap memory at 0x%lx\n",
 					driver->name, card->membase);
 	        kfree(card->ctrlinfo);
@@ -424,7 +321,7 @@
 	if ((retval = b1pciv4_detect(card)) != 0) {
 		printk(KERN_NOTICE "%s: NO card at 0x%x (%d)\n",
 					driver->name, card->port, retval);
-                iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK));
+                iounmap(card->mbase);
 	        kfree(card->ctrlinfo);
 		kfree(card->dma);
 		kfree(card);
@@ -440,7 +337,7 @@
 	if (retval) {
 		printk(KERN_ERR "%s: unable to get IRQ %d.\n",
 				driver->name, card->irq);
-                iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK));
+                iounmap(card->mbase);
 		release_region(card->port, AVMB1_PORTLEN);
 	        kfree(card->ctrlinfo);
 		kfree(card->dma);
@@ -452,7 +349,7 @@
 	cinfo->capi_ctrl = div4->attach_ctr(driver, card->name, cinfo);
 	if (!cinfo->capi_ctrl) {
 		printk(KERN_ERR "%s: attach controller failed.\n", driver->name);
-                iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK));
+                iounmap(card->mbase);
 		free_irq(card->irq, card);
 		release_region(card->port, AVMB1_PORTLEN);
 	        kfree(card->ctrlinfo);
@@ -503,14 +400,21 @@
 	struct capicardparams param;
 	int retval;
 
+	if (pci_enable_device(dev) < 0) {
+		printk(KERN_ERR "%s: failed to enable AVM-B1\n",
+		       driver->name);
+		return -ENODEV;
+	}
+	param.irq = dev->irq;
+
 	if (dev->base_address[ 2] & PCI_BASE_ADDRESS_IO_MASK) { /* B1 PCI V4 */
 #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
 		driver = &b1pciv4_driver;
+
+		pci_set_master(dev);
 #endif
 		param.membase = dev->base_address[ 0] & PCI_BASE_ADDRESS_MEM_MASK;
 		param.port = dev->base_address[ 2] & PCI_BASE_ADDRESS_IO_MASK;
-		param.irq = dev->irq;
-
 
 		printk(KERN_INFO
 		"%s: PCI BIOS reports AVM-B1 V4 at i/o %#x, irq %d, mem %#x\n",
@@ -528,7 +432,6 @@
 	} else {
 		param.membase = 0;
 		param.port = dev->base_address[ 1] & PCI_BASE_ADDRESS_IO_MASK;
-		param.irq = dev->irq;
 
 		printk(KERN_INFO
 		"%s: PCI BIOS reports AVM-B1 at i/o %#x, irq %d\n",
@@ -551,7 +454,6 @@
 #endif
 	struct pci_dev *dev = NULL;
 	char *p;
-	int retval;
 
 	MOD_INC_USE_COUNT;
 
@@ -573,50 +475,29 @@
 	printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
 
         di = attach_capi_driver(driver);
-
 	if (!di) {
 		printk(KERN_ERR "%s: failed to attach capi_driver\n",
 				driver->name);
 		MOD_DEC_USE_COUNT;
-		return -EIO;
+		return -ENODEV;
 	}
 
 #ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
 	printk(KERN_INFO "%s: revision %s\n", driverv4->name, driverv4->revision);
 
         div4 = attach_capi_driver(driverv4);
-
 	if (!div4) {
     		detach_capi_driver(driver);
 		printk(KERN_ERR "%s: failed to attach capi_driver\n",
 				driverv4->name);
 		MOD_DEC_USE_COUNT;
-		return -EIO;
+		return -ENODEV;
 	}
 #endif
 
-#ifdef CONFIG_PCI
-	if (!pci_present()) {
-		printk(KERN_ERR "%s: no PCI bus present\n", driver->name);
-    		detach_capi_driver(driver);
-#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
-    		detach_capi_driver(driverv4);
-#endif
-		MOD_DEC_USE_COUNT;
-		return -EIO;
-	}
-
 	while ((dev = pci_find_device(PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_B1, dev))) {
-		retval = add_card(dev);
-		if (retval != 0) {
-    			detach_capi_driver(driver);
-#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
-    			detach_capi_driver(driverv4);
-#endif
-			MOD_DEC_USE_COUNT;
-			return retval;
-		}
-		ncards++;
+		if (add_card(dev) == 0)
+			ncards++;
 	}
 	if (ncards) {
 		printk(KERN_INFO "%s: %d B1-PCI card(s) detected\n",
@@ -630,12 +511,7 @@
 	detach_capi_driver(driverv4);
 #endif
 	MOD_DEC_USE_COUNT;
-	return -ESRCH;
-#else
-	printk(KERN_ERR "%s: kernel not compiled with PCI.\n", driver->name);
-	MOD_DEC_USE_COUNT;
-	return -EIO;
-#endif
+	return -ENODEV;
 }
 
 static void  b1pci_exit(void)
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/b1pcmcia.c linux/drivers/isdn/avmb1/b1pcmcia.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/b1pcmcia.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/b1pcmcia.c	Mon Dec  3 22:19:41 2001
@@ -1,89 +1,10 @@
 /*
- * $Id: b1pcmcia.c,v 1.12.6.3 2001/03/21 08:52:21 kai Exp $
+ * $Id: b1pcmcia.c,v 1.12.6.4 2001/05/17 20:41:51 kai Exp $
  * 
  * Module for AVM B1/M1/M2 PCMCIA-card.
  * 
  * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
  * 
- * $Log: b1pcmcia.c,v $
- * Revision 1.12.6.3  2001/03/21 08:52:21  kai
- * merge from main branch: fix buffer for revision string (calle)
- *
- * Revision 1.12.6.2  2001/02/16 16:43:23  kai
- * Changes from -ac16, little bug fixes, typos and the like
- *
- * Revision 1.12.6.1  2001/02/13 11:43:29  kai
- * more compatility changes for 2.2.19
- *
- * Revision 1.12  2000/11/23 20:45:14  kai
- * fixed module_init/exit stuff
- * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
- *
- * Revision 1.11  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.10  2000/05/06 00:52:36  kai
- * merged changes from kernel tree
- * fixed timer and net_device->name breakage
- *
- * Revision 1.9  2000/04/03 13:29:24  calle
- * make Tim Waugh happy (module unload races in 2.3.99-pre3).
- * no real problem there, but now it is much cleaner ...
- *
- * Revision 1.8  2000/03/06 18:00:23  calle
- * - Middleware extention now working with 2.3.49 (capifs).
- * - Fixed typos in debug section of capi.c
- * - Bugfix: Makefile corrected for b1pcmcia.c
- *
- * Revision 1.7  2000/02/02 18:36:03  calle
- * - Modules are now locked while init_module is running
- * - fixed problem with memory mapping if address is not aligned
- *
- * Revision 1.6  2000/01/25 14:37:39  calle
- * new message after successful detection including card revision and
- * used resources.
- *
- * Revision 1.5  1999/11/05 16:38:01  calle
- * Cleanups before kernel 2.4:
- * - Changed all messages to use card->name or driver->name instead of
- *   constant string.
- * - Moved some data from struct avmcard into new struct avmctrl_info.
- *   Changed all lowlevel capi driver to match the new structur.
- *
- * Revision 1.4  1999/08/22 20:26:26  calle
- * backported changes from kernel 2.3.14:
- * - several #include "config.h" gone, others come.
- * - "struct device" changed to "struct net_device" in 2.3.14, added a
- *   define in isdn_compat.h for older kernel versions.
- *
- * Revision 1.3  1999/07/09 15:05:41  keil
- * compat.h is now isdn_compat.h
- *
- * Revision 1.2  1999/07/05 15:09:51  calle
- * - renamed "appl_release" to "appl_released".
- * - version und profile data now cleared on controller reset
- * - extended /proc interface, to allow driver and controller specific
- *   informations to include by driver hackers.
- *
- * Revision 1.1  1999/07/01 15:26:30  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
- *
  */
 
 #include <linux/module.h>
@@ -102,7 +23,7 @@
 #include "capilli.h"
 #include "avmcard.h"
 
-static char *revision = "$Revision: 1.12.6.3 $";
+static char *revision = "$Revision: 1.12.6.4 $";
 
 /* ------------------------------------------------------------- */
 
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/c4.c linux/drivers/isdn/avmb1/c4.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/c4.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/c4.c	Mon Dec  3 22:19:41 2001
@@ -1,101 +1,9 @@
 /*
- * $Id: c4.c,v 1.20.6.5 2001/03/21 08:52:21 kai Exp $
+ * $Id: c4.c,v 1.20.6.10 2001/06/09 15:14:15 kai Exp $
  * 
- * Module for AVM C4 card.
+ * Module for AVM C4 & C2 card.
  * 
  * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
- * 
- * $Log: c4.c,v $
- * Revision 1.20.6.5  2001/03/21 08:52:21  kai
- * merge from main branch: fix buffer for revision string (calle)
- *
- * Revision 1.20.6.4  2001/03/15 15:11:23  kai
- * *** empty log message ***
- *
- * Revision 1.20.6.3  2001/02/16 16:43:23  kai
- * Changes from -ac16, little bug fixes, typos and the like
- *
- * Revision 1.20.6.2  2001/02/13 11:43:29  kai
- * more compatility changes for 2.2.19
- *
- * Revision 1.20.6.1  2000/11/28 12:02:45  kai
- * MODULE_DEVICE_TABLE for 2.4
- *
- * Revision 1.20.2.2  2000/11/26 17:47:53  kai
- * added PCI_DEV_TABLE for 2.4
- *
- * Revision 1.20.2.1  2000/11/26 17:14:19  kai
- * fix device ids
- * also needs patches to include/linux/pci_ids.h
- *
- * Revision 1.20  2000/11/23 20:45:14  kai
- * fixed module_init/exit stuff
- * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
- *
- * Revision 1.19  2000/11/19 17:02:47  kai
- * compatibility cleanup - part 3
- *
- * Revision 1.18  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.17  2000/10/10 17:44:19  kai
- * changes from/for 2.2.18
- *
- * Revision 1.16  2000/08/20 07:30:13  keil
- * changes for 2.4
- *
- * Revision 1.15  2000/08/08 09:24:19  calle
- * calls to pci_enable_device surounded by #ifndef COMPAT_HAS_2_2_PCI
- *
- * Revision 1.14  2000/08/04 12:20:08  calle
- * - Fix unsigned/signed warning in the right way ...
- *
- * Revision 1.13  2000/07/20 10:21:21  calle
- * Bugfix: driver will not be unregistered, if not cards were detected.
- *         this result in an oops in kcapi.c
- *
- * Revision 1.12  2000/06/19 16:51:53  keil
- * don't free skb in irq context
- *
- * Revision 1.11  2000/06/19 15:11:24  keil
- * avoid use of freed structs
- * changes from 2.4.0-ac21
- *
- * Revision 1.10  2000/05/29 12:29:18  keil
- * make pci_enable_dev compatible to 2.2 kernel versions
- *
- * Revision 1.9  2000/05/19 15:43:22  calle
- * added calls to pci_device_start().
- *
- * Revision 1.8  2000/04/03 16:38:05  calle
- * made suppress_pollack static.
- *
- * Revision 1.7  2000/04/03 13:29:24  calle
- * make Tim Waugh happy (module unload races in 2.3.99-pre3).
- * no real problem there, but now it is much cleaner ...
- *
- * Revision 1.6  2000/03/17 12:21:08  calle
- * send patchvalues now working.
- *
- * Revision 1.5  2000/03/16 15:21:03  calle
- * Bugfix in c4_remove: loop 5 times instead of 4 :-(
- *
- * Revision 1.4  2000/02/02 18:36:03  calle
- * - Modules are now locked while init_module is running
- * - fixed problem with memory mapping if address is not aligned
- *
- * Revision 1.3  2000/01/25 14:37:39  calle
- * new message after successful detection including card revision and
- * used resources.
- *
- * Revision 1.2  2000/01/21 20:52:58  keil
- * pci_find_subsys as local function for 2.2.X kernel
- *
- * Revision 1.1  2000/01/20 10:51:37  calle
- * Added driver for C4.
- *
  *
  */
 
@@ -110,6 +18,7 @@
 #include <linux/pci.h>
 #include <linux/isdn_compat.h>
 #include <linux/capi.h>
+#include <linux/kernelcapi.h>
 #include <linux/init.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -119,7 +28,7 @@
 #include "capilli.h"
 #include "avmcard.h"
 
-static char *revision = "$Revision: 1.20.6.5 $";
+static char *revision = "$Revision: 1.20.6.10 $";
 
 #undef CONFIG_C4_DEBUG
 #undef CONFIG_C4_POLLDEBUG
@@ -609,7 +518,7 @@
 		MsgLen = _get_slice(&p, card->msgbuf);
 		DataB3Len = _get_slice(&p, card->databuf);
 		cidx = CAPIMSG_CONTROLLER(card->msgbuf)-card->cardnr;
-		if (cidx > 3) cidx = 0;
+		if (cidx >= card->nlogcontr) cidx = 0;
 		ctrl = card->ctrlinfo[cidx].capi_ctrl;
 
 		if (MsgLen < 30) { /* not CAPI 64Bit */
@@ -632,7 +541,7 @@
 		ApplId = (unsigned) _get_word(&p);
 		MsgLen = _get_slice(&p, card->msgbuf);
 		cidx = CAPIMSG_CONTROLLER(card->msgbuf)-card->cardnr;
-		if (cidx > 3) cidx = 0;
+		if (cidx >= card->nlogcontr) cidx = 0;
 		ctrl = card->ctrlinfo[cidx].capi_ctrl;
 
 		if (!(skb = alloc_skb(MsgLen, GFP_ATOMIC))) {
@@ -650,7 +559,7 @@
 		NCCI = _get_word(&p);
 		WindowSize = _get_word(&p);
 		cidx = (NCCI&0x7f) - card->cardnr;
-		if (cidx > 3) cidx = 0;
+		if (cidx >= card->nlogcontr) cidx = 0;
 		ctrl = card->ctrlinfo[cidx].capi_ctrl;
 
 		ctrl->new_ncci(ctrl, ApplId, NCCI, WindowSize);
@@ -664,13 +573,15 @@
 
 		if (NCCI != 0xffffffff) {
 			cidx = (NCCI&0x7f) - card->cardnr;
-			if (cidx > 3) cidx = 0;
+			if (cidx >= card->nlogcontr) cidx = 0;
 			ctrl = card->ctrlinfo[cidx].capi_ctrl;
-			ctrl->free_ncci(ctrl, ApplId, NCCI);
+			if (ctrl)
+				ctrl->free_ncci(ctrl, ApplId, NCCI);
 		} else {
 			for (cidx=0; cidx < 4; cidx++) {
 				ctrl = card->ctrlinfo[cidx].capi_ctrl;
-				ctrl->appl_released(ctrl, ApplId);
+				if (ctrl)
+					ctrl->appl_released(ctrl, ApplId);
 			}
 		}
 		break;
@@ -683,20 +594,28 @@
 			queue_pollack(card);
 		for (cidx=0; cidx < 4; cidx++) {
 			ctrl = card->ctrlinfo[cidx].capi_ctrl;
-			ctrl->resume_output(ctrl);
+			if (ctrl)
+				ctrl->resume_output(ctrl);
 		}
 		break;
 
 	case RECEIVE_STOP:
 		for (cidx=0; cidx < 4; cidx++) {
 			ctrl = card->ctrlinfo[cidx].capi_ctrl;
-			ctrl->suspend_output(ctrl);
+			if (ctrl)
+				ctrl->suspend_output(ctrl);
 		}
 		break;
 
 	case RECEIVE_INIT:
 
-	        cidx = card->nlogcontr++;
+	        cidx = card->nlogcontr;
+		if (cidx >= 4 || !card->ctrlinfo[cidx].capi_ctrl) {
+			printk(KERN_ERR "%s: card with %d controllers ??\n",
+					card->name, cidx+1);
+			break;
+		}
+	        card->nlogcontr++;
 	        cinfo = &card->ctrlinfo[cidx];
 		ctrl = cinfo->capi_ctrl;
 		cinfo->versionlen = _get_slice(&p, cinfo->versionbuf);
@@ -750,6 +669,8 @@
 	if (status & DBELL_RESET_HOST) {
 		int i;
 		c4outmeml(card->mbase+PCI_OUT_INT_MASK, 0x0c);
+		if (card->nlogcontr == 0)
+			return;
 		printk(KERN_ERR "%s: unexpected reset\n", card->name);
                 for (i=0; i < 4; i++) {
 			avmctrl_info *cinfo = &card->ctrlinfo[i];
@@ -757,6 +678,7 @@
 			if (cinfo->capi_ctrl)
 				cinfo->capi_ctrl->reseted(cinfo->capi_ctrl);
 		}
+		card->nlogcontr = 0;
 		return;
 	}
 
@@ -825,7 +747,7 @@
 	_put_byte(&p, 0);
 	_put_byte(&p, 0);
 	_put_byte(&p, SEND_INIT);
-	_put_word(&p, AVM_NAPPS);
+	_put_word(&p, CAPI_MAXAPPL);
 	_put_word(&p, AVM_NCCI_PER_CHANNEL*30);
 	_put_word(&p, card->cardnr - 1);
 	skb_put(skb, (__u8 *)p - (__u8 *)skb->data);
@@ -988,6 +910,7 @@
 		if (cinfo->capi_ctrl)
 			cinfo->capi_ctrl->reseted(cinfo->capi_ctrl);
 	}
+	card->nlogcontr = 0;
 }
 
 static void c4_remove_ctr(struct capi_ctr *ctrl)
@@ -1007,7 +930,7 @@
 	}
 
 	free_irq(card->irq, card);
-	iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK));
+	iounmap(card->mbase);
 	release_region(card->port, AVMB1_PORTLEN);
 	ctrl->driverdata = 0;
 	kfree(card->ctrlinfo);
@@ -1140,6 +1063,7 @@
 	case avm_t1isa: s = "T1 ISA (HEMA)"; break;
 	case avm_t1pci: s = "T1 PCI"; break;
 	case avm_c4: s = "C4"; break;
+	case avm_c2: s = "C2"; break;
 	default: s = "???"; break;
 	}
 	len += sprintf(page+len, "%-16s %s\n", "type", s);
@@ -1187,9 +1111,10 @@
 
 /* ------------------------------------------------------------- */
 
-static int c4_add_card(struct capi_driver *driver, struct capicardparams *p)
+static int c4_add_card(struct capi_driver *driver,
+		       struct capicardparams *p,
+		       int nr)
 {
-	unsigned long base, page_offset;
 	avmctrl_info *cinfo;
 	avmcard *card;
 	int retval;
@@ -1227,11 +1152,11 @@
 		cinfo = &card->ctrlinfo[i];
 		cinfo->card = card;
 	}
-	sprintf(card->name, "c4-%x", p->port);
+	sprintf(card->name, "%s-%x", driver->name, p->port);
 	card->port = p->port;
 	card->irq = p->irq;
 	card->membase = p->membase;
-	card->cardtype = avm_c4;
+	card->cardtype = nr == 4 ? avm_c4 : avm_c2;
 
 	if (check_region(card->port, AVMB1_PORTLEN)) {
 		printk(KERN_WARNING
@@ -1244,12 +1169,8 @@
 		return -EBUSY;
 	}
 
-	base = card->membase & PAGE_MASK;
-	page_offset = card->membase - base;
-	card->mbase = ioremap_nocache(base, page_offset + 128);
-	if (card->mbase) {
-		card->mbase += page_offset;
-	} else {
+	card->mbase = ioremap_nocache(card->membase, 128);
+	if (card->mbase == 0) {
 		printk(KERN_NOTICE "%s: can't remap memory at 0x%lx\n",
 					driver->name, card->membase);
 	        kfree(card->ctrlinfo);
@@ -1262,7 +1183,7 @@
 	if ((retval = c4_detect(card)) != 0) {
 		printk(KERN_NOTICE "%s: NO card at 0x%x (%d)\n",
 					driver->name, card->port, retval);
-                iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK));
+                iounmap(card->mbase);
 	        kfree(card->ctrlinfo);
 		kfree(card->dma);
 		kfree(card);
@@ -1277,7 +1198,7 @@
 	if (retval) {
 		printk(KERN_ERR "%s: unable to get IRQ %d.\n",
 				driver->name, card->irq);
-                iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK));
+                iounmap(card->mbase);
 		release_region(card->port, AVMB1_PORTLEN);
 	        kfree(card->ctrlinfo);
 		kfree(card->dma);
@@ -1286,7 +1207,7 @@
 		return -EBUSY;
 	}
 
-	for (i=0; i < 4; i++) {
+	for (i=0; i < nr ; i++) {
 		cinfo = &card->ctrlinfo[i];
 		cinfo->card = card;
 		cinfo->capi_ctrl = di->attach_ctr(driver, card->name, cinfo);
@@ -1297,7 +1218,7 @@
 				cinfo = &card->ctrlinfo[i];
 				di->detach_ctr(cinfo->capi_ctrl);
 			}
-                	iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK));
+                	iounmap(card->mbase);
 			free_irq(card->irq, card);
 			release_region(card->port, AVMB1_PORTLEN);
 	        	kfree(card->dma);
@@ -1313,14 +1234,31 @@
 	skb_queue_head_init(&card->dma->send_queue);
 
 	printk(KERN_INFO
-		"%s: AVM C4 at i/o %#x, irq %d, mem %#lx\n",
-		driver->name, card->port, card->irq, card->membase);
+		"%s: AVM C%d at i/o %#x, irq %d, mem %#lx\n",
+		driver->name, nr, card->port, card->irq, card->membase);
 
 	return 0;
 }
 
 /* ------------------------------------------------------------- */
 
+static struct capi_driver c2_driver = {
+    name: "c2",
+    revision: "0.0",
+    load_firmware: c4_load_firmware,
+    reset_ctr: c4_reset_ctr,
+    remove_ctr: c4_remove_ctr,
+    register_appl: c4_register_appl,
+    release_appl: c4_release_appl,
+    send_message: c4_send_message,
+
+    procinfo: c4_procinfo,
+    ctr_read_proc: c4_read_proc,
+    driver_read_proc: 0,	/* use standard driver_read_proc */
+
+    add_card: 0, /* no add_card function */
+};
+
 static struct capi_driver c4_driver = {
     name: "c4",
     revision: "0.0",
@@ -1340,15 +1278,9 @@
 
 static int ncards = 0;
 
-static int __init c4_init(void)
+static int c4_attach_driver (struct capi_driver * driver)
 {
-	struct capi_driver *driver = &c4_driver;
-	struct pci_dev *dev = NULL;
 	char *p;
-	int retval;
-
-	MOD_INC_USE_COUNT;
-
 	if ((p = strchr(revision, ':')) != 0 && p[1]) {
 		strncpy(driver->revision, p + 2, sizeof(driver->revision));
 		driver->revision[sizeof(driver->revision)-1] = 0;
@@ -1359,65 +1291,101 @@
 	printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
 
         di = attach_capi_driver(driver);
-
 	if (!di) {
 		printk(KERN_ERR "%s: failed to attach capi_driver\n",
 				driver->name);
 		MOD_DEC_USE_COUNT;
-		return -EIO;
+		return -ENODEV;
 	}
+	return 0;
+}
 
-#ifdef CONFIG_PCI
-	if (!pci_present()) {
-		printk(KERN_ERR "%s: no PCI bus present\n", driver->name);
-    		detach_capi_driver(driver);
-		MOD_DEC_USE_COUNT;
-		return -EIO;
-	}
+static int __init search_cards(struct capi_driver * driver,
+				int pci_id, int nr)
+{
+	struct pci_dev *	dev	= NULL;
+	int			retval	= 0;
 
 	while ((dev = pci_find_subsys(
 			PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21285,
-			PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_C4, dev))) {
+			PCI_VENDOR_ID_AVM, pci_id, dev))) {
 		struct capicardparams param;
 
+		if (pci_enable_device(dev) < 0) {
+		        printk(KERN_ERR "%s: failed to enable AVM-C%d\n",
+			       driver->name, nr);
+			continue;
+		}
+		pci_set_master(dev);
+
 		param.port = dev->base_address[ 1] & PCI_BASE_ADDRESS_IO_MASK;
 		param.irq = dev->irq;
 		param.membase = dev->base_address[ 0] & PCI_BASE_ADDRESS_MEM_MASK;
-
-
+  
 		printk(KERN_INFO
-			"%s: PCI BIOS reports AVM-C4 at i/o %#x, irq %d, mem %#x\n",
-			driver->name, param.port, param.irq, param.membase);
-		retval = c4_add_card(driver, &param);
+			"%s: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x\n",
+			driver->name, nr, param.port, param.irq, param.membase);
+		retval = c4_add_card(driver, &param, nr);
 		if (retval != 0) {
 		        printk(KERN_ERR
-			"%s: no AVM-C4 at i/o %#x, irq %d detected, mem %#x\n",
-			driver->name, param.port, param.irq, param.membase);
-    			detach_capi_driver(driver);
-			MOD_DEC_USE_COUNT;
-			return retval;
+			"%s: no AVM-C%d at i/o %#x, irq %d detected, mem %#x\n",
+			driver->name, nr, param.port, param.irq, param.membase);
+			continue;
 		}
 		ncards++;
 	}
+	return retval;
+}
+
+static int __init c4_init(void)
+{
+	int retval;
+
+	MOD_INC_USE_COUNT;
+
+	retval = c4_attach_driver (&c4_driver);
+	if (retval) {
+		MOD_DEC_USE_COUNT;
+		return retval;
+	}
+
+	retval = c4_attach_driver (&c2_driver);
+	if (retval) {
+		MOD_DEC_USE_COUNT;
+		return retval;
+	}
+
+	retval = search_cards(&c4_driver, PCI_DEVICE_ID_AVM_C4, 4);
+	if (retval && ncards == 0) {
+    		detach_capi_driver(&c2_driver);
+    		detach_capi_driver(&c4_driver);
+		MOD_DEC_USE_COUNT;
+		return retval;
+	}
+	retval = search_cards(&c2_driver, 0x1100, 2);
+	if (retval && ncards == 0) {
+    		detach_capi_driver(&c2_driver);
+    		detach_capi_driver(&c4_driver);
+		MOD_DEC_USE_COUNT;
+		return retval;
+	}
+
 	if (ncards) {
-		printk(KERN_INFO "%s: %d C4 card(s) detected\n",
-				driver->name, ncards);
+		printk(KERN_INFO "%s: %d C4/C2 card(s) detected\n",
+				c4_driver.name, ncards);
 		MOD_DEC_USE_COUNT;
 		return 0;
 	}
-	printk(KERN_ERR "%s: NO C4 card detected\n", driver->name);
-	detach_capi_driver(driver);
+	printk(KERN_ERR "%s: NO C4/C2 card detected\n", c4_driver.name);
+	detach_capi_driver(&c4_driver);
+	detach_capi_driver(&c2_driver);
 	MOD_DEC_USE_COUNT;
-	return -ESRCH;
-#else
-	printk(KERN_ERR "%s: kernel not compiled with PCI.\n", driver->name);
-	MOD_DEC_USE_COUNT;
-	return -EIO;
-#endif
+	return -ENODEV;
 }
 
 static void  c4_exit(void)
 {
+    detach_capi_driver(&c2_driver);
     detach_capi_driver(&c4_driver);
 }
 
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/capi.c linux/drivers/isdn/avmb1/capi.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/capi.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/capi.c	Mon Dec  3 22:19:41 2001
@@ -1,235 +1,10 @@
 /*
- * $Id: capi.c,v 1.44.6.8 2001/03/21 08:52:21 kai Exp $
+ * $Id: capi.c,v 1.44.6.12 2001/06/09 15:14:15 kai Exp $
  *
  * CAPI 2.0 Interface for Linux
  *
  * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
  *
- * $Log: capi.c,v $
- * Revision 1.44.6.8  2001/03/21 08:52:21  kai
- * merge from main branch: fix buffer for revision string (calle)
- *
- * Revision 1.44.6.7  2001/03/15 15:11:24  kai
- * *** empty log message ***
- *
- * Revision 1.44.6.6  2001/03/13 16:17:07  kai
- * spelling fixes from 2.4.3-pre
- *
- * Revision 1.44.6.5  2001/02/13 11:43:29  kai
- * more compatility changes for 2.2.19
- *
- * Revision 1.44.6.4  2001/02/10 14:41:20  kai
- * Changes from kernel tree
- *
- * Revision 1.44.6.3  2000/12/17 22:45:08  kai
- * That's hopefully it for test13-4
- *
- * Revision 1.44.6.2  2000/12/14 23:04:12  kai
- * Makefile changes and the like for 2.4.0-test13-pre1
- * No compatiblity code for older kernels yet, but note the branch
- *
- * Revision 1.45  2000/12/02 19:47:29  kai
- * Change the Makefiles to new style.
- * There may be problems there that I missed, so this shouldn't go into
- * an offical kernel any time soon.
- * However, if I didn't commit it, we wouldn't find the bugs...
- *
- * Revision 1.44  2000/11/25 17:00:59  kai
- * compatibility cleanup - final part for the time being
- *
- * Revision 1.43  2000/11/23 20:45:14  kai
- * fixed module_init/exit stuff
- * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
- *
- * Revision 1.42  2000/11/19 17:03:55  kai
- * compatibility cleanup - part 5
- *
- * Revision 1.41  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.40  2000/10/24 15:15:04  calle
- * Workaround: pppd calls restoretty before reseting the ldisc and
- *   ldisc "ppp_sync" didn't support this. So we call n_tty_ioctl
- *   in the driver ioctl function. (remember: driver ioctl function is
- *   only called if ldisc ioctl function did not handle the call)
- *
- * Revision 1.39  2000/07/24 13:42:50  calle
- * - lock_kernel/unlock_kernel for _release functions. (from 2.4)
- *
- * Revision 1.38  2000/07/24 08:49:09  calle
- * - Bugfix: capiminor_del_all_ack completely wrong :-(
- *
- * Revision 1.37  2000/07/20 10:22:27  calle
- * - Made procfs function cleaner and removed variable "begin".
- *
- * Revision 1.36  2000/06/29 13:59:35  calle
- * - call to devfs_register was wrong
- *
- * Revision 1.35  2000/06/19 15:11:24  keil
- * avoid use of freed structs
- * changes from 2.4.0-ac21
- *
- * Revision 1.34  2000/06/18 16:09:54  keil
- * more changes for 2.4
- *
- * Revision 1.33  2000/05/18 16:35:43  calle
- * Uaaahh. Bad memory leak fixed.
- *
- * Revision 1.32  2000/04/21 12:38:42  calle
- * Bugfix: error in proc_ functions, begin-off => off-begin
- *
- * Revision 1.31  2000/04/03 13:29:24  calle
- * make Tim Waugh happy (module unload races in 2.3.99-pre3).
- * no real problem there, but now it is much cleaner ...
- *
- * Revision 1.30  2000/03/19 12:31:36  calle
- * PPP over CAPI raw driver disabled for now, ppp_generic has been changed.
- *
- * Revision 1.29  2000/03/13 17:48:13  calle
- * removed unused variable.
- *
- * Revision 1.28  2000/03/08 17:06:33  calle
- * - changes for devfs and 2.3.49
- * - capifs now configurable (no need with devfs)
- * - New Middleware ioctl CAPI_NCCI_GETUNIT
- * - Middleware again tested with 2.2.14 and 2.3.49 (with and without devfs)
- *
- * Revision 1.27  2000/03/06 18:00:23  calle
- * - Middleware extention now working with 2.3.49 (capifs).
- * - Fixed typos in debug section of capi.c
- * - Bugfix: Makefile corrected for b1pcmcia.c
- *
- * Revision 1.26  2000/03/03 16:48:38  calle
- * - Added CAPI2.0 Middleware support (CONFIG_ISDN_CAPI)
- *   It is now possible to create a connection with a CAPI2.0 applikation
- *   and than to handle the data connection from /dev/capi/ (capifs) and also
- *   using async or sync PPP on this connection.
- *   The two major device number 190 and 191 are not confirmed yet,
- *   but I want to save the code in cvs, before I go on.
- *
- * Revision 1.25  2000/03/03 16:37:11  kai
- * incorporated some cosmetic changes from the official kernel tree back
- * into CVS
- *
- * Revision 1.24  2000/03/03 15:50:42  calle
- * - kernel CAPI:
- *   - Changed parameter "param" in capi_signal from __u32 to void *.
- *   - rewrote notifier handling in kcapi.c
- *   - new notifier NCCI_UP and NCCI_DOWN
- * - User CAPI:
- *   - /dev/capi20 is now a cloning device.
- *   - middleware extentions prepared.
- * - capidrv.c
- *   - locking of list operations and module count updates.
- *
- * Revision 1.23  2000/02/26 01:00:53  keil
- * changes from 2.3.47
- *
- * Revision 1.22  1999/11/13 21:27:16  keil
- * remove KERNELVERSION
- *
- * Revision 1.21  1999/09/10 17:24:18  calle
- * Changes for proposed standard for CAPI2.0:
- * - AK148 "Linux Exention"
- *
- * Revision 1.20  1999/09/07 09:02:53  calle
- * SETDATA removed. Now inside the kernel the datapart of DATA_B3_REQ and
- * DATA_B3_IND is always directly after the CAPI message. The "Data" member
- * ist never used inside the kernel.
- *
- * Revision 1.19  1999/07/09 15:05:42  keil
- * compat.h is now isdn_compat.h
- *
- * Revision 1.18  1999/07/06 07:42:01  calle
- * - changes in /proc interface
- * - check and changed calls to [dev_]kfree_skb and [dev_]alloc_skb.
- *
- * Revision 1.17  1999/07/01 15:26:30  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
- * Revision 1.16  1999/07/01 08:22:57  keil
- * compatibility macros now in <linux/isdn_compat.h>
- *
- * Revision 1.15  1999/06/21 15:24:11  calle
- * extend information in /proc.
- *
- * Revision 1.14  1999/06/10 16:51:03  calle
- * Bugfix: open/release of control device was not handled correct.
- *
- * Revision 1.13  1998/08/28 04:32:25  calle
- * Added patch send by Michael.Mueller4@post.rwth-aachen.de, to get AVM B1
- * driver running with 2.1.118.
- *
- * Revision 1.12  1998/05/26 22:39:34  he
- * sync'ed with 2.1.102 where appropriate (CAPABILITY changes)
- * concap typo
- * cleared dev.tbusy in isdn_net BCONN status callback
- *
- * Revision 1.11  1998/03/09 17:46:37  he
- * merged in 2.1.89 changes
- *
- * Revision 1.10  1998/02/13 07:09:13  calle
- * change for 2.1.86 (removing FREE_READ/FREE_WRITE from [dev]_kfree_skb()
- *
- * Revision 1.9  1998/01/31 11:14:44  calle
- * merged changes to 2.0 tree, prepare 2.1.82 to work.
- *
- * Revision 1.8  1997/11/04 06:12:08  calle
- * capi.c: new read/write in file_ops since 2.1.60
- * capidrv.c: prepared isdnlog interface for d2-trace in newer firmware.
- * capiutil.c: needs config.h (CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON)
- * compat.h: added #define LinuxVersionCode
- *
- * Revision 1.7  1997/10/11 10:29:34  calle
- * llseek() parameters changed in 2.1.56.
- *
- * Revision 1.6  1997/10/01 09:21:15  fritz
- * Removed old compatibility stuff for 2.0.X kernels.
- * From now on, this code is for 2.1.X ONLY!
- * Old stuff is still in the separate branch.
- *
- * Revision 1.5  1997/08/21 23:11:55  fritz
- * Added changes for kernels >= 2.1.45
- *
- * Revision 1.4  1997/05/27 15:17:50  fritz
- * Added changes for recent 2.1.x kernels:
- *   changed return type of isdn_close
- *   queue_task_* -> queue_task
- *   clear/set_bit -> test_and_... where apropriate.
- *   changed type of hard_header_cache parameter.
- *
- * Revision 1.3  1997/05/18 09:24:14  calle
- * added verbose disconnect reason reporting to avmb1.
- * some fixes in capi20 interface.
- * changed info messages for B1-PCI
- *
- * Revision 1.2  1997/03/05 21:17:59  fritz
- * Added capi_poll for compiling under 2.1.27
- *
- * Revision 1.1  1997/03/04 21:50:29  calle
- * Frirst version in isdn4linux
- *
- * Revision 2.2  1997/02/12 09:31:39  calle
- * new version
- *
- * Revision 1.1  1997/01/31 10:32:20  calle
- * Initial revision
- *
  */
 
 #include <linux/config.h>
@@ -268,7 +43,7 @@
 #include "capifs.h"
 #endif
 
-static char *revision = "$Revision: 1.44.6.8 $";
+static char *revision = "$Revision: 1.44.6.12 $";
 
 MODULE_AUTHOR("Carsten Paeth (calle@calle.in-berlin.de)");
 
@@ -475,7 +250,6 @@
 void capiminor_free(struct capiminor *mp)
 {
 	struct capiminor **pp;
-	struct sk_buff *skb;
 
 	pp = &minors;
 	while (*pp) {
@@ -483,12 +257,9 @@
 			*pp = (*pp)->next;
 			if (mp->ttyskb) kfree_skb(mp->ttyskb);
 			mp->ttyskb = 0;
-			while ((skb = skb_dequeue(&mp->recvqueue)) != 0)
-				kfree_skb(skb);
-			while ((skb = skb_dequeue(&mp->inqueue)) != 0)
-				kfree_skb(skb);
-			while ((skb = skb_dequeue(&mp->outqueue)) != 0)
-				kfree_skb(skb);
+			skb_queue_purge(&mp->recvqueue);
+			skb_queue_purge(&mp->inqueue);
+			skb_queue_purge(&mp->outqueue);
 			capiminor_del_all_ack(mp);
 			kfree(mp);
 			MOD_DEC_USE_COUNT;
@@ -527,9 +298,6 @@
 	memset(np, 0, sizeof(struct capincci));
 	np->ncci = ncci;
 	np->cdev = cdev;
-	for (pp=&cdev->nccis; *pp; pp = &(*pp)->next)
-		;
-	*pp = np;
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
 	mp = 0;
 	if (cdev->userflags & CAPIFLAG_HIGHJACKING)
@@ -547,6 +315,9 @@
 #endif
 	}
 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
+	for (pp=&cdev->nccis; *pp; pp = &(*pp)->next)
+		;
+	*pp = np;
         return np;
 }
 
@@ -630,15 +401,12 @@
 static void capidev_free(struct capidev *cdev)
 {
 	struct capidev **pp;
-	struct sk_buff *skb;
 
 	if (cdev->applid)
 		(*capifuncs->capi_release) (cdev->applid);
 	cdev->applid = 0;
 
-	while ((skb = skb_dequeue(&cdev->recvqueue)) != 0) {
-		kfree_skb(skb);
-	}
+	skb_queue_purge(&cdev->recvqueue);
 	
 	pp=&capidev_openlist;
 	while (*pp && *pp != cdev) pp = &(*pp)->next;
@@ -995,6 +763,8 @@
 		return -ENODEV;
 
 	skb = alloc_skb(count, GFP_USER);
+	if (!skb)
+		return -ENOMEM;
 
 	if ((retval = copy_from_user(skb_put(skb, count), buf, count))) {
 		kfree_skb(skb);
@@ -1325,6 +1095,7 @@
 #ifdef _DEBUG_REFCOUNT
 	printk(KERN_DEBUG "capi_raw_open %d\n", GET_USE_COUNT(&__this_module));
 #endif
+
 	mp->datahandle = 0;
 	mp->file = file;
 	file->private_data = (void *)mp;
@@ -1410,6 +1181,8 @@
 		return -EINVAL;
 
 	skb = alloc_skb(CAPI_DATA_B3_REQ_LEN+count, GFP_USER);
+	if (!skb)
+		return -ENOMEM;
 
 	skb_reserve(skb, CAPI_DATA_B3_REQ_LEN);
 	if ((retval = copy_from_user(skb_put(skb, count), buf, count))) {
@@ -2042,6 +1815,7 @@
 static int __init capi_init(void)
 {
 	char *p;
+	char *compileinfo;
 
 	MOD_INC_USE_COUNT;
 
@@ -2092,8 +1866,17 @@
 
 	(void)proc_init();
 
-	printk(KERN_NOTICE "capi20: Rev%s: started up with major %d\n",
-				rev, capi_major);
+#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
+#if defined(CONFIG_ISDN_CAPI_CAPIFS) || defined(CONFIG_ISDN_CAPI_CAPIFS_MODULE)
+        compileinfo = " (middleware+capifs)";
+#else
+        compileinfo = " (no capifs)";
+#endif
+#else
+        compileinfo = " (no middleware)";
+#endif
+	printk(KERN_NOTICE "capi20: Rev %s: started up with major %d%s\n",
+				rev, capi_major, compileinfo);
 
 	MOD_DEC_USE_COUNT;
 	return 0;
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/capicmd.h linux/drivers/isdn/avmb1/capicmd.h
--- linux-2.2.20-pre5/drivers/isdn/avmb1/capicmd.h	Sun Mar 25 08:37:32 2001
+++ linux/drivers/isdn/avmb1/capicmd.h	Mon Dec  3 22:19:41 2001
@@ -1,31 +1,9 @@
 /*
- * $Id: capicmd.h,v 1.2 2000/03/03 15:50:42 calle Exp $
+ * $Id: capicmd.h,v 1.2.6.1 2001/05/17 20:41:51 kai Exp $
  * 
  * CAPI 2.0 Interface for Linux
  * 
  * Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
- * 
- * $Log: capicmd.h,v $
- * Revision 1.2  2000/03/03 15:50:42  calle
- * - kernel CAPI:
- *   - Changed parameter "param" in capi_signal from __u32 to void *.
- *   - rewrote notifier handling in kcapi.c
- *   - new notifier NCCI_UP and NCCI_DOWN
- * - User CAPI:
- *   - /dev/capi20 is now a cloning device.
- *   - middleware extentions prepared.
- * - capidrv.c
- *   - locking of list operations and module count updates.
- *
- * Revision 1.1  1997/03/04 21:50:30  calle
- * Frirst version in isdn4linux
- *
- * Revision 2.2  1997/02/12 09:31:39  calle
- * new version
- *
- * Revision 1.1  1997/01/31 10:32:20  calle
- * Initial revision
- *
  * 
  */
 #ifndef __CAPICMD_H__
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/capidev.h linux/drivers/isdn/avmb1/capidev.h
--- linux-2.2.20-pre5/drivers/isdn/avmb1/capidev.h	Sun Mar 25 08:37:32 2001
+++ linux/drivers/isdn/avmb1/capidev.h	Mon Dec  3 22:19:41 2001
@@ -1,55 +1,9 @@
 /*
- * $Id: capidev.h,v 1.6 2000/11/25 17:00:59 kai Exp $
+ * $Id: capidev.h,v 1.6.6.1 2001/05/17 20:41:51 kai Exp $
  *
  * CAPI 2.0 Interface for Linux
  *
  * (c) Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
- *
- * $Log: capidev.h,v $
- * Revision 1.6  2000/11/25 17:00:59  kai
- * compatibility cleanup - final part for the time being
- *
- * Revision 1.5  2000/03/03 15:50:42  calle
- * - kernel CAPI:
- *   - Changed parameter "param" in capi_signal from __u32 to void *.
- *   - rewrote notifier handling in kcapi.c
- *   - new notifier NCCI_UP and NCCI_DOWN
- * - User CAPI:
- *   - /dev/capi20 is now a cloning device.
- *   - middleware extentions prepared.
- * - capidrv.c
- *   - locking of list operations and module count updates.
- *
- * Revision 1.4  1999/07/01 15:26:32  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
- * Revision 1.3  1999/07/01 08:22:58  keil
- * compatibility macros now in <linux/isdn_compat.h>
- *
- * Revision 1.2  1999/06/21 15:24:13  calle
- * extend information in /proc.
- *
- * Revision 1.1  1997/03/04 21:50:30  calle
- * Frirst version in isdn4linux
- *
- * Revision 2.2  1997/02/12 09:31:39  calle
- * new version
- *
- * Revision 1.1  1997/01/31 10:32:20  calle
- * Initial revision
  *
  */
 
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/capidrv.c linux/drivers/isdn/avmb1/capidrv.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/capidrv.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/capidrv.c	Mon Dec  3 22:19:41 2001
@@ -1,208 +1,10 @@
 /*
- * $Id: capidrv.c,v 1.39.6.4 2001/03/21 08:52:21 kai Exp $
+ * $Id: capidrv.c,v 1.39.6.6 2001/05/17 20:41:51 kai Exp $
  *
  * ISDN4Linux Driver, using capi20 interface (kernelcapi)
  *
  * Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
  *
- * $Log: capidrv.c,v $
- * Revision 1.39.6.4  2001/03/21 08:52:21  kai
- * merge from main branch: fix buffer for revision string (calle)
- *
- * Revision 1.39.6.3  2001/03/13 16:17:07  kai
- * spelling fixes from 2.4.3-pre
- *
- * Revision 1.39.6.2  2001/02/13 11:43:29  kai
- * more compatility changes for 2.2.19
- *
- * Revision 1.39.6.1  2001/02/10 14:41:20  kai
- * Changes from kernel tree
- *
- * Revision 1.39  2000/11/23 20:45:14  kai
- * fixed module_init/exit stuff
- * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
- *
- * Revision 1.38  2000/11/14 08:43:07  calle
- * Bugfix for v110. Connectparamters where setup for sync ...
- *
- * Revision 1.37  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.36  2000/06/26 15:13:41  keil
- * features should be or'ed
- *
- * Revision 1.35  2000/06/19 15:11:25  keil
- * avoid use of freed structs
- * changes from 2.4.0-ac21
- *
- * Revision 1.34  2000/06/19 13:13:55  calle
- * Added Modemsupport!
- *
- * Revision 1.33  2000/05/06 00:52:36  kai
- * merged changes from kernel tree
- * fixed timer and net_device->name breakage
- *
- * Revision 1.32  2000/04/07 15:19:58  calle
- * remove warnings
- *
- * Revision 1.31  2000/04/06 15:01:25  calle
- * Bugfix: crash in capidrv.c when reseting a capi controller.
- * - changed code order on remove of controller.
- * - using tq_schedule for notifier in kcapi.c.
- * - now using spin_lock_irqsave() and spin_unlock_irqrestore().
- * strange: sometimes even MP hang on unload of isdn.o ...
- *
- * Revision 1.30  2000/03/03 15:50:42  calle
- * - kernel CAPI:
- *   - Changed parameter "param" in capi_signal from __u32 to void *.
- *   - rewrote notifier handling in kcapi.c
- *   - new notifier NCCI_UP and NCCI_DOWN
- * - User CAPI:
- *   - /dev/capi20 is now a cloning device.
- *   - middleware extentions prepared.
- * - capidrv.c
- *   - locking of list operations and module count updates.
- *
- * Revision 1.29  1999/12/06 17:13:06  calle
- * Added controller watchdog.
- *
- * Revision 1.28  1999/11/05 16:22:37  calle
- * Bugfix: Missing break in switch on ISDN_CMD_HANGUP.
- *
- * Revision 1.27  1999/09/16 15:13:04  calle
- * forgot to change paramter type of contr for lower_callback ...
- *
- * Revision 1.26  1999/08/06 07:41:16  calle
- * Added the "vbox patch". if (si1 == 1) si2 = 0;
- *
- * Revision 1.25  1999/08/04 10:10:11  calle
- * Bugfix: corrected /proc functions, added structure for new AVM cards.
- *
- * Revision 1.24  1999/07/20 06:48:02  calle
- * Bugfix: firmware version check for D2 trace was too restrictiv.
- *
- * Revision 1.23  1999/07/09 15:05:44  keil
- * compat.h is now isdn_compat.h
- *
- * Revision 1.22  1999/07/06 07:24:14  calle
- * Bugfix: call to kfree_skb in capidrv_signal was too early,
- *         thanks to Lars Heete <hel@admin.de>.
- *
- * Revision 1.21  1999/07/01 15:26:34  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
- * Revision 1.20  1999/07/01 08:22:59  keil
- * compatibility macros now in <linux/isdn_compat.h>
- *
- * Revision 1.19  1999/06/29 16:16:54  calle
- * Let ISDN_CMD_UNLOAD work with open isdn devices without crash again.
- * Also right unlocking (ISDN_CMD_UNLOCK) is done now.
- * isdnlog should check returncode of read(2) calls.
- *
- * Revision 1.18  1999/06/21 15:24:15  calle
- * extend information in /proc.
- *
- * Revision 1.17  1999/06/10 16:53:55  calle
- * Removing of module b1pci will now remove card from lower level.
- *
- * Revision 1.16  1999/05/31 11:50:33  calle
- * Bugfix: In if_sendbuf, skb_push'ed DATA_B3 header was not skb_pull'ed
- *         on failure, result in data block with DATA_B3 header transmitted
- *
- * Revision 1.15  1999/05/25 21:26:16  calle
- * Include CAPI-Channelallocation (leased lines) from the 2.0 tree.
- *
- * Revision 1.14  1999/05/22 07:55:06  calle
- * Added *V110* to AVM B1 driver.
- *
- * Revision 1.13  1998/06/26 15:12:55  fritz
- * Added handling of STAT_ICALL with incomplete CPN.
- * Added AT&L for ttyI emulator.
- * Added more locking stuff in tty_write.
- *
- * Revision 1.12  1998/03/29 16:06:03  calle
- * changes from 2.0 tree merged.
- *
- * Revision 1.3.2.10  1998/03/20 14:38:24  calle
- * capidrv: prepared state machines for suspend/resume/hold
- * capidrv: fix bug in state machine if B1/T1 is out of nccis
- * b1capi: changed some errno returns.
- * b1capi: detect if you try to add same T1 to different io address.
- * b1capi: change number of nccis depending on number of channels.
- * b1lli: cosmetics
- *
- * Revision 1.3.2.9  1998/03/20 09:01:12  calle
- * Changes capi_register handling to get full support for 30 bchannels.
- *
- * Revision 1.3.2.8  1998/03/18 17:51:28  calle
- * added controller number to error messages
- *
- * Revision 1.3.2.7  1998/02/27 15:40:47  calle
- * T1 running with slow link. bugfix in capi_release.
- *
- * Revision 1.11  1998/02/13 07:09:15  calle
- * change for 2.1.86 (removing FREE_READ/FREE_WRITE from [dev]_kfree_skb()
- *
- * Revision 1.10  1998/02/02 19:52:23  calle
- * Fixed vbox (audio) acceptb.
- *
- * Revision 1.9  1998/01/31 11:14:45  calle
- * merged changes to 2.0 tree, prepare 2.1.82 to work.
- *
- * Revision 1.8  1997/11/04 06:12:09  calle
- * capi.c: new read/write in file_ops since 2.1.60
- * capidrv.c: prepared isdnlog interface for d2-trace in newer firmware.
- * capiutil.c: needs config.h (CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON)
- * compat.h: added #define LinuxVersionCode
- *
- * Revision 1.7  1997/10/11 10:36:34  calle
- * Added isdnlog support. patch to isdnlog needed.
- *
- * Revision 1.6  1997/10/11 10:25:55  calle
- * New interface for lowlevel drivers. BSENT with nr. of bytes sent,
- * allow sending without ACK.
- *
- * Revision 1.5  1997/10/01 09:21:16  fritz
- * Removed old compatibility stuff for 2.0.X kernels.
- * From now on, this code is for 2.1.X ONLY!
- * Old stuff is still in the separate branch.
- *
- * Revision 1.4  1997/07/13 12:22:43  calle
- * bug fix for more than one controller in connect_req.
- * debugoutput now with contrnr.
- *
- * Revision 1.3  1997/05/18 09:24:15  calle
- * added verbose disconnect reason reporting to avmb1.
- * some fixes in capi20 interface.
- * changed info messages for B1-PCI
- *
- * Revision 1.2  1997/03/05 21:19:59  fritz
- * Removed include of config.h (mkdep stated this is unneded).
- *
- * Revision 1.1  1997/03/04 21:50:31  calle
- * Frirst version in isdn4linux
- *
- * Revision 2.2  1997/02/12 09:31:39  calle
- * new version
- *
- * Revision 1.1  1997/01/31 10:32:20  calle
- * Initial revision
- *
  */
 
 #include <linux/module.h>
@@ -231,7 +33,7 @@
 #include "capicmd.h"
 #include "capidrv.h"
 
-static char *revision = "$Revision: 1.39.6.4 $";
+static char *revision = "$Revision: 1.39.6.6 $";
 static int debugmode = 0;
 
 MODULE_AUTHOR("Carsten Paeth <calle@calle.in-berlin.de>");
@@ -2069,8 +1871,8 @@
 	__u16 datahandle;
 
 	if (!card) {
-		printk(KERN_ERR "capidrv-%d: if_sendbuf called with invalid driverId %d!\n",
-		       card->contrnr, id);
+		printk(KERN_ERR "capidrv: if_sendbuf called with invalid driverId %d!\n",
+		       id);
 		return 0;
 	}
 	if (debugmode > 1)
@@ -2139,8 +1941,8 @@
 	__u8 *p;
 
 	if (!card) {
-		printk(KERN_ERR "capidrv-%d: if_readstat called with invalid driverId %d!\n",
-		       card->contrnr, id);
+		printk(KERN_ERR "capidrv: if_readstat called with invalid driverId %d!\n",
+		       id);
 		return -ENODEV;
 	}
 
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/capidrv.h linux/drivers/isdn/avmb1/capidrv.h
--- linux-2.2.20-pre5/drivers/isdn/avmb1/capidrv.h	Sun Mar 25 08:31:37 2001
+++ linux/drivers/isdn/avmb1/capidrv.h	Mon Dec  3 22:19:41 2001
@@ -1,30 +1,9 @@
 /*
- * $Id: capidrv.h,v 1.2 1998/03/29 16:06:06 calle Exp $
+ * $Id: capidrv.h,v 1.2.8.1 2001/05/17 20:41:51 kai Exp $
  *
  * ISDN4Linux Driver, using capi20 interface (kernelcapi)
  *
  * Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
- *
- * $Log: capidrv.h,v $
- * Revision 1.2  1998/03/29 16:06:06  calle
- * changes from 2.0 tree merged.
- *
- * Revision 1.1.2.1  1998/03/20 14:38:28  calle
- * capidrv: prepared state machines for suspend/resume/hold
- * capidrv: fix bug in state machine if B1/T1 is out of nccis
- * b1capi: changed some errno returns.
- * b1capi: detect if you try to add same T1 to different io address.
- * b1capi: change number of nccis depending on number of channels.
- * b1lli: cosmetics
- *
- * Revision 1.1  1997/03/04 21:50:33  calle
- * Frirst version in isdn4linux
- *
- * Revision 2.2  1997/02/12 09:31:39  calle
- * new version
- *
- * Revision 1.1  1997/01/31 10:32:20  calle
- * Initial revision
  *
  */
 #ifndef __CAPIDRV_H__
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/capifs.c linux/drivers/isdn/avmb1/capifs.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/capifs.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/capifs.c	Mon Dec  3 22:19:41 2001
@@ -1,87 +1,10 @@
 /*
- * $Id: capifs.c,v 1.14.6.5 2001/03/21 08:52:21 kai Exp $
+ * $Id: capifs.c,v 1.14.6.7 2001/05/24 08:29:08 kai Exp $
  * 
  * (c) Copyright 2000 by Carsten Paeth (calle@calle.de)
  *
  * Heavily based on devpts filesystem from H. Peter Anvin
  * 
- * $Log: capifs.c,v $
- * Revision 1.14.6.5  2001/03/21 08:52:21  kai
- * merge from main branch: fix buffer for revision string (calle)
- *
- * Revision 1.14.6.4  2001/03/15 15:11:24  kai
- * *** empty log message ***
- *
- * Revision 1.14.6.3  2001/02/13 11:43:29  kai
- * more compatility changes for 2.2.19
- *
- * Revision 1.14.6.2  2001/02/10 14:41:20  kai
- * Changes from kernel tree
- *
- * Revision 1.14.6.1  2000/11/28 12:02:45  kai
- * MODULE_DEVICE_TABLE for 2.4
- *
- * Revision 1.14.2.1  2000/11/26 17:47:53  kai
- * added PCI_DEV_TABLE for 2.4
- *
- * Revision 1.14  2000/11/23 20:45:14  kai
- * fixed module_init/exit stuff
- * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
- *
- * Revision 1.13  2000/11/18 16:17:25  kai
- * change from 2.4 tree
- *
- * Revision 1.12  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.11  2000/10/24 15:08:47  calle
- * Too much includes.
- *
- * Revision 1.10  2000/10/12 10:12:35  calle
- * Bugfix: second iput(inode) on umount, destroies a foreign inode.
- *
- * Revision 1.9  2000/08/20 07:30:13  keil
- * changes for 2.4
- *
- * Revision 1.8  2000/07/20 10:23:13  calle
- * Include isdn_compat.h for people that don't use -p option of std2kern.
- *
- * Revision 1.7  2000/06/18 16:09:54  keil
- * more changes for 2.4
- *
- * Revision 1.6  2000/04/03 13:29:25  calle
- * make Tim Waugh happy (module unload races in 2.3.99-pre3).
- * no real problem there, but now it is much cleaner ...
- *
- * Revision 1.5  2000/03/13 17:49:52  calle
- * make it running with 2.3.51.
- *
- * Revision 1.4  2000/03/08 17:06:33  calle
- * - changes for devfs and 2.3.49
- * - capifs now configurable (no need with devfs)
- * - New Middleware ioctl CAPI_NCCI_GETUNIT
- * - Middleware again tested with 2.2.14 and 2.3.49 (with and without devfs)
- *
- * Revision 1.3  2000/03/06 18:00:23  calle
- * - Middleware extention now working with 2.3.49 (capifs).
- * - Fixed typos in debug section of capi.c
- * - Bugfix: Makefile corrected for b1pcmcia.c
- *
- * Revision 1.2  2000/03/06 09:17:07  calle
- * - capifs: fileoperations now in inode (change for 2.3.49)
- * - Config.in: Middleware extention not a tristate, uups.
- *
- * Revision 1.1  2000/03/03 16:48:38  calle
- * - Added CAPI2.0 Middleware support (CONFIG_ISDN_CAPI)
- *   It is now possible to create a connection with a CAPI2.0 applikation
- *   and than to handle the data connection from /dev/capi/ (capifs) and also
- *   using async or sync PPP on this connection.
- *   The two major device number 190 and 191 are not confirmed yet,
- *   but I want to save the code in cvs, before I go on.
- *
- *
  */
 
 #include <linux/version.h>
@@ -106,7 +29,7 @@
 
 MODULE_AUTHOR("Carsten Paeth <calle@calle.de>");
 
-static char *revision = "$Revision: 1.14.6.5 $";
+static char *revision = "$Revision: 1.14.6.7 $";
 
 struct capifs_ncci {
 	struct inode *inode;
@@ -286,24 +209,16 @@
 
 	kfree(sbi->nccis);
 	kfree(sbi);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,51)
 	MOD_DEC_USE_COUNT;
-#endif
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,51)
 static int capifs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz);
 static void capifs_write_inode(struct inode *inode) { };
-#else
-static int capifs_statfs(struct super_block *sb, struct statfs *buf);
-#endif
 static void capifs_read_inode(struct inode *inode);
 
 static struct super_operations capifs_sops = {
 	read_inode:	capifs_read_inode,
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,51)
 	write_inode:	capifs_write_inode,
-#endif
 	put_super:	capifs_put_super,
 	statfs:		capifs_statfs,
 };
@@ -374,10 +289,8 @@
 	struct dentry * root;
 	struct capifs_sb_info *sbi;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,51)
 	MOD_INC_USE_COUNT;
 	lock_super(s);
-#endif
 	/* Super block already completed? */
 	if (s->s_root)
 		goto out;
@@ -453,19 +366,14 @@
 	mounts = s;
 
 out:	/* Success ... somebody else completed the super block for us. */ 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,51)
 	unlock_super(s);
-#endif
 	return s;
 fail:
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,51)
 	unlock_super(s);
 	MOD_DEC_USE_COUNT;
-#endif
 	return NULL;
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,51)
 static int capifs_statfs(struct super_block *sb, struct statfs *buf, int bufsiz)
 {
 	struct statfs tmp;
@@ -480,20 +388,6 @@
 	tmp.f_namelen = NAME_MAX;
 	return copy_to_user(buf, &tmp, bufsiz) ? -EFAULT : 0;
 }
-#else
-static int capifs_statfs(struct super_block *sb, struct statfs *buf)
-{
-	buf->f_type = CAPIFS_SUPER_MAGIC;
-	buf->f_bsize = 1024;
-	buf->f_blocks = 0;
-	buf->f_bfree = 0;
-	buf->f_bavail = 0;
-	buf->f_files = 0;
-	buf->f_ffree = 0;
-	buf->f_namelen = NAME_MAX;
-	return 0;
-}
-#endif
 
 static void capifs_read_inode(struct inode *inode)
 {
@@ -524,16 +418,12 @@
 	return;
 }
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,51)
 static struct file_system_type capifs_fs_type = {
 	"capifs",
 	0,
 	capifs_read_super,
 	NULL
 };
-#else
-static DECLARE_FSTYPE(capifs_fs_type, "capifs", capifs_read_super, 0);
-#endif
 
 void capifs_new_ncci(char type, unsigned int num, kdev_t device)
 {
@@ -554,8 +444,7 @@
 				break;
 			}
 		}
-
-		if ((np->inode = iget(sb, ino+2)) != 0) {
+		if ((np->inode = iget(sb, ino+2)) != NULL) {
 			struct inode *inode = np->inode;
 			inode->i_uid = sbi->setuid ? sbi->uid : current->fsuid;
 			inode->i_gid = sbi->setgid ? sbi->gid : current->fsgid;
@@ -613,11 +502,7 @@
 		MOD_DEC_USE_COUNT;
 		return err;
 	}
-#ifdef MODULE
-        printk(KERN_NOTICE "capifs: Rev %s: loaded\n", rev);
-#else
-	printk(KERN_NOTICE "capifs: Rev %s: started\n", rev);
-#endif
+        printk(KERN_NOTICE "capifs: Rev %s\n", rev);
 	MOD_DEC_USE_COUNT;
 	return 0;
 }
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/capifs.h linux/drivers/isdn/avmb1/capifs.h
--- linux-2.2.20-pre5/drivers/isdn/avmb1/capifs.h	Sun Mar 25 08:37:32 2001
+++ linux/drivers/isdn/avmb1/capifs.h	Mon Dec  3 22:19:41 2001
@@ -1,23 +1,7 @@
 /*
- * $Id: capifs.h,v 1.2 2000/03/08 17:06:33 calle Exp $
+ * $Id: capifs.h,v 1.2.6.1 2001/05/17 20:41:51 kai Exp $
  * 
  * (c) Copyright 2000 by Carsten Paeth (calle@calle.de)
- *
- * $Log: capifs.h,v $
- * Revision 1.2  2000/03/08 17:06:33  calle
- * - changes for devfs and 2.3.49
- * - capifs now configurable (no need with devfs)
- * - New Middleware ioctl CAPI_NCCI_GETUNIT
- * - Middleware again tested with 2.2.14 and 2.3.49 (with and without devfs)
- *
- * Revision 1.1  2000/03/03 16:48:38  calle
- * - Added CAPI2.0 Middleware support (CONFIG_ISDN_CAPI)
- *   It is now possible to create a connection with a CAPI2.0 applikation
- *   and than to handle the data connection from /dev/capi/ (capifs) and also
- *   using async or sync PPP on this connection.
- *   The two major device number 190 and 191 are not confirmed yet,
- *   but I want to save the code in cvs, before I go on.
- *
  *
  */
 
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/capiutil.c linux/drivers/isdn/avmb1/capiutil.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/capiutil.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/capiutil.c	Mon Dec  3 22:19:41 2001
@@ -1,93 +1,10 @@
 /*
- * $Id: capiutil.c,v 1.13.6.2 2001/03/15 15:11:24 kai Exp $
+ * $Id: capiutil.c,v 1.13.6.3 2001/05/17 20:41:51 kai Exp $
  *
  * CAPI 2.0 convert capi message to capi message struct
  *
  * From CAPI 2.0 Development Kit AVM 1995 (msg.c)
  * Rewritten for Linux 1996 by Carsten Paeth (calle@calle.in-berlin.de)
- *
- * $Log: capiutil.c,v $
- * Revision 1.13.6.2  2001/03/15 15:11:24  kai
- * *** empty log message ***
- *
- * Revision 1.13.6.1  2001/02/13 11:43:29  kai
- * more compatility changes for 2.2.19
- *
- * Revision 1.13  2000/11/23 20:45:14  kai
- * fixed module_init/exit stuff
- * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
- *
- * Revision 1.12  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.11  2000/03/03 15:50:42  calle
- * - kernel CAPI:
- *   - Changed parameter "param" in capi_signal from __u32 to void *.
- *   - rewrote notifier handling in kcapi.c
- *   - new notifier NCCI_UP and NCCI_DOWN
- * - User CAPI:
- *   - /dev/capi20 is now a cloning device.
- *   - middleware extentions prepared.
- * - capidrv.c
- *   - locking of list operations and module count updates.
- *
- * Revision 1.10  1999/08/31 11:19:54  paul
- * various spelling corrections (new checksums may be needed, Karsten!)
- *
- * Revision 1.9  1999/07/09 15:05:46  keil
- * compat.h is now isdn_compat.h
- *
- * Revision 1.8  1999/07/01 15:26:37  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
- * Revision 1.7  1999/07/01 08:23:01  keil
- * compatibility macros now in <linux/isdn_compat.h>
- *
- * Revision 1.6  1997/11/04 06:12:12  calle
- * capi.c: new read/write in file_ops since 2.1.60
- * capidrv.c: prepared isdnlog interface for d2-trace in newer firmware.
- * capiutil.c: needs config.h (CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON)
- * compat.h: added #define LinuxVersionCode
- *
- * Revision 1.5  1997/10/01 09:21:19  fritz
- * Removed old compatibility stuff for 2.0.X kernels.
- * From now on, this code is for 2.1.X ONLY!
- * Old stuff is still in the separate branch.
- *
- * Revision 1.4  1997/08/10 07:43:55  calle
- * forgot to export symbol capi_info2str for 2.1.x
- *
- * Revision 1.3  1997/05/18 09:24:18  calle
- * added verbose disconnect reason reporting to avmb1.
- * some fixes in capi20 interface.
- * changed info messages for B1-PCI
- *
- * Revision 1.2  1997/03/05 21:22:13  fritz
- * Fix: Symbols have to be exported unconditionally.
- *
- * Revision 1.1  1997/03/04 21:50:34  calle
- * Frirst version in isdn4linux
- *
- * Revision 2.2  1997/02/12 09:31:39  calle
- * new version
- *
- * Revision 1.1  1997/01/31 10:32:20  calle
- * Initial revision
  *
  */
 #include <linux/module.h>
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/capiutil.h linux/drivers/isdn/avmb1/capiutil.h
--- linux-2.2.20-pre5/drivers/isdn/avmb1/capiutil.h	Sun Mar 25 08:37:32 2001
+++ linux/drivers/isdn/avmb1/capiutil.h	Mon Dec  3 22:19:41 2001
@@ -1,45 +1,10 @@
 /*
- * $Id: capiutil.h,v 1.5 2000/03/03 15:50:42 calle Exp $
+ * $Id: capiutil.h,v 1.5.6.1 2001/05/17 20:41:51 kai Exp $
  * 
  * CAPI 2.0 defines & types
  * 
  * From CAPI 2.0 Development Kit AVM 1995 (capi20.h)
  * Rewritten for Linux 1996 by Carsten Paeth (calle@calle.in-berlin.de)
- * 
- * $Log: capiutil.h,v $
- * Revision 1.5  2000/03/03 15:50:42  calle
- * - kernel CAPI:
- *   - Changed parameter "param" in capi_signal from __u32 to void *.
- *   - rewrote notifier handling in kcapi.c
- *   - new notifier NCCI_UP and NCCI_DOWN
- * - User CAPI:
- *   - /dev/capi20 is now a cloning device.
- *   - middleware extentions prepared.
- * - capidrv.c
- *   - locking of list operations and module count updates.
- *
- * Revision 1.4  1999/09/15 08:16:03  calle
- * Implementation of 64Bit extention complete.
- *
- * Revision 1.3  1999/09/07 09:02:53  calle
- * SETDATA removed. Now inside the kernel the datapart of DATA_B3_REQ and
- * DATA_B3_IND is always directly after the CAPI message. The "Data" member
- * ist never used inside the kernel.
- *
- * Revision 1.2  1997/05/18 09:24:19  calle
- * added verbose disconnect reason reporting to avmb1.
- * some fixes in capi20 interface.
- * changed info messages for B1-PCI
- *
- * Revision 1.1  1997/03/04 21:50:35  calle
- * Frirst version in isdn4linux
- *
- * Revision 2.2  1997/02/12 09:31:39  calle
- * new version
- *
- * Revision 1.1  1997/01/31 10:32:20  calle
- * Initial revision
- *
  * 
  */
 #ifndef __CAPIUTIL_H__
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/kcapi.c linux/drivers/isdn/avmb1/kcapi.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/kcapi.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/kcapi.c	Mon Dec  3 22:19:41 2001
@@ -1,128 +1,10 @@
 /*
- * $Id: kcapi.c,v 1.21.6.5 2001/03/21 08:52:21 kai Exp $
+ * $Id: kcapi.c,v 1.21.6.7 2001/06/09 15:14:15 kai Exp $
  * 
  * Kernel CAPI 2.0 Module
  * 
  * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
  * 
- * $Log: kcapi.c,v $
- * Revision 1.21.6.5  2001/03/21 08:52:21  kai
- * merge from main branch: fix buffer for revision string (calle)
- *
- * Revision 1.21.6.4  2001/03/15 15:11:24  kai
- * *** empty log message ***
- *
- * Revision 1.21.6.3  2001/03/13 16:17:08  kai
- * spelling fixes from 2.4.3-pre
- *
- * Revision 1.21.6.2  2001/02/13 11:43:29  kai
- * more compatility changes for 2.2.19
- *
- * Revision 1.21.6.1  2000/12/10 23:39:19  kai
- * in 2.4 we don't have tq_scheduler anymore.
- * also add one supported card to hfc_pci.c
- * (from main branch)
- *
- * Revision 1.21  2000/11/23 20:45:14  kai
- * fixed module_init/exit stuff
- * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
- *
- * Revision 1.20  2000/11/19 17:01:53  kai
- * compatibility cleanup - part 2
- *
- * Revision 1.19  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.18  2000/07/20 10:22:27  calle
- * - Made procfs function cleaner and removed variable "begin".
- *
- * Revision 1.17  2000/04/21 13:00:56  calle
- * Bugfix: driver_proc_info was also wrong.
- *
- * Revision 1.16  2000/04/21 12:38:42  calle
- * Bugfix: error in proc_ functions, begin-off => off-begin
- *
- * Revision 1.15  2000/04/06 15:01:25  calle
- * Bugfix: crash in capidrv.c when reseting a capi controller.
- * - changed code order on remove of controller.
- * - using tq_schedule for notifier in kcapi.c.
- * - now using spin_lock_irqsave() and spin_unlock_irqrestore().
- * strange: sometimes even MP hang on unload of isdn.o ...
- *
- * Revision 1.14  2000/04/03 13:29:25  calle
- * make Tim Waugh happy (module unload races in 2.3.99-pre3).
- * no real problem there, but now it is much cleaner ...
- *
- * Revision 1.13  2000/03/03 15:50:42  calle
- * - kernel CAPI:
- *   - Changed parameter "param" in capi_signal from __u32 to void *.
- *   - rewrote notifier handling in kcapi.c
- *   - new notifier NCCI_UP and NCCI_DOWN
- * - User CAPI:
- *   - /dev/capi20 is now a cloning device.
- *   - middleware extentions prepared.
- * - capidrv.c
- *   - locking of list operations and module count updates.
- *
- * Revision 1.12  2000/01/28 16:45:39  calle
- * new manufacturer command KCAPI_CMD_ADDCARD (generic addcard),
- * will search named driver and call the add_card function if one exist.
- *
- * Revision 1.11  1999/11/23 13:29:29  calle
- * Bugfix: incoming capi message were never traced.
- *
- * Revision 1.10  1999/10/26 15:30:32  calle
- * Generate error message if user want to add card, but driver module is
- * not loaded.
- *
- * Revision 1.9  1999/10/11 22:04:12  keil
- * COMPAT_NEED_UACCESS (no include in isdn_compat.h)
- *
- * Revision 1.8  1999/09/10 17:24:18  calle
- * Changes for proposed standard for CAPI2.0:
- * - AK148 "Linux Exention"
- *
- * Revision 1.7  1999/09/04 06:20:05  keil
- * Changes from kernel set_current_state()
- *
- * Revision 1.6  1999/07/20 06:41:49  calle
- * Bugfix: After the redesign of the AVM B1 driver, the driver didn't even
- *         compile, if not selected as modules.
- *
- * Revision 1.5  1999/07/09 15:05:48  keil
- * compat.h is now isdn_compat.h
- *
- * Revision 1.4  1999/07/08 14:15:17  calle
- * Forgot to count down ncards in drivercb_detach_ctr.
- *
- * Revision 1.3  1999/07/06 07:42:02  calle
- * - changes in /proc interface
- * - check and changed calls to [dev_]kfree_skb and [dev_]alloc_skb.
- *
- * Revision 1.2  1999/07/05 15:09:52  calle
- * - renamed "appl_release" to "appl_released".
- * - version und profile data now cleared on controller reset
- * - extended /proc interface, to allow driver and controller specific
- *   informations to include by driver hackers.
- *
- * Revision 1.1  1999/07/01 15:26:42  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
  */
 #define CONFIG_AVMB1_COMPAT
 
@@ -149,7 +31,7 @@
 #include <linux/b1lli.h>
 #endif
 
-static char *revision = "$Revision: 1.21.6.5 $";
+static char *revision = "$Revision: 1.21.6.7 $";
 
 /* ------------------------------------------------------------- */
 
@@ -1245,14 +1127,12 @@
 
 static __u16 capi_release(__u16 applid)
 {
-	struct sk_buff *skb;
 	int i;
 
 	if (!VALID_APPLID(applid) || APPL(applid)->releasing)
 		return CAPI_ILLAPPNR;
 	APPL(applid)->releasing++;
-	while ((skb = skb_dequeue(&APPL(applid)->recv_queue)) != 0)
-		kfree_skb(skb);
+	skb_queue_purge(&APPL(applid)->recv_queue);
 	for (i = 0; i < CAPI_MAXCONTR; i++) {
 		if (cards[i].cardstate != CARD_RUNNING)
 			continue;
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/t1isa.c linux/drivers/isdn/avmb1/t1isa.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/t1isa.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/t1isa.c	Mon Dec  3 22:19:41 2001
@@ -1,104 +1,10 @@
 /*
- * $Id: t1isa.c,v 1.16.6.4 2001/03/21 08:52:21 kai Exp $
+ * $Id: t1isa.c,v 1.16.6.6 2001/05/17 21:15:33 kai Exp $
  * 
  * Module for AVM T1 HEMA-card.
  * 
  * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
  * 
- * $Log: t1isa.c,v $
- * Revision 1.16.6.4  2001/03/21 08:52:21  kai
- * merge from main branch: fix buffer for revision string (calle)
- *
- * Revision 1.16.6.3  2001/03/15 15:11:24  kai
- * *** empty log message ***
- *
- * Revision 1.16.6.2  2001/02/16 16:43:24  kai
- * Changes from -ac16, little bug fixes, typos and the like
- *
- * Revision 1.16.6.1  2001/02/13 11:43:29  kai
- * more compatility changes for 2.2.19
- *
- * Revision 1.16  2000/11/23 20:45:14  kai
- * fixed module_init/exit stuff
- * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
- *
- * Revision 1.15  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.14  2000/10/10 17:44:19  kai
- * changes from/for 2.2.18
- *
- * Revision 1.13  2000/08/04 15:36:31  calle
- * copied wrong from file to file :-(
- *
- * Revision 1.12  2000/08/04 12:20:08  calle
- * - Fix unsigned/signed warning in the right way ...
- *
- * Revision 1.11  2000/04/03 13:29:25  calle
- * make Tim Waugh happy (module unload races in 2.3.99-pre3).
- * no real problem there, but now it is much cleaner ...
- *
- * Revision 1.10  2000/02/02 18:36:04  calle
- * - Modules are now locked while init_module is running
- * - fixed problem with memory mapping if address is not aligned
- *
- * Revision 1.9  2000/01/25 14:37:39  calle
- * new message after successful detection including card revision and
- * used resources.
- *
- * Revision 1.8  1999/11/05 16:38:01  calle
- * Cleanups before kernel 2.4:
- * - Changed all messages to use card->name or driver->name instead of
- *   constant string.
- * - Moved some data from struct avmcard into new struct avmctrl_info.
- *   Changed all lowlevel capi driver to match the new structur.
- *
- * Revision 1.7  1999/09/15 08:16:03  calle
- * Implementation of 64Bit extention complete.
- *
- * Revision 1.6  1999/09/07 09:02:53  calle
- * SETDATA removed. Now inside the kernel the datapart of DATA_B3_REQ and
- * DATA_B3_IND is always directly after the CAPI message. The "Data" member
- * ist never used inside the kernel.
- *
- * Revision 1.5  1999/08/22 20:26:28  calle
- * backported changes from kernel 2.3.14:
- * - several #include "config.h" gone, others come.
- * - "struct device" changed to "struct net_device" in 2.3.14, added a
- *   define in isdn_compat.h for older kernel versions.
- *
- * Revision 1.4  1999/07/09 15:05:50  keil
- * compat.h is now isdn_compat.h
- *
- * Revision 1.3  1999/07/06 07:42:04  calle
- * - changes in /proc interface
- * - check and changed calls to [dev_]kfree_skb and [dev_]alloc_skb.
- *
- * Revision 1.2  1999/07/05 15:09:54  calle
- * - renamed "appl_release" to "appl_released".
- * - version und profile data now cleared on controller reset
- * - extended /proc interface, to allow driver and controller specific
- *   informations to include by driver hackers.
- *
- * Revision 1.1  1999/07/01 15:26:44  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
- *
  */
 
 #include <linux/module.h>
@@ -109,6 +15,7 @@
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/capi.h>
+#include <linux/kernelcapi.h>
 #include <linux/init.h>
 #include <linux/isdn_compat.h>
 #include <asm/io.h>
@@ -117,7 +24,7 @@
 #include "capilli.h"
 #include "avmcard.h"
 
-static char *revision = "$Revision: 1.16.6.4 $";
+static char *revision = "$Revision: 1.16.6.6 $";
 
 /* ------------------------------------------------------------- */
 
@@ -411,7 +318,7 @@
 	cli();
 	b1_setinterrupt(port, card->irq, card->cardtype);
 	b1_put_byte(port, SEND_INIT);
-	b1_put_word(port, AVM_NAPPS);
+	b1_put_word(port, CAPI_MAXAPPL);
 	b1_put_word(port, AVM_NCCI_PER_CHANNEL*30);
 	b1_put_word(port, ctrl->cnr - 1);
 	restore_flags(flags);
diff -urN linux-2.2.20-pre5/drivers/isdn/avmb1/t1pci.c linux/drivers/isdn/avmb1/t1pci.c
--- linux-2.2.20-pre5/drivers/isdn/avmb1/t1pci.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/avmb1/t1pci.c	Mon Dec  3 22:19:41 2001
@@ -1,80 +1,10 @@
 /*
- * $Id: t1pci.c,v 1.13.6.3 2001/03/21 08:52:21 kai Exp $
+ * $Id: t1pci.c,v 1.13.6.5 2001/05/17 20:41:51 kai Exp $
  * 
  * Module for AVM T1 PCI-card.
  * 
  * (c) Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
  * 
- * $Log: t1pci.c,v $
- * Revision 1.13.6.3  2001/03/21 08:52:21  kai
- * merge from main branch: fix buffer for revision string (calle)
- *
- * Revision 1.13.6.2  2001/02/13 11:43:29  kai
- * more compatility changes for 2.2.19
- *
- * Revision 1.13.6.1  2000/11/28 12:02:45  kai
- * MODULE_DEVICE_TABLE for 2.4
- *
- * Revision 1.13.2.2  2000/11/26 17:47:53  kai
- * added PCI_DEV_TABLE for 2.4
- *
- * Revision 1.13.2.1  2000/11/26 17:14:19  kai
- * fix device ids
- * also needs patches to include/linux/pci_ids.h
- *
- * Revision 1.13  2000/11/23 20:45:14  kai
- * fixed module_init/exit stuff
- * Note: compiled-in kernel doesn't work pre 2.2.18 anymore.
- *
- * Revision 1.12  2000/11/01 14:05:02  calle
- * - use module_init/module_exit from linux/init.h.
- * - all static struct variables are initialized with "membername:" now.
- * - avm_cs.c, let it work with newer pcmcia-cs.
- *
- * Revision 1.11  2000/08/08 09:24:19  calle
- * calls to pci_enable_device surounded by #ifndef COMPAT_HAS_2_2_PCI
- *
- * Revision 1.10  2000/07/20 10:21:21  calle
- * Bugfix: driver will not be unregistered, if not cards were detected.
- *         this result in an oops in kcapi.c
- *
- * Revision 1.9  2000/05/19 15:43:22  calle
- * added calls to pci_device_start().
- *
- * Revision 1.8  2000/05/06 00:52:36  kai
- * merged changes from kernel tree
- * fixed timer and net_device->name breakage
- *
- * Revision 1.7  2000/04/07 15:26:55  calle
- * better error message if cabel not connected or T1 has no power.
- *
- * Revision 1.6  2000/04/03 13:29:25  calle
- * make Tim Waugh happy (module unload races in 2.3.99-pre3).
- * no real problem there, but now it is much cleaner ...
- *
- * Revision 1.5  2000/02/02 18:36:04  calle
- * - Modules are now locked while init_module is running
- * - fixed problem with memory mapping if address is not aligned
- *
- * Revision 1.4  2000/01/25 14:33:38  calle
- * - Added Support AVM B1 PCI V4.0 (tested with prototype)
- *   - splitted up t1pci.c into b1dma.c for common function with b1pciv4
- *   - support for revision register
- *
- * Revision 1.3  1999/11/13 21:27:16  keil
- * remove KERNELVERSION
- *
- * Revision 1.2  1999/11/05 16:38:02  calle
- * Cleanups before kernel 2.4:
- * - Changed all messages to use card->name or driver->name instead of
- *   constant string.
- * - Moved some data from struct avmcard into new struct avmctrl_info.
- *   Changed all lowlevel capi driver to match the new structur.
- *
- * Revision 1.1  1999/10/26 15:31:42  calle
- * Added driver for T1-PCI card.
- *
- *
  */
 
 #include <linux/config.h>
@@ -95,7 +25,7 @@
 #include "capilli.h"
 #include "avmcard.h"
 
-static char *revision = "$Revision: 1.13.6.3 $";
+static char *revision = "$Revision: 1.13.6.5 $";
 
 #undef CONFIG_T1PCI_DEBUG
 #undef CONFIG_T1PCI_POLLDEBUG
@@ -119,7 +49,7 @@
 
 	di->detach_ctr(ctrl);
 	free_irq(card->irq, card);
-	iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK));
+	iounmap(card->mbase);
 	release_region(card->port, AVMB1_PORTLEN);
 	ctrl->driverdata = 0;
 	kfree(card->ctrlinfo);
@@ -133,7 +63,6 @@
 
 static int t1pci_add_card(struct capi_driver *driver, struct capicardparams *p)
 {
-	unsigned long base, page_offset;
 	avmcard *card;
 	avmctrl_info *cinfo;
 	int retval;
@@ -184,12 +113,8 @@
 		return -EBUSY;
 	}
 
-	base = card->membase & PAGE_MASK;
-	page_offset = card->membase - base;
-	card->mbase = ioremap_nocache(base, page_offset + 64);
-	if (card->mbase) {
-		card->mbase += page_offset;
-	} else {
+	card->mbase = ioremap_nocache(card->membase, 64);
+	if (!card->mbase) {
 		printk(KERN_NOTICE "%s: can't remap memory at 0x%lx\n",
 					driver->name, card->membase);
 	        kfree(card->ctrlinfo);
@@ -208,7 +133,7 @@
 		else
 			printk(KERN_NOTICE "%s: card at 0x%x, but cabel not connected or T1 has no power (%d)\n",
 					driver->name, card->port, retval);
-                iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK));
+                iounmap(card->mbase);
 	        kfree(card->ctrlinfo);
 		kfree(card->dma);
 		kfree(card);
@@ -223,7 +148,7 @@
 	if (retval) {
 		printk(KERN_ERR "%s: unable to get IRQ %d.\n",
 				driver->name, card->irq);
-                iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK));
+                iounmap(card->mbase);
 		release_region(card->port, AVMB1_PORTLEN);
 	        kfree(card->ctrlinfo);
 		kfree(card->dma);
@@ -235,7 +160,7 @@
 	cinfo->capi_ctrl = di->attach_ctr(driver, card->name, cinfo);
 	if (!cinfo->capi_ctrl) {
 		printk(KERN_ERR "%s: attach controller failed.\n", driver->name);
-                iounmap((void *) (((unsigned long) card->mbase) & PAGE_MASK));
+                iounmap(card->mbase);
 		free_irq(card->irq, card);
 		release_region(card->port, AVMB1_PORTLEN);
 	        kfree(card->ctrlinfo);
@@ -313,7 +238,6 @@
 	printk(KERN_INFO "%s: revision %s\n", driver->name, driver->revision);
 
         di = attach_capi_driver(driver);
-
 	if (!di) {
 		printk(KERN_ERR "%s: failed to attach capi_driver\n",
 				driver->name);
@@ -321,22 +245,20 @@
 		return -EIO;
 	}
 
-#ifdef CONFIG_PCI
-	if (!pci_present()) {
-		printk(KERN_ERR "%s: no PCI bus present\n", driver->name);
-    		detach_capi_driver(driver);
-		MOD_DEC_USE_COUNT;
-		return -EIO;
-	}
-
 	while ((dev = pci_find_device(PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_T1, dev))) {
 		struct capicardparams param;
 
+		if (pci_enable_device(dev) < 0) {
+		        printk(KERN_ERR	"%s: failed to enable AVM-T1-PCI\n",
+			       driver->name);
+			continue;
+		}
+		pci_set_master(dev);
+
 		param.port = dev->base_address[ 1] & PCI_BASE_ADDRESS_IO_MASK;
  		param.irq = dev->irq;
 		param.membase = dev->base_address[ 0] & PCI_BASE_ADDRESS_MEM_MASK;
 
-
 		printk(KERN_INFO
 			"%s: PCI BIOS reports AVM-T1-PCI at i/o %#x, irq %d, mem %#x\n",
 			driver->name, param.port, param.irq, param.membase);
@@ -345,9 +267,7 @@
 		        printk(KERN_ERR
 			"%s: no AVM-T1-PCI at i/o %#x, irq %d detected, mem %#x\n",
 			driver->name, param.port, param.irq, param.membase);
-    			detach_capi_driver(&t1pci_driver);
-			MOD_DEC_USE_COUNT;
-			return retval;
+			continue;
 		}
 		ncards++;
 	}
@@ -360,12 +280,7 @@
 	printk(KERN_ERR "%s: NO T1-PCI card detected\n", driver->name);
 	detach_capi_driver(&t1pci_driver);
 	MOD_DEC_USE_COUNT;
-	return -ESRCH;
-#else
-	printk(KERN_ERR "%s: kernel not compiled with PCI.\n", driver->name);
-	MOD_DEC_USE_COUNT;
-	return -EIO;
-#endif
+	return -ENODEV;
 }
 
 static void  t1pci_exit(void)
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/amd7930.c linux/drivers/isdn/hisax/amd7930.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/amd7930.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/amd7930.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: amd7930.c,v 1.5.6.1 2001/02/16 16:43:25 kai Exp $
+/* $Id: amd7930.c,v 1.5.6.3 2001/06/11 22:08:37 kai Exp $
  *
  * HiSax ISDN driver - chip specific routines for AMD 7930
  *
@@ -94,7 +94,7 @@
 #include "rawhdlc.h"
 #include <linux/interrupt.h>
 
-static const char *amd7930_revision = "$Revision: 1.5.6.1 $";
+static const char *amd7930_revision = "$Revision: 1.5.6.3 $";
 
 #define RCV_BUFSIZE	1024	/* Size of raw receive buffer in bytes */
 #define RCV_BUFBLKS	4	/* Number of blocks to divide buffer into
@@ -362,12 +362,8 @@
 	amd7930_bclose(0, bcs->channel);
 
 	if (test_bit(BC_FLG_INIT, &bcs->Flag)) {
-		while ((skb = skb_dequeue(&bcs->rqueue))) {
-			dev_kfree_skb(skb);
-		}
-		while ((skb = skb_dequeue(&bcs->squeue))) {
-			dev_kfree_skb(skb);
-		}
+		skb_queue_purge(&bcs->rqueue);
+		skb_queue_purge(&bcs->squeue);
 	}
 	test_and_clear_bit(BC_FLG_INIT, &bcs->Flag);
 }
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/avm_pci.c linux/drivers/isdn/hisax/avm_pci.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/avm_pci.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/avm_pci.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: avm_pci.c,v 1.22.6.4 2001/02/16 16:43:25 kai Exp $
+/* $Id: avm_pci.c,v 1.22.6.5 2001/06/09 15:14:16 kai Exp $
  *
  * avm_pci.c    low level stuff for AVM Fritz!PCI and ISA PnP isdn cards
  *              Thanks to AVM, Berlin for informations
@@ -19,7 +19,7 @@
 #include <linux/interrupt.h>
 
 extern const char *CardType[];
-static const char *avm_pci_rev = "$Revision: 1.22.6.4 $";
+static const char *avm_pci_rev = "$Revision: 1.22.6.5 $";
 
 #define  AVM_FRITZ_PCI		1
 #define  AVM_FRITZ_PNP		2
@@ -592,8 +592,8 @@
 			kfree(bcs->blog);
 			bcs->blog = NULL;
 		}
-		discard_queue(&bcs->rqueue);
-		discard_queue(&bcs->squeue);
+		skb_queue_purge(&bcs->rqueue);
+		skb_queue_purge(&bcs->squeue);
 		if (bcs->tx_skb) {
 			dev_kfree_skb(bcs->tx_skb);
 			bcs->tx_skb = NULL;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/bkm_a8.c linux/drivers/isdn/hisax/bkm_a8.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/bkm_a8.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/bkm_a8.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: bkm_a8.c,v 1.14.6.4 2001/02/16 16:43:25 kai Exp $
+/* $Id: bkm_a8.c,v 1.14.6.5 2001/04/15 14:51:09 keil Exp $
  * bkm_a8.c     low level stuff for Scitel Quadro (4*S0, passive)
  *              derived from the original file sedlbauer.c
  *              derived from the original file niccy.c
@@ -28,7 +28,7 @@
 
 extern const char *CardType[];
 
-const char sct_quadro_revision[] = "$Revision: 1.14.6.4 $";
+const char sct_quadro_revision[] = "$Revision: 1.14.6.5 $";
 
 static const char *sct_quadro_subtypes[] =
 {
@@ -206,9 +206,9 @@
 void
 release_io_sct_quadro(struct IsdnCardState *cs)
 {
-	release_region(cs->hw.ax.base & 0xffffffc0, 256);
+	release_region(cs->hw.ax.base & 0xffffffc0, 128);
 	if (cs->subtyp == SCT_1)
-		release_region(cs->hw.ax.plx_adr, 256);
+		release_region(cs->hw.ax.plx_adr, 64);
 }
 
 static void
@@ -404,9 +404,9 @@
 	switch(cs->subtyp) {
 		case 1:
 			cs->hw.ax.base = pci_ioaddr5 + 0x00;
-			if (sct_alloc_io(pci_ioaddr1, 256))
+			if (sct_alloc_io(pci_ioaddr1, 128))
 				return(0);
-			if (sct_alloc_io(pci_ioaddr5, 256))
+			if (sct_alloc_io(pci_ioaddr5, 64))
 				return(0);
 			/* disable all IPAC */
 			writereg(pci_ioaddr5, pci_ioaddr5 + 4,
@@ -420,17 +420,17 @@
 			break;
 		case 2:
 			cs->hw.ax.base = pci_ioaddr4 + 0x08;
-			if (sct_alloc_io(pci_ioaddr4, 256))
+			if (sct_alloc_io(pci_ioaddr4, 64))
 				return(0);
 			break;
 		case 3:
 			cs->hw.ax.base = pci_ioaddr3 + 0x10;
-			if (sct_alloc_io(pci_ioaddr3, 256))
+			if (sct_alloc_io(pci_ioaddr3, 64))
 				return(0);
 			break;
 		case 4:
 			cs->hw.ax.base = pci_ioaddr2 + 0x20;
-			if (sct_alloc_io(pci_ioaddr2, 256))
+			if (sct_alloc_io(pci_ioaddr2, 64))
 				return(0);
 			break;
 	}	
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/callc.c linux/drivers/isdn/hisax/callc.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/callc.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/callc.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: callc.c,v 2.51.6.2 2001/03/13 16:17:08 kai Exp $
+/* $Id: callc.c,v 2.51.6.4 2001/06/09 15:14:17 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
@@ -20,7 +20,7 @@
 #define MOD_USE_COUNT ( GET_USE_COUNT (&__this_module))
 #endif	/* MODULE */
 
-const char *lli_revision = "$Revision: 2.51.6.2 $";
+const char *lli_revision = "$Revision: 2.51.6.4 $";
 
 extern struct IsdnCard cards[];
 extern int nrcards;
@@ -66,19 +66,6 @@
 	return (struct IsdnCardState *) 0;
 }
 
-int
-discard_queue(struct sk_buff_head *q)
-{
-	struct sk_buff *skb;
-	int ret=0;
-
-	while ((skb = skb_dequeue(q))) {
-		dev_kfree_skb(skb);
-		ret++;
-	}
-	return(ret);
-}
-
 static void
 link_debug(struct Channel *chanp, int direction, char *fmt, ...)
 {
@@ -850,14 +837,14 @@
 
 #define FNCOUNT (sizeof(fnlist)/sizeof(struct FsmNode))
 
-void __init
+int __init
 CallcNew(void)
 {
 	callcfsm.state_count = STATE_COUNT;
 	callcfsm.event_count = EVENT_COUNT;
 	callcfsm.strEvent = strEvent;
 	callcfsm.strState = strState;
-	FsmNew(&callcfsm, fnlist, FNCOUNT);
+	return FsmNew(&callcfsm, fnlist, FNCOUNT);
 }
 
 void
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/config.c linux/drivers/isdn/hisax/config.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/config.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/config.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: config.c,v 2.57.6.11 2001/03/13 16:17:08 kai Exp $
+/* $Id: config.c,v 2.57.6.15 2001/06/09 15:14:17 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
@@ -829,8 +829,8 @@
 		csta->bcs->BC_Close(csta->bcs);
 	}
 
-	discard_queue(&csta->rq);
-	discard_queue(&csta->sq);
+	skb_queue_purge(&csta->rq);
+	skb_queue_purge(&csta->sq);
 	if (csta->rcvbuf) {
 		kfree(csta->rcvbuf);
 		csta->rcvbuf = NULL;
@@ -906,13 +906,12 @@
 
 	save_flags(flags);
 	cli();
-	if (!(cs = (struct IsdnCardState *)
-		kmalloc(sizeof(struct IsdnCardState), GFP_ATOMIC))) {
+	cs = kmalloc(sizeof(struct IsdnCardState), GFP_ATOMIC);
+	if (!cs) {
 		printk(KERN_WARNING
 		       "HiSax: No memory for IsdnCardState(card %d)\n",
 		       cardnr + 1);
-		restore_flags(flags);
-		return (0);
+		goto out;
 	}
 	memset(cs, 0, sizeof(struct IsdnCardState));
 	card->cs = cs;
@@ -931,241 +930,235 @@
 #endif
 	cs->protocol = card->protocol;
 
-	if ((card->typ > 0) && (card->typ <= ISDN_CTYPE_COUNT)) {
-		if (!(cs->dlog = kmalloc(MAX_DLOG_SPACE, GFP_ATOMIC))) {
-			printk(KERN_WARNING
-				"HiSax: No memory for dlog(card %d)\n",
-				cardnr + 1);
-			restore_flags(flags);
-			return (0);
-		}
-		if (!(cs->status_buf = kmalloc(HISAX_STATUS_BUFSIZE, GFP_ATOMIC))) {
-			printk(KERN_WARNING
-				"HiSax: No memory for status_buf(card %d)\n",
-				cardnr + 1);
-			kfree(cs->dlog);
-			restore_flags(flags);
-			return (0);
-		}
-		cs->stlist = NULL;
-		cs->status_read = cs->status_buf;
-		cs->status_write = cs->status_buf;
-		cs->status_end = cs->status_buf + HISAX_STATUS_BUFSIZE - 1;
-		cs->typ = card->typ;
-		strcpy(cs->iif.id, id);
-		cs->iif.channels = 2;
-		cs->iif.maxbufsize = MAX_DATA_SIZE;
-		cs->iif.hl_hdrlen = MAX_HEADER_LEN;
-		cs->iif.features =
-			ISDN_FEATURE_L2_X75I |
-			ISDN_FEATURE_L2_HDLC |
-			ISDN_FEATURE_L2_HDLC_56K |
-			ISDN_FEATURE_L2_TRANS |
-			ISDN_FEATURE_L3_TRANS |
+	if (card->typ <= 0 || card->typ > ISDN_CTYPE_COUNT) {
+		printk(KERN_WARNING
+		       "HiSax: Card Type %d out of range\n",
+		       card->typ);
+		goto outf_cs;
+	}
+	if (!(cs->dlog = kmalloc(MAX_DLOG_SPACE, GFP_ATOMIC))) {
+		printk(KERN_WARNING
+		       "HiSax: No memory for dlog(card %d)\n",
+		       cardnr + 1);
+		goto outf_cs;
+	}
+	if (!(cs->status_buf = kmalloc(HISAX_STATUS_BUFSIZE, GFP_ATOMIC))) {
+		printk(KERN_WARNING
+		       "HiSax: No memory for status_buf(card %d)\n",
+		       cardnr + 1);
+		goto outf_dlog;
+	}
+	cs->stlist = NULL;
+	cs->status_read = cs->status_buf;
+	cs->status_write = cs->status_buf;
+	cs->status_end = cs->status_buf + HISAX_STATUS_BUFSIZE - 1;
+	cs->typ = card->typ;
+	strcpy(cs->iif.id, id);
+	cs->iif.channels = 2;
+	cs->iif.maxbufsize = MAX_DATA_SIZE;
+	cs->iif.hl_hdrlen = MAX_HEADER_LEN;
+	cs->iif.features =
+		ISDN_FEATURE_L2_X75I |
+		ISDN_FEATURE_L2_HDLC |
+		ISDN_FEATURE_L2_HDLC_56K |
+		ISDN_FEATURE_L2_TRANS |
+		ISDN_FEATURE_L3_TRANS |
 #ifdef	CONFIG_HISAX_1TR6
-			ISDN_FEATURE_P_1TR6 |
+		ISDN_FEATURE_P_1TR6 |
 #endif
 #ifdef	CONFIG_HISAX_EURO
-			ISDN_FEATURE_P_EURO |
+		ISDN_FEATURE_P_EURO |
 #endif
 #ifdef	CONFIG_HISAX_NI1
-			ISDN_FEATURE_P_NI1 |
+		ISDN_FEATURE_P_NI1 |
 #endif
-			0;
-
-		cs->iif.command = HiSax_command;
-		cs->iif.writecmd = NULL;
-		cs->iif.writebuf_skb = HiSax_writebuf_skb;
-		cs->iif.readstat = HiSax_readstatus;
-		register_isdn(&cs->iif);
-		cs->myid = cs->iif.channels;
-		printk(KERN_INFO
-			"HiSax: Card %d Protocol %s Id=%s (%d)\n", cardnr + 1,
-			(card->protocol == ISDN_PTYPE_1TR6) ? "1TR6" :
-			(card->protocol == ISDN_PTYPE_EURO) ? "EDSS1" :
-			(card->protocol == ISDN_PTYPE_LEASED) ? "LEASED" :
-			(card->protocol == ISDN_PTYPE_NI1) ? "NI1" :
-			"NONE", cs->iif.id, cs->myid);
-		switch (card->typ) {
+		0;
+	
+	cs->iif.command = HiSax_command;
+	cs->iif.writecmd = NULL;
+	cs->iif.writebuf_skb = HiSax_writebuf_skb;
+	cs->iif.readstat = HiSax_readstatus;
+	register_isdn(&cs->iif);
+	cs->myid = cs->iif.channels;
+	printk(KERN_INFO
+	       "HiSax: Card %d Protocol %s Id=%s (%d)\n", cardnr + 1,
+	       (card->protocol == ISDN_PTYPE_1TR6) ? "1TR6" :
+	       (card->protocol == ISDN_PTYPE_EURO) ? "EDSS1" :
+	       (card->protocol == ISDN_PTYPE_LEASED) ? "LEASED" :
+	       (card->protocol == ISDN_PTYPE_NI1) ? "NI1" :
+	       "NONE", cs->iif.id, cs->myid);
+	switch (card->typ) {
 #if CARD_TELES0
-			case ISDN_CTYPE_16_0:
-			case ISDN_CTYPE_8_0:
-				ret = setup_teles0(card);
-				break;
+	case ISDN_CTYPE_16_0:
+	case ISDN_CTYPE_8_0:
+		ret = setup_teles0(card);
+		break;
 #endif
 #if CARD_TELES3
-			case ISDN_CTYPE_16_3:
-			case ISDN_CTYPE_PNP:
-			case ISDN_CTYPE_TELESPCMCIA:
-			case ISDN_CTYPE_COMPAQ_ISA:
-				ret = setup_teles3(card);
-				break;
+	case ISDN_CTYPE_16_3:
+	case ISDN_CTYPE_PNP:
+	case ISDN_CTYPE_TELESPCMCIA:
+	case ISDN_CTYPE_COMPAQ_ISA:
+		ret = setup_teles3(card);
+		break;
 #endif
 #if CARD_S0BOX
-			case ISDN_CTYPE_S0BOX:
-				ret = setup_s0box(card);
-				break;
+	case ISDN_CTYPE_S0BOX:
+		ret = setup_s0box(card);
+		break;
 #endif
 #if CARD_TELESPCI
-			case ISDN_CTYPE_TELESPCI:
-				ret = setup_telespci(card);
-				break;
+	case ISDN_CTYPE_TELESPCI:
+		ret = setup_telespci(card);
+		break;
 #endif
 #if CARD_AVM_A1
-			case ISDN_CTYPE_A1:
-				ret = setup_avm_a1(card);
-				break;
+	case ISDN_CTYPE_A1:
+		ret = setup_avm_a1(card);
+		break;
 #endif
 #if CARD_AVM_A1_PCMCIA
-			case ISDN_CTYPE_A1_PCMCIA:
-				ret = setup_avm_a1_pcmcia(card);
-				break;
+	case ISDN_CTYPE_A1_PCMCIA:
+		ret = setup_avm_a1_pcmcia(card);
+		break;
 #endif
 #if CARD_FRITZPCI
-			case ISDN_CTYPE_FRITZPCI:
-				ret = setup_avm_pcipnp(card);
-				break;
+	case ISDN_CTYPE_FRITZPCI:
+		ret = setup_avm_pcipnp(card);
+		break;
 #endif
 #if CARD_ELSA
-			case ISDN_CTYPE_ELSA:
-			case ISDN_CTYPE_ELSA_PNP:
-			case ISDN_CTYPE_ELSA_PCMCIA:
-			case ISDN_CTYPE_ELSA_PCI:
-				ret = setup_elsa(card);
-				break;
+	case ISDN_CTYPE_ELSA:
+	case ISDN_CTYPE_ELSA_PNP:
+	case ISDN_CTYPE_ELSA_PCMCIA:
+	case ISDN_CTYPE_ELSA_PCI:
+		ret = setup_elsa(card);
+		break;
 #endif
 #if CARD_IX1MICROR2
-			case ISDN_CTYPE_IX1MICROR2:
-				ret = setup_ix1micro(card);
-				break;
+	case ISDN_CTYPE_IX1MICROR2:
+		ret = setup_ix1micro(card);
+		break;
 #endif
 #if CARD_DIEHLDIVA
-			case ISDN_CTYPE_DIEHLDIVA:
-				ret = setup_diva(card);
-				break;
+	case ISDN_CTYPE_DIEHLDIVA:
+		ret = setup_diva(card);
+		break;
 #endif
 #if CARD_ASUSCOM
-			case ISDN_CTYPE_ASUSCOM:
-				ret = setup_asuscom(card);
-				break;
+	case ISDN_CTYPE_ASUSCOM:
+		ret = setup_asuscom(card);
+		break;
 #endif
 #if CARD_TELEINT
-			case ISDN_CTYPE_TELEINT:
-				ret = setup_TeleInt(card);
-				break;
+	case ISDN_CTYPE_TELEINT:
+		ret = setup_TeleInt(card);
+		break;
 #endif
 #if CARD_SEDLBAUER
-			case ISDN_CTYPE_SEDLBAUER:
-			case ISDN_CTYPE_SEDLBAUER_PCMCIA:
-			case ISDN_CTYPE_SEDLBAUER_FAX:
-				ret = setup_sedlbauer(card);
-				break;
+	case ISDN_CTYPE_SEDLBAUER:
+	case ISDN_CTYPE_SEDLBAUER_PCMCIA:
+	case ISDN_CTYPE_SEDLBAUER_FAX:
+		ret = setup_sedlbauer(card);
+		break;
 #endif
 #if CARD_SPORTSTER
-			case ISDN_CTYPE_SPORTSTER:
-				ret = setup_sportster(card);
-				break;
+	case ISDN_CTYPE_SPORTSTER:
+		ret = setup_sportster(card);
+		break;
 #endif
 #if CARD_MIC
-			case ISDN_CTYPE_MIC:
-				ret = setup_mic(card);
-				break;
+	case ISDN_CTYPE_MIC:
+		ret = setup_mic(card);
+		break;
 #endif
 #if CARD_NETJET_S
-			case ISDN_CTYPE_NETJET_S:
-				ret = setup_netjet_s(card);
-				break;
+	case ISDN_CTYPE_NETJET_S:
+		ret = setup_netjet_s(card);
+		break;
 #endif
 #if CARD_HFCS
-			case ISDN_CTYPE_TELES3C:
-			case ISDN_CTYPE_ACERP10:
-				ret = setup_hfcs(card);
-				break;
+	case ISDN_CTYPE_TELES3C:
+	case ISDN_CTYPE_ACERP10:
+		ret = setup_hfcs(card);
+		break;
 #endif
 #if CARD_HFC_PCI
-		        case ISDN_CTYPE_HFC_PCI: 
-				ret = setup_hfcpci(card);
-				break;
+	case ISDN_CTYPE_HFC_PCI: 
+		ret = setup_hfcpci(card);
+		break;
 #endif
 #if CARD_HFC_SX
-		        case ISDN_CTYPE_HFC_SX: 
-				ret = setup_hfcsx(card);
-				break;
+	case ISDN_CTYPE_HFC_SX: 
+		ret = setup_hfcsx(card);
+		break;
 #endif
 #if CARD_NICCY
-			case ISDN_CTYPE_NICCY:
-				ret = setup_niccy(card);
-				break;
+	case ISDN_CTYPE_NICCY:
+		ret = setup_niccy(card);
+		break;
 #endif
 #if CARD_AMD7930
-			case ISDN_CTYPE_AMD7930:
-				ret = setup_amd7930(card);
-				break;
+	case ISDN_CTYPE_AMD7930:
+		ret = setup_amd7930(card);
+		break;
 #endif
 #if CARD_ISURF
-			case ISDN_CTYPE_ISURF:
-				ret = setup_isurf(card);
-				break;
+	case ISDN_CTYPE_ISURF:
+		ret = setup_isurf(card);
+		break;
 #endif
 #if CARD_HSTSAPHIR
-			case ISDN_CTYPE_HSTSAPHIR:
-				ret = setup_saphir(card);
-				break;
+	case ISDN_CTYPE_HSTSAPHIR:
+		ret = setup_saphir(card);
+		break;
 #endif
 #if CARD_TESTEMU
-			case ISDN_CTYPE_TESTEMU:
-				ret = setup_testemu(card);
-				break;
+	case ISDN_CTYPE_TESTEMU:
+		ret = setup_testemu(card);
+		break;
 #endif
 #if	CARD_BKM_A4T       
-           	case ISDN_CTYPE_BKM_A4T:
-	        	ret = setup_bkm_a4t(card);
-			break;
+	case ISDN_CTYPE_BKM_A4T:
+		ret = setup_bkm_a4t(card);
+		break;
 #endif
 #if	CARD_SCT_QUADRO
-	        case ISDN_CTYPE_SCT_QUADRO:
-    			ret = setup_sct_quadro(card);
-			break;
+	case ISDN_CTYPE_SCT_QUADRO:
+		ret = setup_sct_quadro(card);
+		break;
 #endif
 #if CARD_GAZEL
- 		case ISDN_CTYPE_GAZEL:
- 			ret = setup_gazel(card);
- 			break;
+	case ISDN_CTYPE_GAZEL:
+		ret = setup_gazel(card);
+		break;
 #endif
 #if CARD_W6692
-		case ISDN_CTYPE_W6692:
-			ret = setup_w6692(card);
-			break;
+	case ISDN_CTYPE_W6692:
+		ret = setup_w6692(card);
+		break;
 #endif
 #if CARD_NETJET_U
-			case ISDN_CTYPE_NETJET_U:
-				ret = setup_netjet_u(card);
-				break;
+	case ISDN_CTYPE_NETJET_U:
+		ret = setup_netjet_u(card);
+		break;
 #endif
-		default:
-			printk(KERN_WARNING
-				"HiSax: Support for %s Card not selected\n",
-				CardType[card->typ]);
-			ll_unload(cs);
-			restore_flags(flags);
-			return (0);
-		}
-	} else {
+	default:
 		printk(KERN_WARNING
-		       "HiSax: Card Type %d out of range\n",
-		       card->typ);
-		restore_flags(flags);
-		return (0);
+		       "HiSax: Support for %s Card not selected\n",
+		       CardType[card->typ]);
+		ll_unload(cs);
+		goto outf_cs;
 	}
 	if (!ret) {
 		ll_unload(cs);
-		restore_flags(flags);
-		return (0);
+		goto outf_cs;
 	}
 	if (!(cs->rcvbuf = kmalloc(MAX_DFRAME_LEN_L1, GFP_ATOMIC))) {
 		printk(KERN_WARNING
 		       "HiSax: No memory for isac rcvbuf\n");
-		return (1);
+		ll_unload(cs);
+		goto outf_cs;
 	}
 	cs->rcvidx = 0;
 	cs->tx_skb = NULL;
@@ -1182,21 +1175,31 @@
 	ret = init_card(cs);
 	if (ret) {
 		closecard(cardnr);
-		restore_flags(flags);
-		return (0);
+		ret = 0;
+		goto outf_cs;
 	}
 	init_tei(cs, cs->protocol);
 	ret = CallcNewChan(cs);
 	if (ret) {
 		closecard(cardnr);
-		restore_flags(flags);
-		return 0;
+		ret = 0;
+		goto outf_cs;
 	}
 	/* ISAR needs firmware download first */
 	if (!test_bit(HW_ISAR, &cs->HW_Flags))
 		ll_run(cs, 0);
+
+	ret = 1;
+	goto out;
+
+ outf_dlog:
+	kfree(cs->dlog);
+ outf_cs:
+	kfree(cs);
+	card->cs = NULL;
+ out:
 	restore_flags(flags);
-	return (1);
+	return ret;
 }
 
 void 
@@ -1245,9 +1248,6 @@
 		} else {
 			printk(KERN_WARNING "HiSax: Card %s not installed !\n",
 			       CardType[cards[i].typ]);
-			if (cards[i].cs)
-				kfree((void *) cards[i].cs);
-			cards[i].cs = NULL;
 			HiSax_shiftcards(i);
 			nrcards--;
 		}
@@ -1324,15 +1324,28 @@
 
 static int __init HiSax_init(void)
 {
-	int i,j;
+	int i, retval;
+#ifdef MODULE 
+	int j;
 	int nzproto = 0;
+#endif
 
 	HiSaxVersion();
-	CallcNew();
-	Isdnl3New();
-	Isdnl2New();
-	TeiNew();
-	Isdnl1New();
+	retval = CallcNew();
+	if (retval)
+		goto out;
+	retval = Isdnl3New();
+	if (retval)
+		goto out_callc;
+	retval = Isdnl2New();
+	if (retval)
+		goto out_isdnl3;
+	retval = TeiNew();
+	if (retval)
+		goto out_isdnl2;
+	retval = Isdnl1New();
+	if (retval)
+		goto out_tei;
 
 #ifdef MODULE
 	if (!type[0]) {
@@ -1479,17 +1492,26 @@
 	printk(KERN_DEBUG "HiSax: Total %d card%s defined\n",
 	       nrcards, (nrcards > 1) ? "s" : "");
 
-	if (HiSax_inithardware(NULL)) {
-		/* Install only, if at least one card found */
-		return (0);
-	} else {
-		Isdnl1Free();
-		TeiFree();
-		Isdnl2Free();
-		Isdnl3Free();
-		CallcFree();
-		return -EIO;
+	/* Install only, if at least one card found */
+	if (!HiSax_inithardware(NULL)) {
+		retval = -EIO;
+		goto out_isdnl1;
 	}
+	
+	return 0;
+
+ out_isdnl1:
+	Isdnl1Free();
+ out_tei:
+	TeiFree();
+ out_isdnl2:
+	Isdnl2Free();
+ out_isdnl3:
+	Isdnl3Free();
+ out_callc:
+	CallcFree();
+ out:
+	return retval;
 }
 
 static void  HiSax_exit(void)
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/elsa_ser.c linux/drivers/isdn/hisax/elsa_ser.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/elsa_ser.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/elsa_ser.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: elsa_ser.c,v 2.10.6.1 2001/02/16 16:43:26 kai Exp $
+/* $Id: elsa_ser.c,v 2.10.6.2 2001/06/09 15:14:17 kai Exp $
  *
  * stuff for the serial modem on ELSA cards
  *
@@ -439,8 +439,6 @@
 void
 close_elsastate(struct BCState *bcs)
 {
-	struct sk_buff *skb;
-
 	modehscx(bcs, 0, bcs->channel);
 	if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
 		if (bcs->hw.hscx.rcvbuf) {
@@ -448,12 +446,8 @@
 				kfree(bcs->hw.hscx.rcvbuf);
 			bcs->hw.hscx.rcvbuf = NULL;
 		}
-		while ((skb = skb_dequeue(&bcs->rqueue))) {
-			dev_kfree_skb(skb);
-		}
-		while ((skb = skb_dequeue(&bcs->squeue))) {
-			dev_kfree_skb(skb);
-		}
+		skb_queue_purge(&bcs->rqueue);
+		skb_queue_purge(&bcs->squeue);
 		if (bcs->tx_skb) {
 			dev_kfree_skb(bcs->tx_skb);
 			bcs->tx_skb = NULL;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/fsm.c linux/drivers/isdn/hisax/fsm.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/fsm.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/fsm.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: fsm.c,v 1.14.6.1 2001/02/16 16:43:26 kai Exp $
+/* $Id: fsm.c,v 1.14.6.2 2001/05/26 15:19:57 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
@@ -15,13 +15,16 @@
 
 #define FSM_TIMER_DEBUG 0
 
-void __init
+int __init
 FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount)
 {
 	int i;
 
 	fsm->jumpmatrix = (FSMFNPTR *)
 		kmalloc(sizeof (FSMFNPTR) * fsm->state_count * fsm->event_count, GFP_KERNEL);
+	if (!fsm->jumpmatrix)
+		return -ENOMEM;
+
 	memset(fsm->jumpmatrix, 0, sizeof (FSMFNPTR) * fsm->state_count * fsm->event_count);
 
 	for (i = 0; i < fncount; i++) 
@@ -32,6 +35,7 @@
 		} else		
 			fsm->jumpmatrix[fsm->state_count * fnlist[i].event +
 				fnlist[i].state] = (FSMFNPTR) fnlist[i].routine;
+	return 0;
 }
 
 void
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/gazel.c linux/drivers/isdn/hisax/gazel.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/gazel.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/gazel.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: gazel.c,v 2.11.6.4 2001/02/16 16:43:26 kai Exp $
+/* $Id: gazel.c,v 2.11.6.6 2001/06/08 08:48:46 kai Exp $
  *
  * gazel.c     low level stuff for Gazel isdn cards
  *
@@ -20,7 +20,7 @@
 #include <linux/isdn_compat.h>
 
 extern const char *CardType[];
-const char *gazel_revision = "$Revision: 2.11.6.4 $";
+const char *gazel_revision = "$Revision: 2.11.6.6 $";
 
 #define R647      1
 #define R685      2
@@ -440,10 +440,6 @@
 reserve_regions(struct IsdnCard *card, struct IsdnCardState *cs)
 {
 	unsigned int i, base = 0, adr = 0, len = 0;
-	long flags;
-
-	save_flags(flags);
-	cli();
 
 	switch (cs->subtyp) {
 		case R647:
@@ -488,17 +484,15 @@
 			break;
 	}
 
-	restore_flags(flags);
 	return 0;
 
       error:
-	restore_flags(flags);
 	printk(KERN_WARNING "Gazel: %s io ports 0x%x-0x%x already in use\n",
 	       CardType[cs->typ], adr, adr + len);
 	return 1;
 }
 
-static int
+static int __init
 setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs)
 {
 	printk(KERN_INFO "Gazel: ISA PnP card automatic recognition\n");
@@ -547,7 +541,7 @@
 
 static struct pci_dev *dev_tel __initdata = NULL;
 
-static int
+static int __init
 setup_gazelpci(struct IsdnCardState *cs)
 {
 	u_int pci_ioaddr0 = 0, pci_ioaddr1 = 0;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/hfc_2bds0.c linux/drivers/isdn/hisax/hfc_2bds0.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/hfc_2bds0.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/hfc_2bds0.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: hfc_2bds0.c,v 1.15.6.1 2001/02/16 16:43:26 kai Exp $
+/* $Id: hfc_2bds0.c,v 1.15.6.2 2001/06/09 15:14:17 kai Exp $
  *
  *  specific routines for CCD's HFC 2BDS0
  *
@@ -568,8 +568,8 @@
 {
 	mode_2bs0(bcs, 0, bcs->channel);
 	if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
-		discard_queue(&bcs->rqueue);
-		discard_queue(&bcs->squeue);
+		skb_queue_purge(&bcs->rqueue);
+		skb_queue_purge(&bcs->squeue);
 		if (bcs->tx_skb) {
 			dev_kfree_skb(bcs->tx_skb);
 			bcs->tx_skb = NULL;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/hfc_2bs0.c linux/drivers/isdn/hisax/hfc_2bs0.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/hfc_2bs0.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/hfc_2bs0.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: hfc_2bs0.c,v 1.17.6.1 2001/02/16 16:43:27 kai Exp $
+/* $Id: hfc_2bs0.c,v 1.17.6.2 2001/06/09 15:14:17 kai Exp $
  *
  *  specific routines for CCD's HFC 2BS0
  *
@@ -532,8 +532,8 @@
 {
 	mode_hfc(bcs, 0, bcs->channel);
 	if (test_bit(BC_FLG_INIT, &bcs->Flag)) {
-		discard_queue(&bcs->rqueue);
-		discard_queue(&bcs->squeue);
+		skb_queue_purge(&bcs->rqueue);
+		skb_queue_purge(&bcs->squeue);
 		if (bcs->tx_skb) {
 			dev_kfree_skb(bcs->tx_skb);
 			bcs->tx_skb = NULL;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/hfc_pci.c linux/drivers/isdn/hisax/hfc_pci.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/hfc_pci.c	Sun Mar 25 08:37:32 2001
+++ linux/drivers/isdn/hisax/hfc_pci.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: hfc_pci.c,v 1.34.6.4 2001/02/13 10:33:58 kai Exp $
+/* $Id: hfc_pci.c,v 1.34.6.6 2001/06/09 15:14:17 kai Exp $
 
  * hfc_pci.c     low level driver for CCD´s hfc-pci based cards
  *
@@ -36,7 +36,7 @@
 
 extern const char *CardType[];
 
-static const char *hfcpci_revision = "$Revision: 1.34.6.4 $";
+static const char *hfcpci_revision = "$Revision: 1.34.6.6 $";
 
 /* table entry in the PCI devices list */
 typedef struct {
@@ -236,6 +236,59 @@
 		return (NULL);
 }
 
+/***************************************/
+/* clear the desired B-channel rx fifo */
+/***************************************/
+static void hfcpci_clear_fifo_rx(struct IsdnCardState *cs, int fifo)
+{       u_char fifo_state;
+        bzfifo_type *bzr;
+
+	if (fifo) {
+	        bzr = &((fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxbz_b2;
+		fifo_state = cs->hw.hfcpci.fifo_en & HFCPCI_FIFOEN_B2RX;
+	} else {
+	        bzr = &((fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxbz_b1;
+		fifo_state = cs->hw.hfcpci.fifo_en & HFCPCI_FIFOEN_B1RX;
+	}
+	if (fifo_state)
+	        cs->hw.hfcpci.fifo_en ^= fifo_state;
+	Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en);
+	cs->hw.hfcpci.last_bfifo_cnt[fifo] = 0;
+	bzr->za[MAX_B_FRAMES].z1 = B_FIFO_SIZE + B_SUB_VAL - 1;
+	bzr->za[MAX_B_FRAMES].z2 = bzr->za[MAX_B_FRAMES].z1;
+	bzr->f1 = MAX_B_FRAMES;
+	bzr->f2 = bzr->f1;	/* init F pointers to remain constant */
+	if (fifo_state)
+	        cs->hw.hfcpci.fifo_en |= fifo_state;
+	Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en);
+}   
+
+/***************************************/
+/* clear the desired B-channel tx fifo */
+/***************************************/
+static void hfcpci_clear_fifo_tx(struct IsdnCardState *cs, int fifo)
+{       u_char fifo_state;
+        bzfifo_type *bzt;
+
+	if (fifo) {
+	        bzt = &((fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.txbz_b2;
+		fifo_state = cs->hw.hfcpci.fifo_en & HFCPCI_FIFOEN_B2TX;
+	} else {
+	        bzt = &((fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.txbz_b1;
+		fifo_state = cs->hw.hfcpci.fifo_en & HFCPCI_FIFOEN_B1TX;
+	}
+	if (fifo_state)
+	        cs->hw.hfcpci.fifo_en ^= fifo_state;
+	Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en);
+	bzt->za[MAX_B_FRAMES].z1 = B_FIFO_SIZE + B_SUB_VAL - 1;
+	bzt->za[MAX_B_FRAMES].z2 = bzt->za[MAX_B_FRAMES].z1;
+	bzt->f1 = MAX_B_FRAMES;
+	bzt->f2 = bzt->f1;	/* init F pointers to remain constant */
+	if (fifo_state)
+	        cs->hw.hfcpci.fifo_en |= fifo_state;
+	Write_hfc(cs, HFCPCI_FIFO_EN, cs->hw.hfcpci.fifo_en);
+}   
+
 /*********************************************/
 /* read a complete B-frame out of the buffer */
 /*********************************************/
@@ -429,7 +482,7 @@
 {
 	long flags;
 	struct IsdnCardState *cs = bcs->cs;
-	int rcnt;
+	int rcnt, real_fifo;
 	int receive, count = 5;
 	struct sk_buff *skb;
 	bzfifo_type *bz;
@@ -441,9 +494,11 @@
 	if ((bcs->channel) && (!cs->hw.hfcpci.bswapped)) {
 		bz = &((fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxbz_b2;
 		bdata = ((fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxdat_b2;
+		real_fifo = 1;
 	} else {
 		bz = &((fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxbz_b1;
 		bdata = ((fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxdat_b1;
+		real_fifo = 0;
 	}
       Begin:
 	count--;
@@ -476,6 +531,11 @@
 		rcnt = bz->f1 - bz->f2;
 		if (rcnt < 0)
 			rcnt += MAX_B_FRAMES + 1;
+		if (cs->hw.hfcpci.last_bfifo_cnt[real_fifo] > rcnt + 1) {
+		        rcnt = 0;
+			hfcpci_clear_fifo_rx(cs, real_fifo);
+		}
+		cs->hw.hfcpci.last_bfifo_cnt[real_fifo] = rcnt;
 		if (rcnt > 1)
 			receive = 1;
 		else
@@ -1254,7 +1314,6 @@
 mode_hfcpci(struct BCState *bcs, int mode, int bc)
 {
 	struct IsdnCardState *cs = bcs->cs;
-	bzfifo_type *bzr, *bzt;
 	int flags, fifo2;
 
 	if (cs->debug & L1_DEB_HSCX)
@@ -1301,6 +1360,8 @@
 			}
 			break;
 		case (L1_MODE_TRANS):
+		        hfcpci_clear_fifo_rx(cs, fifo2);
+		        hfcpci_clear_fifo_tx(cs, fifo2);
 			if (bc) {
 				cs->hw.hfcpci.sctrl |= SCTRL_B2_ENA;
 				cs->hw.hfcpci.sctrl_r |= SCTRL_B2_ENA;
@@ -1313,26 +1374,16 @@
 				cs->hw.hfcpci.int_m1 |= (HFCPCI_INTS_B2TRANS + HFCPCI_INTS_B2REC);
 				cs->hw.hfcpci.ctmt |= 2;
 				cs->hw.hfcpci.conn &= ~0x18;
-				bzr = &((fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxbz_b2;
-				bzt = &((fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.txbz_b2;
 			} else {
 				cs->hw.hfcpci.fifo_en |= HFCPCI_FIFOEN_B1;
 				cs->hw.hfcpci.int_m1 |= (HFCPCI_INTS_B1TRANS + HFCPCI_INTS_B1REC);
 				cs->hw.hfcpci.ctmt |= 1;
 				cs->hw.hfcpci.conn &= ~0x03;
-				bzr = &((fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.rxbz_b1;
-				bzt = &((fifo_area *) (cs->hw.hfcpci.fifos))->b_chans.txbz_b1;
 			}
-			bzr->za[MAX_B_FRAMES].z1 = B_FIFO_SIZE + B_SUB_VAL - 1;
-			bzr->za[MAX_B_FRAMES].z2 = bzr->za[MAX_B_FRAMES].z1;
-			bzr->f1 = MAX_B_FRAMES;
-			bzr->f2 = bzr->f1;	/* init F pointers to remain constant */
-			bzt->za[MAX_B_FRAMES].z1 = B_FIFO_SIZE + B_SUB_VAL - 1;
-			bzt->za[MAX_B_FRAMES].z2 = bzt->za[MAX_B_FRAMES].z1;
-			bzt->f1 = MAX_B_FRAMES;
-			bzt->f2 = bzt->f1;	/* init F pointers to remain constant */
 			break;
 		case (L1_MODE_HDLC):
+		        hfcpci_clear_fifo_rx(cs, fifo2);
+		        hfcpci_clear_fifo_tx(cs, fifo2);
 			if (bc) {
 				cs->hw.hfcpci.sctrl |= SCTRL_B2_ENA;
 				cs->hw.hfcpci.sctrl_r |= SCTRL_B2_ENA;
@@ -1341,11 +1392,13 @@
 				cs->hw.hfcpci.sctrl_r |= SCTRL_B1_ENA;
 			}
 			if (fifo2) {
+			        cs->hw.hfcpci.last_bfifo_cnt[1] = 0;  
 				cs->hw.hfcpci.fifo_en |= HFCPCI_FIFOEN_B2;
 				cs->hw.hfcpci.int_m1 |= (HFCPCI_INTS_B2TRANS + HFCPCI_INTS_B2REC);
 				cs->hw.hfcpci.ctmt &= ~2;
 				cs->hw.hfcpci.conn &= ~0x18;
 			} else {
+			        cs->hw.hfcpci.last_bfifo_cnt[0] = 0;  
 				cs->hw.hfcpci.fifo_en |= HFCPCI_FIFOEN_B1;
 				cs->hw.hfcpci.int_m1 |= (HFCPCI_INTS_B1TRANS + HFCPCI_INTS_B1REC);
 				cs->hw.hfcpci.ctmt &= ~1;
@@ -1445,8 +1498,8 @@
 {
 	mode_hfcpci(bcs, 0, bcs->channel);
 	if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
-		discard_queue(&bcs->rqueue);
-		discard_queue(&bcs->squeue);
+		skb_queue_purge(&bcs->rqueue);
+		skb_queue_purge(&bcs->squeue);
 		if (bcs->tx_skb) {
 			dev_kfree_skb(bcs->tx_skb);
 			bcs->tx_skb = NULL;
@@ -1634,7 +1687,8 @@
 
 #endif				/* CONFIG_PCI */
 
-int __init setup_hfcpci(struct IsdnCard *card)
+int __init
+setup_hfcpci(struct IsdnCard *card)
 {
 	struct IsdnCardState *cs = card->cs;
 	char tmp[64];
@@ -1646,7 +1700,7 @@
 #endif
 	strcpy(tmp, hfcpci_revision);
 	printk(KERN_INFO "HiSax: HFC-PCI driver Rev. %s\n", HiSax_getrev(tmp));
-#ifdef CONFIG_PCI
+#if CONFIG_PCI
 	cs->hw.hfcpci.int_s1 = 0;
 	cs->dc.hfcpci.ph_state = 0;
 	cs->hw.hfcpci.fifo = 255;
@@ -1660,6 +1714,7 @@
 			if (tmp_hfcpci) {
 				if (pci_enable_device(tmp_hfcpci))
 					continue;
+				pci_set_master(tmp_hfcpci);
 				if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->base_address[ 0] & PCI_BASE_ADDRESS_IO_MASK)))
 					continue;
 				else
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/hfc_pci.h linux/drivers/isdn/hisax/hfc_pci.h
--- linux-2.2.20-pre5/drivers/isdn/hisax/hfc_pci.h	Sun Mar 25 08:37:32 2001
+++ linux/drivers/isdn/hisax/hfc_pci.h	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: hfc_pci.h,v 1.8 2000/06/26 08:59:13 keil Exp $
+/* $Id: hfc_pci.h,v 1.8.6.1 2001/04/08 19:32:26 kai Exp $
  *
  *  specific defines for CCD's HFC 2BDS0 PCI chips
  *
@@ -178,6 +178,9 @@
 #define HFCPCI_FIFOEN_B1     0x03
 #define HFCPCI_FIFOEN_B2     0x0C
 #define HFCPCI_FIFOEN_DTX    0x10
+#define HFCPCI_FIFOEN_B1TX   0x01
+#define HFCPCI_FIFOEN_B1RX   0x02
+#define HFCPCI_FIFOEN_B2TX   0x04
 #define HFCPCI_FIFOEN_B2RX   0x08
 
 
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/hfc_sx.c linux/drivers/isdn/hisax/hfc_sx.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/hfc_sx.c	Sun Mar 25 08:37:33 2001
+++ linux/drivers/isdn/hisax/hfc_sx.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: hfc_sx.c,v 1.9 2000/11/24 17:05:37 kai Exp $
+/* $Id: hfc_sx.c,v 1.9.6.1 2001/06/09 15:14:17 kai Exp $
 
  * hfc_sx.c     low level driver for CCD´s hfc-s+/sp based cards
  *
@@ -32,7 +32,7 @@
 
 extern const char *CardType[];
 
-static const char *hfcsx_revision = "$Revision: 1.9 $";
+static const char *hfcsx_revision = "$Revision: 1.9.6.1 $";
 
 /***************************************/
 /* IRQ-table for CCDs demo board       */
@@ -1288,8 +1288,8 @@
 {
 	mode_hfcsx(bcs, 0, bcs->channel);
 	if (test_and_clear_bit(BC_FLG_INIT, &bcs->Flag)) {
-		discard_queue(&bcs->rqueue);
-		discard_queue(&bcs->squeue);
+		skb_queue_purge(&bcs->rqueue);
+		skb_queue_purge(&bcs->squeue);
 		if (bcs->tx_skb) {
 			dev_kfree_skb(bcs->tx_skb);
 			bcs->tx_skb = NULL;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/hisax.h linux/drivers/isdn/hisax/hisax.h
--- linux-2.2.20-pre5/drivers/isdn/hisax/hisax.h	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/hisax.h	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: hisax.h,v 2.52.6.3 2001/02/16 16:43:27 kai Exp $
+/* $Id: hisax.h,v 2.52.6.6 2001/06/09 15:14:17 kai Exp $
  *
  *   Basic declarations, defines and prototypes
  *
@@ -686,6 +686,7 @@
         unsigned char *pci_io; /* start of PCI IO memory */
         void *share_start; /* shared memory for Fifos start */
         void *fifos; /* FIFO memory */ 
+        int last_bfifo_cnt[2]; /* marker saving last b-fifo frame count */
 	struct timer_list timer;
 };
 
@@ -1302,7 +1303,7 @@
 int getcallref(u_char * p);
 int newcallref(void);
 
-void FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount);
+int FsmNew(struct Fsm *fsm, struct FsmNode *fnlist, int fncount);
 void FsmFree(struct Fsm *fsm);
 int FsmEvent(struct FsmInst *fi, int event, void *arg);
 void FsmChangeState(struct FsmInst *fi, int newstate);
@@ -1323,7 +1324,6 @@
 void LogFrame(struct IsdnCardState *cs, u_char * p, int size);
 void dlogframe(struct IsdnCardState *cs, struct sk_buff *skb, int dir);
 void iecpy(u_char * dest, u_char * iestart, int ieoffset);
-int discard_queue(struct sk_buff_head *q);
 #ifdef ISDN_CHIP_ISAC
 void setstack_isac(struct PStack *st, struct IsdnCardState *cs);
 #endif	/* ISDN_CHIP_ISAC */
@@ -1333,19 +1333,19 @@
 
 int ll_run(struct IsdnCardState *cs, int addfeatures);
 void ll_stop(struct IsdnCardState *cs);
-void CallcNew(void);
+int CallcNew(void);
 void CallcFree(void);
 int CallcNewChan(struct IsdnCardState *cs);
 void CallcFreeChan(struct IsdnCardState *cs);
-void Isdnl1New(void);
+int Isdnl1New(void);
 void Isdnl1Free(void);
-void Isdnl2New(void);
+int Isdnl2New(void);
 void Isdnl2Free(void);
-void Isdnl3New(void);
+int Isdnl3New(void);
 void Isdnl3Free(void);
 void init_tei(struct IsdnCardState *cs, int protocol);
 void release_tei(struct IsdnCardState *cs);
 char *HiSax_getrev(const char *revision);
-void TeiNew(void);
+int TeiNew(void);
 void TeiFree(void);
 int certification_check(int output);
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/hscx.c linux/drivers/isdn/hisax/hscx.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/hscx.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/hscx.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: hscx.c,v 1.21.6.1 2001/02/16 16:43:27 kai Exp $
+/* $Id: hscx.c,v 1.21.6.2 2001/06/09 15:14:17 kai Exp $
  *
  * hscx.c   HSCX specific routines
  *
@@ -166,8 +166,8 @@
 			kfree(bcs->blog);
 			bcs->blog = NULL;
 		}
-		discard_queue(&bcs->rqueue);
-		discard_queue(&bcs->squeue);
+		skb_queue_purge(&bcs->rqueue);
+		skb_queue_purge(&bcs->squeue);
 		if (bcs->tx_skb) {
 			dev_kfree_skb(bcs->tx_skb);
 			bcs->tx_skb = NULL;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/icc.c linux/drivers/isdn/hisax/icc.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/icc.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/icc.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-// $Id: icc.c,v 1.5.6.2 2001/03/13 16:17:08 kai Exp $
+// $Id: icc.c,v 1.5.6.3 2001/06/09 15:14:17 kai Exp $
 //-----------------------------------------------------------------------------
 //
 // ICC specific routines
@@ -551,8 +551,8 @@
 			}
 			break;
 		case (HW_DEACTIVATE | RESPONSE):
-			discard_queue(&cs->rq);
-			discard_queue(&cs->sq);
+			skb_queue_purge(&cs->rq);
+			skb_queue_purge(&cs->sq);
 			if (cs->tx_skb) {
 				dev_kfree_skb(cs->tx_skb);
 				cs->tx_skb = NULL;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/isac.c linux/drivers/isdn/hisax/isac.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/isac.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/isac.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: isac.c,v 1.28.6.1 2001/02/16 16:43:27 kai Exp $
+/* $Id: isac.c,v 1.28.6.2 2001/06/09 15:14:17 kai Exp $
  *
  * isac.c   ISAC specific routines
  *
@@ -549,8 +549,8 @@
 			}
 			break;
 		case (HW_DEACTIVATE | RESPONSE):
-			discard_queue(&cs->rq);
-			discard_queue(&cs->sq);
+			skb_queue_purge(&cs->rq);
+			skb_queue_purge(&cs->sq);
 			if (cs->tx_skb) {
 				dev_kfree_skb(cs->tx_skb);
 				cs->tx_skb = NULL;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/isar.c linux/drivers/isdn/hisax/isar.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/isar.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/isar.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: isar.c,v 1.17.6.1 2001/02/16 16:43:27 kai Exp $
+/* $Id: isar.c,v 1.17.6.3 2001/06/09 15:14:17 kai Exp $
  *
  * isar.c   ISAR (Siemens PSB 7110) specific routines
  *
@@ -383,12 +383,12 @@
 	} else {
 		printk(KERN_DEBUG"isar selftest not OK %x/%x/%x\n",
 			ireg->cmsb, ireg->clsb, ireg->par[0]);
-		ret = 1;goto reterror;
+		ret = 1;goto reterrflg;
 	}
 	ireg->iis = 0;
 	if (!sendmsg(cs, ISAR_HIS_DIAG, ISAR_CTRL_SWVER, 0, NULL)) {
 		printk(KERN_ERR"isar RQST SVN failed\n");
-		ret = 1;goto reterror;
+		ret = 1;goto reterrflg;
 	}
 	cnt = 30000; /* max 300 ms */
 	while ((ireg->iis != ISAR_IIS_DIAG) && cnt) {
@@ -1650,8 +1650,8 @@
 			kfree(bcs->hw.isar.rcvbuf);
 			bcs->hw.isar.rcvbuf = NULL;
 		}
-		discard_queue(&bcs->rqueue);
-		discard_queue(&bcs->squeue);
+		skb_queue_purge(&bcs->rqueue);
+		skb_queue_purge(&bcs->squeue);
 		if (bcs->tx_skb) {
 			dev_kfree_skb(bcs->tx_skb);
 			bcs->tx_skb = NULL;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/isdnl1.c linux/drivers/isdn/hisax/isdnl1.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/isdnl1.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/isdnl1.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: isdnl1.c,v 2.41.6.2 2001/02/16 16:43:27 kai Exp $
+/* $Id: isdnl1.c,v 2.41.6.3 2001/05/26 15:19:57 kai Exp $
  *
  * isdnl1.c     common low level stuff for Siemens Chipsetbased isdn cards
  *              based on the teles driver from Jan den Ouden
@@ -15,7 +15,7 @@
  *
  */
 
-const char *l1_revision = "$Revision: 2.41.6.2 $";
+const char *l1_revision = "$Revision: 2.41.6.3 $";
 
 #define __NO_VERSION__
 #include <linux/init.h>
@@ -736,26 +736,41 @@
 
 #define L1B_FN_COUNT (sizeof(L1BFnList)/sizeof(struct FsmNode))
 
-void __init 
+int __init 
 Isdnl1New(void)
 {
-#ifdef HISAX_UINTERFACE
-	l1fsm_u.state_count = L1U_STATE_COUNT;
-	l1fsm_u.event_count = L1_EVENT_COUNT;
-	l1fsm_u.strEvent = strL1Event;
-	l1fsm_u.strState = strL1UState;
-	FsmNew(&l1fsm_u, L1UFnList, L1U_FN_COUNT);
-#endif
+	int retval;
+
 	l1fsm_s.state_count = L1S_STATE_COUNT;
 	l1fsm_s.event_count = L1_EVENT_COUNT;
 	l1fsm_s.strEvent = strL1Event;
 	l1fsm_s.strState = strL1SState;
-	FsmNew(&l1fsm_s, L1SFnList, L1S_FN_COUNT);
+	retval = FsmNew(&l1fsm_s, L1SFnList, L1S_FN_COUNT);
+	if (retval)
+		return retval;
+
 	l1fsm_b.state_count = L1B_STATE_COUNT;
 	l1fsm_b.event_count = L1_EVENT_COUNT;
 	l1fsm_b.strEvent = strL1Event;
 	l1fsm_b.strState = strL1BState;
-	FsmNew(&l1fsm_b, L1BFnList, L1B_FN_COUNT);
+	retval = FsmNew(&l1fsm_b, L1BFnList, L1B_FN_COUNT);
+	if (retval) {
+		FsmFree(&l1fsm_s);
+		return retval;
+	}
+#ifdef HISAX_UINTERFACE
+	l1fsm_u.state_count = L1U_STATE_COUNT;
+	l1fsm_u.event_count = L1_EVENT_COUNT;
+	l1fsm_u.strEvent = strL1Event;
+	l1fsm_u.strState = strL1UState;
+	retval = FsmNew(&l1fsm_u, L1UFnList, L1U_FN_COUNT);
+	if (retval) {
+		FsmFree(&l1fsm_s);
+		FsmFree(&l1fsm_b);
+		return retval;
+	}
+#endif
+	return 0;
 }
 
 void Isdnl1Free(void)
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/isdnl2.c linux/drivers/isdn/hisax/isdnl2.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/isdnl2.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/isdnl2.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: isdnl2.c,v 2.25.6.1 2001/02/16 16:43:27 kai Exp $
+/* $Id: isdnl2.c,v 2.25.6.3 2001/06/09 15:14:17 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
@@ -16,7 +16,7 @@
 #include "hisax.h"
 #include "isdnl2.h"
 
-const char *l2_revision = "$Revision: 2.25.6.1 $";
+const char *l2_revision = "$Revision: 2.25.6.3 $";
 
 static void l2m_debug(struct FsmInst *fi, char *fmt, ...);
 
@@ -649,7 +649,7 @@
 {
 	struct PStack *st = fi->userdata;
 
-	discard_queue(&st->l2.i_queue);
+	skb_queue_purge(&st->l2.i_queue);
 	test_and_set_bit(FLG_L3_INIT, &st->l2.flag);
 	test_and_clear_bit(FLG_PEND_REL, &st->l2.flag);
 }
@@ -659,7 +659,7 @@
 {
 	struct PStack *st = fi->userdata;
 
-	discard_queue(&st->l2.i_queue);
+	skb_queue_purge(&st->l2.i_queue);
 	establishlink(fi);
 	test_and_set_bit(FLG_L3_INIT, &st->l2.flag);
 }
@@ -685,7 +685,7 @@
 {
 	struct PStack *st = fi->userdata;
 
-	discard_queue(&st->l2.i_queue);
+	skb_queue_purge(&st->l2.i_queue);
 	freewin(st);
 	FsmChangeState(fi, ST_L2_6);
 	st->l2.rc = 0;
@@ -745,7 +745,7 @@
 	st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'F');
 
 	if (st->l2.vs != st->l2.va) {
-		discard_queue(&st->l2.i_queue);
+		skb_queue_purge(&st->l2.i_queue);
 		est = 1;
 	}
 
@@ -778,7 +778,7 @@
 
 	send_uframe(st, UA | get_PollFlagFree(st, skb), RSP);
 
-	discard_queue(&st->l2.i_queue);
+	skb_queue_purge(&st->l2.i_queue);
 	freewin(st);
 	lapb_dl_release_l2l3(st, INDICATION);
 }
@@ -802,7 +802,7 @@
 	if (test_and_clear_bit(FLG_L3_INIT, &st->l2.flag)) {
 		pr = DL_ESTABLISH | CONFIRM;
 	} else if (st->l2.vs != st->l2.va) {
-		discard_queue(&st->l2.i_queue);
+		skb_queue_purge(&st->l2.i_queue);
 		pr = DL_ESTABLISH | INDICATION;
 	}
 
@@ -860,7 +860,7 @@
 	if (get_PollFlagFree(st, skb)) {
 		stop_t200(st, 7);
 	 	if (!test_bit(FLG_L3_INIT, &st->l2.flag))
-			discard_queue(&st->l2.i_queue);
+			skb_queue_purge(&st->l2.i_queue);
 		if (test_bit(FLG_LAPB, &st->l2.flag))
 			st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL);
 		st5_dl_release_l2l3(st);
@@ -1156,7 +1156,7 @@
 	} else if (st->l2.rc == st->l2.N200) {
 		FsmChangeState(fi, ST_L2_4);
 		test_and_clear_bit(FLG_T200_RUN, &st->l2.flag);
-		discard_queue(&st->l2.i_queue);
+		skb_queue_purge(&st->l2.i_queue);
 		st->ma.layer(st, MDL_ERROR | INDICATION, (void *) 'G');
 		if (test_bit(FLG_LAPB, &st->l2.flag))
 			st->l2.l2l1(st, PH_DEACTIVATE | REQUEST, NULL);
@@ -1388,7 +1388,7 @@
 {
 	struct PStack *st = fi->userdata;
 
-	discard_queue(&st->l2.ui_queue);
+	skb_queue_purge(&st->l2.ui_queue);
 	st->l2.tei = -1;
 	FsmChangeState(fi, ST_L2_1);
 }
@@ -1398,7 +1398,7 @@
 {
 	struct PStack *st = fi->userdata;
 
-	discard_queue(&st->l2.ui_queue);
+	skb_queue_purge(&st->l2.ui_queue);
 	st->l2.tei = -1;
 	st->l2.l2l3(st, DL_RELEASE | INDICATION, NULL);
 	FsmChangeState(fi, ST_L2_1);
@@ -1409,8 +1409,8 @@
 {
 	struct PStack *st = fi->userdata;
 
-	discard_queue(&st->l2.i_queue);
-	discard_queue(&st->l2.ui_queue);
+	skb_queue_purge(&st->l2.i_queue);
+	skb_queue_purge(&st->l2.ui_queue);
 	freewin(st);
 	st->l2.tei = -1;
 	stop_t200(st, 17);
@@ -1423,7 +1423,7 @@
 {
 	struct PStack *st = fi->userdata;
 
-	discard_queue(&st->l2.ui_queue);
+	skb_queue_purge(&st->l2.ui_queue);
 	st->l2.tei = -1;
 	stop_t200(st, 18);
 	st->l2.l2l3(st, DL_RELEASE | CONFIRM, NULL);
@@ -1435,8 +1435,8 @@
 {
 	struct PStack *st = fi->userdata;
 
-	discard_queue(&st->l2.i_queue);
-	discard_queue(&st->l2.ui_queue);
+	skb_queue_purge(&st->l2.i_queue);
+	skb_queue_purge(&st->l2.ui_queue);
 	freewin(st);
 	st->l2.tei = -1;
 	stop_t200(st, 17);
@@ -1450,8 +1450,8 @@
 {
 	struct PStack *st = fi->userdata;
 	
-	discard_queue(&st->l2.i_queue);
-	discard_queue(&st->l2.ui_queue);
+	skb_queue_purge(&st->l2.i_queue);
+	skb_queue_purge(&st->l2.ui_queue);
 	if (test_and_clear_bit(FLG_ESTAB_PEND, &st->l2.flag))
 		st->l2.l2l3(st, DL_RELEASE | INDICATION, NULL);
 }
@@ -1461,8 +1461,8 @@
 {
 	struct PStack *st = fi->userdata;
 
-	discard_queue(&st->l2.i_queue);
-	discard_queue(&st->l2.ui_queue);
+	skb_queue_purge(&st->l2.i_queue);
+	skb_queue_purge(&st->l2.ui_queue);
 	freewin(st);
 	stop_t200(st, 19);
 	st5_dl_release_l2l3(st);
@@ -1474,7 +1474,7 @@
 {
 	struct PStack *st = fi->userdata;
 
-	discard_queue(&st->l2.ui_queue);
+	skb_queue_purge(&st->l2.ui_queue);
 	stop_t200(st, 20);
 	st->l2.l2l3(st, DL_RELEASE | CONFIRM, NULL);
 	FsmChangeState(fi, ST_L2_4);
@@ -1485,8 +1485,8 @@
 {
 	struct PStack *st = fi->userdata;
 
-	discard_queue(&st->l2.i_queue);
-	discard_queue(&st->l2.ui_queue);
+	skb_queue_purge(&st->l2.i_queue);
+	skb_queue_purge(&st->l2.ui_queue);
 	freewin(st);
 	stop_t200(st, 19);
 	FsmDelTimer(&st->l2.t203, 19);
@@ -1761,8 +1761,8 @@
 {
 	FsmDelTimer(&st->l2.t200, 21);
 	FsmDelTimer(&st->l2.t203, 16);
-	discard_queue(&st->l2.i_queue);
-	discard_queue(&st->l2.ui_queue);
+	skb_queue_purge(&st->l2.i_queue);
+	skb_queue_purge(&st->l2.ui_queue);
 	ReleaseWin(&st->l2);
 }
 
@@ -1831,14 +1831,14 @@
 {
 }
 
-void __init
+int __init
 Isdnl2New(void)
 {
 	l2fsm.state_count = L2_STATE_COUNT;
 	l2fsm.event_count = L2_EVENT_COUNT;
 	l2fsm.strEvent = strL2Event;
 	l2fsm.strState = strL2State;
-	FsmNew(&l2fsm, L2FnList, L2_FN_COUNT);
+	return FsmNew(&l2fsm, L2FnList, L2_FN_COUNT);
 }
 
 void
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/isdnl3.c linux/drivers/isdn/hisax/isdnl3.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/isdnl3.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/isdnl3.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: isdnl3.c,v 2.17.6.2 2001/02/16 16:43:27 kai Exp $
+/* $Id: isdnl3.c,v 2.17.6.4 2001/06/09 15:14:17 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
@@ -18,7 +18,7 @@
 #include "isdnl3.h"
 #include <linux/config.h>
 
-const char *l3_revision = "$Revision: 2.17.6.2 $";
+const char *l3_revision = "$Revision: 2.17.6.4 $";
 
 static struct Fsm l3fsm;
 
@@ -404,7 +404,7 @@
 		st->l3.global = NULL;
 	}
 	FsmDelTimer(&st->l3.l3m_timer, 54);
-	discard_queue(&st->l3.squeue);
+	skb_queue_purge(&st->l3.squeue);
 }
 
 void
@@ -520,7 +520,7 @@
 
 	FsmDelTimer(&st->l3.l3m_timer, 52);
 	FsmChangeState(fi, ST_L3_LC_REL);
-	discard_queue(&st->l3.squeue);
+	skb_queue_purge(&st->l3.squeue);
 	l3ml3p(st, DL_RELEASE | INDICATION);
 }
 
@@ -530,7 +530,7 @@
 	struct PStack *st = fi->userdata;
 
 	FsmChangeState(fi, ST_L3_LC_REL);
-	discard_queue(&st->l3.squeue);
+	skb_queue_purge(&st->l3.squeue);
 	l3ml3p(st, DL_RELEASE | CONFIRM);
 }
 
@@ -591,14 +591,14 @@
 	}
 }
 
-void __init
+int __init
 Isdnl3New(void)
 {
 	l3fsm.state_count = L3_STATE_COUNT;
 	l3fsm.event_count = L3_EVENT_COUNT;
 	l3fsm.strEvent = strL3Event;
 	l3fsm.strState = strL3State;
-	FsmNew(&l3fsm, L3FnList, L3_FN_COUNT);
+	return FsmNew(&l3fsm, L3FnList, L3_FN_COUNT);
 }
 
 void
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/jade.c linux/drivers/isdn/hisax/jade.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/jade.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/jade.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: jade.c,v 1.6.6.1 2001/02/16 16:43:27 kai Exp $
+/* $Id: jade.c,v 1.6.6.2 2001/06/09 15:14:18 kai Exp $
  *
  * jade.c   JADE stuff (derived from original hscx.c)
  *
@@ -209,8 +209,8 @@
 		kfree(bcs->blog);
 		bcs->blog = NULL;
 	}
-	discard_queue(&bcs->rqueue);
-	discard_queue(&bcs->squeue);
+	skb_queue_purge(&bcs->rqueue);
+	skb_queue_purge(&bcs->squeue);
 	if (bcs->tx_skb) {
 		dev_kfree_skb(bcs->tx_skb);
 		bcs->tx_skb = NULL;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/l3dss1.c linux/drivers/isdn/hisax/l3dss1.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/l3dss1.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/l3dss1.c	Mon Dec  3 22:19:41 2001
@@ -1599,7 +1599,7 @@
 	 * Bearer Capabilities
 	 */
 	p = skb->data;
-	/* only the first occurrence 'll be detected ! */
+	/* only the first occurence 'll be detected ! */
 	if ((p = findie(p, skb->len, 0x04, 0))) {
 		if ((p[1] < 2) || (p[1] > 11))
 			err = 1;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/l3ni1.c linux/drivers/isdn/hisax/l3ni1.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/l3ni1.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/l3ni1.c	Mon Dec  3 22:19:41 2001
@@ -1458,7 +1458,7 @@
 	 * Bearer Capabilities
 	 */
 	p = skb->data;
-	/* only the first occurrence 'll be detected ! */
+	/* only the first occurence 'll be detected ! */
 	if ((p = findie(p, skb->len, 0x04, 0))) {
 		if ((p[1] < 2) || (p[1] > 11))
 			err = 1;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/netjet.c linux/drivers/isdn/hisax/netjet.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/netjet.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/netjet.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: netjet.c,v 1.24.6.4 2001/02/16 16:43:28 kai Exp $
+/* $Id: netjet.c,v 1.24.6.5 2001/06/09 15:14:18 kai Exp $
  *
  * netjet.c     low level stuff for Traverse Technologie NETJet ISDN cards
  *
@@ -22,7 +22,7 @@
 #include <asm/io.h>
 #include "netjet.h"
 
-const char *NETjet_revision = "$Revision: 1.24.6.4 $";
+const char *NETjet_revision = "$Revision: 1.24.6.5 $";
 
 /* Interface functions */
 
@@ -880,8 +880,8 @@
 			kfree(bcs->hw.tiger.sendbuf);
 			bcs->hw.tiger.sendbuf = NULL;
 		}
-		discard_queue(&bcs->rqueue);
-		discard_queue(&bcs->squeue);
+		skb_queue_purge(&bcs->rqueue);
+		skb_queue_purge(&bcs->squeue);
 		if (bcs->tx_skb) {
 			dev_kfree_skb(bcs->tx_skb);
 			bcs->tx_skb = NULL;
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/tei.c linux/drivers/isdn/hisax/tei.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/tei.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/tei.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: tei.c,v 2.17.6.1 2001/02/16 16:43:29 kai Exp $
+/* $Id: tei.c,v 2.17.6.2 2001/05/26 15:19:57 kai Exp $
  *
  * Author       Karsten Keil (keil@isdn4linux.de)
  *              based on the teles driver from Jan den Ouden
@@ -17,7 +17,7 @@
 #include <linux/init.h>
 #include <linux/random.h>
 
-const char *tei_revision = "$Revision: 2.17.6.1 $";
+const char *tei_revision = "$Revision: 2.17.6.2 $";
 
 #define ID_REQUEST	1
 #define ID_ASSIGNED	2
@@ -446,14 +446,14 @@
 
 #define TEI_FN_COUNT (sizeof(TeiFnList)/sizeof(struct FsmNode))
 
-void __init
+int __init
 TeiNew(void)
 {
 	teifsm.state_count = TEI_STATE_COUNT;
 	teifsm.event_count = TEI_EVENT_COUNT;
 	teifsm.strEvent = strTeiEvent;
 	teifsm.strState = strTeiState;
-	FsmNew(&teifsm, TeiFnList, TEI_FN_COUNT);
+	return FsmNew(&teifsm, TeiFnList, TEI_FN_COUNT);
 }
 
 void
diff -urN linux-2.2.20-pre5/drivers/isdn/hisax/w6692.c linux/drivers/isdn/hisax/w6692.c
--- linux-2.2.20-pre5/drivers/isdn/hisax/w6692.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/hisax/w6692.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: w6692.c,v 1.12.6.4 2001/02/16 16:43:29 kai Exp $
+/* $Id: w6692.c,v 1.12.6.5 2001/06/09 15:14:18 kai Exp $
  *
  * w6692.c   Winbond W6692 specific routines
  *
@@ -36,7 +36,7 @@
 
 extern const char *CardType[];
 
-const char *w6692_revision = "$Revision: 1.12.6.4 $";
+const char *w6692_revision = "$Revision: 1.12.6.5 $";
 
 #define DBUSY_TIMER_VALUE 80
 
@@ -642,8 +642,8 @@
 			/* !!! not implemented yet */
 			break;
 		case (HW_DEACTIVATE | RESPONSE):
-			discard_queue(&cs->rq);
-			discard_queue(&cs->sq);
+			skb_queue_purge(&cs->rq);
+			skb_queue_purge(&cs->sq);
 			if (cs->tx_skb) {
 				dev_kfree_skb(cs->tx_skb);
 				cs->tx_skb = NULL;
@@ -806,8 +806,8 @@
 			kfree(bcs->blog);
 			bcs->blog = NULL;
 		}
-		discard_queue(&bcs->rqueue);
-		discard_queue(&bcs->squeue);
+		skb_queue_purge(&bcs->rqueue);
+		skb_queue_purge(&bcs->squeue);
 		if (bcs->tx_skb) {
 			dev_kfree_skb(bcs->tx_skb);
 			bcs->tx_skb = NULL;
diff -urN linux-2.2.20-pre5/drivers/isdn/icn/icn.c linux/drivers/isdn/icn/icn.c
--- linux-2.2.20-pre5/drivers/isdn/icn/icn.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/icn/icn.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: icn.c,v 1.65.6.3 2001/02/16 16:43:31 kai Exp $
+/* $Id: icn.c,v 1.65.6.5 2001/06/09 15:14:19 kai Exp $
 
  * ISDN low-level module for the ICN active ISDN-Card.
  *
@@ -34,7 +34,7 @@
 #undef MAP_DEBUG
 
 static char
-*revision = "$Revision: 1.65.6.3 $";
+*revision = "$Revision: 1.65.6.5 $";
 
 static int icn_addcard(int, char *, char *);
 
@@ -51,8 +51,7 @@
 	struct sk_buff *skb;
 	unsigned long flags;
 
-	while ((skb = skb_dequeue(queue)))
-		dev_kfree_skb(skb);
+	skb_queue_purge(queue);
 	save_flags(flags);
 	cli();
 	card->xlen[channel] = 0;
@@ -838,23 +837,23 @@
 			card->other->rvalid = 1;
 	}
 	if (!dev.mvalid) {
-		if (check_shmem((ulong) dev.shmem, 0x4000)) {
+		if (check_mem_region(dev.memaddr, 0x4000)) {
 			printk(KERN_WARNING
-			       "icn: memory at 0x%08lx in use.\n",
-			       (ulong) dev.shmem);
+			       "icn: memory at 0x%08lx in use.\n", dev.memaddr);
 			restore_flags(flags);
 			return -EBUSY;
 		}
-		request_shmem((ulong) dev.shmem, 0x4000, "icn");
+		request_mem_region(dev.memaddr, 0x4000, "icn-isdn (all cards)");
+		dev.shmem = ioremap(dev.memaddr, 0x4000);
 		dev.mvalid = 1;
 	}
 	restore_flags(flags);
 	OUTB_P(0, ICN_RUN);     /* Reset Controller */
 	OUTB_P(0, ICN_MAPRAM);  /* Disable RAM      */
 	icn_shiftout(ICN_CFG, 0x0f, 3, 4);	/* Windowsize= 16k  */
-	icn_shiftout(ICN_CFG, (unsigned long) dev.shmem, 23, 10);	/* Set RAM-Addr.    */
+	icn_shiftout(ICN_CFG, dev.memaddr, 23, 10);	/* Set RAM-Addr.    */
 #ifdef BOOT_DEBUG
-	printk(KERN_DEBUG "shmem=%08lx\n", (ulong) dev.shmem);
+	printk(KERN_DEBUG "shmem=%08lx\n", dev.memaddr);
 #endif
 	SLEEP(1);
 #ifdef BOOT_DEBUG
@@ -1177,29 +1176,31 @@
 			memcpy(&a, c->parm.num, sizeof(ulong));
 			switch (c->arg) {
 				case ICN_IOCTL_SETMMIO:
-					if ((unsigned long) dev.shmem != (a & 0x0ffc000)) {
-						if (check_shmem((ulong) (a & 0x0ffc000), 0x4000)) {
+					if (dev.memaddr != (a & 0x0ffc000)) {
+						if (check_mem_region(a & 0x0ffc000, 0x4000)) {
 							printk(KERN_WARNING
 							       "icn: memory at 0x%08lx in use.\n",
-							       (ulong) (a & 0x0ffc000));
+							       a & 0x0ffc000);
 							return -EINVAL;
 						}
 						icn_stopallcards();
 						save_flags(flags);
 						cli();
-						if (dev.mvalid)
-							release_shmem((ulong) dev.shmem, 0x4000);
+						if (dev.mvalid) {
+							iounmap(dev.shmem);
+							release_mem_region(dev.memaddr, 0x4000);
+						}
 						dev.mvalid = 0;
-						dev.shmem = (icn_shmem *) (a & 0x0ffc000);
+						dev.memaddr = a & 0x0ffc000;
 						restore_flags(flags);
 						printk(KERN_INFO
 						       "icn: (%s) mmio set to 0x%08lx\n",
 						       CID,
-						       (unsigned long) dev.shmem);
+						       dev.memaddr);
 					}
 					break;
 				case ICN_IOCTL_GETMMIO:
-					return (long) dev.shmem;
+					return (long) dev.memaddr;
 				case ICN_IOCTL_SETPORT:
 					if (a == 0x300 || a == 0x310 || a == 0x320 || a == 0x330
 					    || a == 0x340 || a == 0x350 || a == 0x360 ||
@@ -1649,7 +1650,7 @@
 	if (ints[0])
 		portbase = ints[1];
 	if (ints[0] > 1)
-		membase = ints[2];
+		membase = (unsigned long)ints[2];
 	if (str && *str) {
 		strcpy(sid, str);
 		icn_id = sid;
@@ -1668,7 +1669,7 @@
 	char rev[10];
 
 	memset(&dev, 0, sizeof(icn_dev));
-	dev.shmem = (icn_shmem *) ((unsigned long) membase & 0x0ffc000);
+	dev.memaddr = (membase & 0x0ffc000);
 	dev.channel = -1;
 	dev.mcard = NULL;
 	dev.firstload = 1;
@@ -1680,7 +1681,7 @@
 	} else
 		strcpy(rev, " ??? ");
 	printk(KERN_NOTICE "ICN-ISDN-driver Rev%smem=0x%08lx\n", rev,
-	       (ulong) dev.shmem);
+	       dev.memaddr);
 	return (icn_addcard(portbase, icn_id, icn_id2));
 }
 
@@ -1714,8 +1715,10 @@
 		card = card->next;
 		kfree(last);
 	}
-	if (dev.mvalid)
-		release_shmem((ulong) dev.shmem, 0x4000);
+	if (dev.mvalid) {
+		iounmap(dev.shmem);
+		release_mem_region(dev.memaddr, 0x4000);
+	}
 	printk(KERN_NOTICE "ICN-ISDN-driver unloaded\n");
 }
 
diff -urN linux-2.2.20-pre5/drivers/isdn/icn/icn.h linux/drivers/isdn/icn/icn.h
--- linux-2.2.20-pre5/drivers/isdn/icn/icn.h	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/icn/icn.h	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: icn.h,v 1.30.6.2 2001/02/16 16:43:31 kai Exp $
+/* $Id: icn.h,v 1.30.6.3 2001/04/20 02:42:01 keil Exp $
 
  * ISDN lowlevel-module for the ICN active ISDN-Card.
  *
@@ -187,6 +187,7 @@
  * Main driver data
  */
 typedef struct icn_dev {
+	unsigned long memaddr;	/* Address of memory mapped buffers */
 	icn_shmem *shmem;       /* Pointer to memory-mapped-buffers */
 	int mvalid;             /* IO-shmem has been requested      */
 	int channel;            /* Currently mapped channel         */
@@ -210,7 +211,7 @@
  * integers.
  */
 static int portbase = ICN_BASEADDR;
-static int membase = ICN_MEMADDR;
+static unsigned long membase = ICN_MEMADDR;
 static char *icn_id = "\0";
 static char *icn_id2 = "\0";
 
@@ -218,7 +219,7 @@
 MODULE_AUTHOR("Fritz Elfert");
 MODULE_PARM(portbase, "i");
 MODULE_PARM_DESC(portbase, "Port address of first card");
-MODULE_PARM(membase, "i");
+MODULE_PARM(membase, "l");
 MODULE_PARM_DESC(membase, "Shared memory address of all cards");
 MODULE_PARM(icn_id, "s");
 MODULE_PARM_DESC(icn_id, "ID-String of first card");
@@ -286,14 +287,6 @@
 
 #define MIN(a,b) ((a<b)?a:b)
 #define MAX(a,b) ((a>b)?a:b)
-
-/* Hopefully, a separate resource-registration-scheme for shared-memory
- * will be introduced into the kernel. Until then, we use the normal
- * routines, designed for port-registration.
- */
-#define check_shmem   check_region
-#define release_shmem release_region
-#define request_shmem request_region
 
 #endif                          /* defined(__KERNEL__) || defined(__DEBUGVAR__) */
 #endif                          /* icn_h */
diff -urN linux-2.2.20-pre5/drivers/isdn/isdn_common.c linux/drivers/isdn/isdn_common.c
--- linux-2.2.20-pre5/drivers/isdn/isdn_common.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/isdn_common.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: isdn_common.c,v 1.114.6.8 2001/02/16 16:43:22 kai Exp $
+/* $Id: isdn_common.c,v 1.114.6.12 2001/06/09 15:14:15 kai Exp $
 
  * Linux ISDN subsystem, common used functions (linklevel).
  *
@@ -50,7 +50,7 @@
 
 isdn_dev *dev;
 
-static char *isdn_revision = "$Revision: 1.114.6.8 $";
+static char *isdn_revision = "$Revision: 1.114.6.12 $";
 
 extern char *isdn_net_revision;
 extern char *isdn_tty_revision;
@@ -230,20 +230,6 @@
 	return isdn_wildmat( TmpMsn1, TmpMsn2 );
 }
 
-static void
-isdn_free_queue(struct sk_buff_head *queue)
-{
-	struct sk_buff *skb;
-	unsigned long flags;
-
-	save_flags(flags);
-	cli();
-	if (skb_queue_len(queue))
-		while ((skb = skb_dequeue(queue)))
-			dev_kfree_skb(skb);
-	restore_flags(flags);
-}
-
 int
 isdn_dc2minor(int di, int ch)
 {
@@ -740,7 +726,7 @@
 			kfree(dev->drv[di]->rcverr);
 			kfree(dev->drv[di]->rcvcount);
 			for (i = 0; i < dev->drv[di]->channels; i++)
-				isdn_free_queue(&dev->drv[di]->rpqueue[i]);
+				skb_queue_purge(&dev->drv[di]->rpqueue[i]);
 			kfree(dev->drv[di]->rpqueue);
 			kfree(dev->drv[di]->rcv_waitq);
 			kfree(dev->drv[di]);
@@ -1869,7 +1855,7 @@
 			dev->v110[i] = NULL;
 // 20.10.99 JIM, try to reinitialize v110 !
 			isdn_info_update();
-			isdn_free_queue(&dev->drv[di]->rpqueue[ch]);
+			skb_queue_purge(&dev->drv[di]->rpqueue[ch]);
 		}
 	restore_flags(flags);
 }
@@ -2032,7 +2018,7 @@
 
 	if ((adding) && (d->rpqueue)) {
 		for (j = 0; j < d->channels; j++)
-			isdn_free_queue(&d->rpqueue[j]);
+			skb_queue_purge(&d->rpqueue[j]);
 		kfree(d->rpqueue);
 	}
 	if (!(d->rpqueue =
diff -urN linux-2.2.20-pre5/drivers/isdn/isdn_net.c linux/drivers/isdn/isdn_net.c
--- linux-2.2.20-pre5/drivers/isdn/isdn_net.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/isdn_net.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: isdn_net.c,v 1.140.6.3 2001/02/07 11:31:30 kai Exp $
+/* $Id: isdn_net.c,v 1.140.6.6 2001/06/11 22:08:37 kai Exp $
 
  * Linux ISDN subsystem, network interfaces and related functions (linklevel).
  *
@@ -294,13 +294,11 @@
 isdn_net_unbind_channel(isdn_net_local * lp)
 {
 	ulong flags;
-	struct sk_buff *skb;
 
 	save_flags(flags);
 	cli();
-	while ((skb = skb_dequeue(&lp->super_tx_queue))) {
-		kfree_skb(skb);
-	}
+	skb_queue_purge(&lp->super_tx_queue);
+
 	if (!lp->master) {	/* reset only master device */
 		/* Moral equivalent of dev_purge_queues():
 		   BEWARE! This chunk of code cannot be called from hardware
diff -urN linux-2.2.20-pre5/drivers/isdn/isdn_tty.c linux/drivers/isdn/isdn_tty.c
--- linux-2.2.20-pre5/drivers/isdn/isdn_tty.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/isdn_tty.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: isdn_tty.c,v 1.94.6.1 2001/02/16 16:43:22 kai Exp $
+/* $Id: isdn_tty.c,v 1.94.6.2 2001/06/09 15:14:15 kai Exp $
 
  * Linux ISDN subsystem, tty functions and AT-command emulator (linklevel).
  *
@@ -66,7 +66,7 @@
 static int si2bit[8] =
 {4, 1, 4, 4, 4, 4, 4, 4};
 
-char *isdn_tty_revision = "$Revision: 1.94.6.1 $";
+char *isdn_tty_revision = "$Revision: 1.94.6.2 $";
 
 
 /* isdn_tty_try_read() is called from within isdn_tty_rcv_skb()
@@ -307,18 +307,13 @@
 void
 isdn_tty_cleanup_xmit(modem_info * info)
 {
-	struct sk_buff *skb;
 	unsigned long flags;
 
 	save_flags(flags);
 	cli();
-	if (skb_queue_len(&info->xmit_queue))
-		while ((skb = skb_dequeue(&info->xmit_queue)))
-			kfree_skb(skb);
-#ifdef CONFIG_ISDN_AUDIO
-	if (skb_queue_len(&info->dtmf_queue))
-		while ((skb = skb_dequeue(&info->dtmf_queue)))
-			kfree_skb(skb);
+	skb_queue_purge(&info->xmit_queue);
+#ifdef CONFIG_ISDN_AUDIO
+	skb_queue_purge(&info->dtmf_queue);
 #endif
 	restore_flags(flags);
 }
diff -urN linux-2.2.20-pre5/drivers/isdn/isdnloop/isdnloop.c linux/drivers/isdn/isdnloop/isdnloop.c
--- linux-2.2.20-pre5/drivers/isdn/isdnloop/isdnloop.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/isdnloop/isdnloop.c	Mon Dec  3 22:19:41 2001
@@ -1,4 +1,4 @@
-/* $Id: isdnloop.c,v 1.11.6.2 2001/02/16 16:43:32 kai Exp $
+/* $Id: isdnloop.c,v 1.11.6.3 2001/06/09 15:14:19 kai Exp $
 
  * ISDN low-level module implementing a dummy loop driver.
  *
@@ -26,7 +26,7 @@
 #include "isdnloop.h"
 
 static char
-*revision = "$Revision: 1.11.6.2 $";
+*revision = "$Revision: 1.11.6.3 $";
 
 static int isdnloop_addcard(char *);
 
@@ -41,10 +41,8 @@
 isdnloop_free_queue(isdnloop_card * card, int channel)
 {
 	struct sk_buff_head *queue = &card->bqueue[channel];
-	struct sk_buff *skb;
 
-	while ((skb = skb_dequeue(queue)))
-		dev_kfree_skb(skb);
+	skb_queue_purge(queue);
 	card->sndcount[channel] = 0;
 }
 
@@ -1574,11 +1572,8 @@
 	}
 	card = cards;
 	while (card) {
-		struct sk_buff *skb;
-
 		last = card;
-		while ((skb = skb_dequeue(&card->dqueue)))
-			dev_kfree_skb(skb);
+		skb_queue_purge(&card->dqueue);
 		card = card->next;
 		kfree(last);
 	}
diff -urN linux-2.2.20-pre5/drivers/isdn/sc/interrupt.c linux/drivers/isdn/sc/interrupt.c
--- linux-2.2.20-pre5/drivers/isdn/sc/interrupt.c	Mon Dec  3 22:19:34 2001
+++ linux/drivers/isdn/sc/interrupt.c	Mon Dec  3 22:19:41 2001
@@ -1,5 +1,5 @@
 /*
- *  $Id: interrupt.c,v 1.4.8.1 2001/03/13 16:17:09 kai Exp $
+ *  $Id: interrupt.c,v 1.4.8.2 2001/04/08 17:51:43 kai Exp $
  *  Copyright (C) 1996  SpellCaster Telecommunications Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -34,7 +34,6 @@
 
 extern int indicate_status(int, int, ulong, char *);
 extern void check_phystat(unsigned long);
-extern void dump_messages(int);
 extern int receivemessage(int, RspMessage *);
 extern int sendmessage(int, unsigned int, unsigned int, unsigned int,
         unsigned int, unsigned int, unsigned int, unsigned int *);
diff -urN linux-2.2.20-pre5/drivers/isdn/sc/message.c linux/drivers/isdn/sc/message.c
--- linux-2.2.20-pre5/drivers/isdn/sc/message.c	Sun Mar 25 08:37:34 2001
+++ linux/drivers/isdn/sc/message.c	Mon Dec  3 22:19:41 2001
@@ -1,5 +1,5 @@
 /*
- *  $Id: message.c,v 1.5 1999/09/04 06:20:07 keil Exp $
+ *  $Id: message.c,v 1.5.8.1 2001/04/08 17:51:43 kai Exp $
  *  Copyright (C) 1996  SpellCaster Telecommunications Inc.
  *
  *  message.c - functions for sending and receiving control messages
@@ -38,55 +38,12 @@
 extern unsigned int cinst;
 
 /*
- * Obligitory function prototypes
+ * Obligatory function prototypes
  */
 extern int indicate_status(int,ulong,char*);
 extern int scm_command(isdn_ctrl *);
 extern void *memcpy_fromshmem(int, void *, const void *, size_t);
 
-/*
- * Dump message queue in shared memory to screen
- */
-void dump_messages(int card) 
-{
-	DualPortMemory dpm;
-	unsigned long flags;
-
-	int i =0;
-	
-	if (!IS_VALID_CARD(card)) {
-		pr_debug("Invalid param: %d is not a valid card id\n", card);
-	}
-
-	save_flags(flags);
-	cli();
-	outb(adapter[card]->ioport[adapter[card]->shmem_pgport], 
-		(adapter[card]->shmem_magic >> 14) | 0x80);
-	memcpy_fromshmem(card, &dpm, 0, sizeof(dpm));
-	restore_flags(flags);
-
-	pr_debug("%s: Dumping Request Queue\n", adapter[card]->devicename);
-	for (i = 0; i < dpm.req_head; i++) {
-		pr_debug("%s: Message #%d: (%d,%d,%d), link: %d\n",
-				adapter[card]->devicename, i,
-				dpm.req_queue[i].type,
-				dpm.req_queue[i].class,
-				dpm.req_queue[i].code,
-				dpm.req_queue[i].phy_link_no);
-	}
-
-	pr_debug("%s: Dumping Response Queue\n", adapter[card]->devicename);
-	for (i = 0; i < dpm.rsp_head; i++) {
-		pr_debug("%s: Message #%d: (%d,%d,%d), link: %d, status: %d\n",
-				adapter[card]->devicename, i,
-				dpm.rsp_queue[i].type,
-				dpm.rsp_queue[i].class,
-				dpm.rsp_queue[i].code,
-				dpm.rsp_queue[i].phy_link_no,
-				dpm.rsp_queue[i].rsp_status);
-	}
-
-}	
 
 /*
  * receive a message from the board
diff -urN linux-2.2.20-pre5/drivers/scsi/sg.c linux/drivers/scsi/sg.c
--- linux-2.2.20-pre5/drivers/scsi/sg.c	Sun Mar 25 08:31:30 2001
+++ linux/drivers/scsi/sg.c	Mon Dec  3 22:19:42 2001
@@ -7,7 +7,7 @@
  * Original driver (sg.c):
  *        Copyright (C) 1992 Lawrence Foard
  * 2.x extensions to driver:
- *        Copyright (C) 1998 - 2000 Douglas Gilbert
+ *        Copyright (C) 1998 - 2001 Douglas Gilbert
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -16,8 +16,8 @@
  *
  *  Borrows code from st driver. Thanks to Alessandro Rubini's "dd" book.
  */
- static char * sg_version_str = "Version: 2.1.39 (20000626)";
- static int sg_version_num = 20139; /* 2 digits for each component */
+ static char * sg_version_str = "Version: 2.1.40 (20010620)";
+ static int sg_version_num = 20140; /* 2 digits for each component */
 /*
  *  D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au), notes:
  *      - scsi logging is available via SCSI_LOG_TIMEOUT macros. First
@@ -1635,18 +1635,14 @@
 }
 
 /* If retSzp==NULL want exact size or fail */
-/* sg_low_malloc() should always be called from a process context allowing
-   GFP_KERNEL to be used instead of GFP_ATOMIC */
 static char * sg_low_malloc(int rqSz, int lowDma, int mem_src, int * retSzp)
 {
     char * resp = NULL;
-    int page_mask = lowDma ? (GFP_KERNEL | GFP_DMA) : GFP_KERNEL;
+    int page_mask = lowDma ? (GFP_ATOMIC | GFP_DMA) : GFP_ATOMIC;
 
     if (rqSz <= 0)
         return resp;
     if (SG_HEAP_KMAL == mem_src) {
-        page_mask = lowDma ? (GFP_ATOMIC | GFP_DMA) : GFP_ATOMIC;
-        /* Seen kmalloc(..,GFP_KERNEL) hang for 40 secs! */
         resp = kmalloc(rqSz, page_mask);
         if (resp && retSzp) *retSzp = rqSz;
 #ifdef SG_DEBUG
diff -urN linux-2.2.20-pre5/fs/dquot.c linux/fs/dquot.c
--- linux-2.2.20-pre5/fs/dquot.c	Sun Mar 25 08:37:38 2001
+++ linux/fs/dquot.c	Mon Dec  3 22:19:42 2001
@@ -667,8 +667,6 @@
 {
 	int cnt;
 
-        if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)))
-                return 0;
 	if (is_quotafile(inode))
 		return 0;
 	if (type != -1)
@@ -1082,38 +1080,34 @@
 	unsigned int id = 0;
 	short cnt;
 
-	if (S_ISREG(inode->i_mode) ||
-            S_ISDIR(inode->i_mode) ||
-            S_ISLNK(inode->i_mode)) {
-		/* We don't want to have quotas on quota files - nasty deadlocks possible */
-		if (is_quotafile(inode))
-			return;
-		for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
-			if (type != -1 && cnt != type)
+	/* We don't want to have quotas on quota files - nasty deadlocks possible */
+	if (is_quotafile(inode))
+		return;
+	for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
+		if (type != -1 && cnt != type)
+			continue;
+		
+		if (!sb_has_quota_enabled(inode->i_sb, cnt))
+			continue;
+		
+		if (inode->i_dquot[cnt] == NODQUOT) {
+			switch (cnt) {
+			case USRQUOTA:
+				id = inode->i_uid;
+				break;
+			case GRPQUOTA:
+				id = inode->i_gid;
+				break;
+			}
+			dquot = dqget(inode->i_dev, id, cnt);
+			if (dquot == NODQUOT)
 				continue;
-
-			if (!sb_has_quota_enabled(inode->i_sb, cnt))
+			if (inode->i_dquot[cnt] != NODQUOT) {
+				dqput(dquot);
 				continue;
-
-			if (inode->i_dquot[cnt] == NODQUOT) {
-				switch (cnt) {
-					case USRQUOTA:
-						id = inode->i_uid;
-						break;
-					case GRPQUOTA:
-						id = inode->i_gid;
-						break;
-				}
-				dquot = dqget(inode->i_dev, id, cnt);
-				if (dquot == NODQUOT)
-					continue;
-				if (inode->i_dquot[cnt] != NODQUOT) {
-					dqput(dquot);
-					continue;
-				} 
-				inode->i_dquot[cnt] = dquot;
-				inode->i_flags |= S_QUOTA;
-			}
+			} 
+			inode->i_dquot[cnt] = dquot;
+			inode->i_flags |= S_QUOTA;
 		}
 	}
 }
diff -urN linux-2.2.20-pre5/fs/open.c linux/fs/open.c
--- linux-2.2.20-pre5/fs/open.c	Sun Mar 25 08:37:38 2001
+++ linux/fs/open.c	Mon Dec  3 22:19:42 2001
@@ -305,9 +305,15 @@
 	res = PTR_ERR(dentry);
 	if (!IS_ERR(dentry)) {
 		res = permission(dentry->d_inode, mode);
-		/* SuS v2 requires we report a read only fs too */
-		if(!res && (mode & S_IWOTH) && IS_RDONLY(dentry->d_inode))
-			res = -EROFS;
+
+		/* SUSv2 says to return EROFS for open() and access()
+		   for files on a read-only filesystem, when writing
+		   is requested.  Clearly, we want to be able to run
+		   a system from read-only media, so should not
+		   interpret this to mean that open("/dev/tty") should
+		   fail when the device node lives on a CDROM.
+		   In other words, no additional check is needed here. */
+
 		dput(dentry);
 	}
 
diff -urN linux-2.2.20-pre5/include/linux/b1lli.h linux/include/linux/b1lli.h
--- linux-2.2.20-pre5/include/linux/b1lli.h	Mon Dec  3 22:19:35 2001
+++ linux/include/linux/b1lli.h	Mon Dec  3 22:19:42 2001
@@ -1,77 +1,9 @@
 /*
- * $Id: b1lli.h,v 1.8.8.1 2001/03/15 09:58:30 kai Exp $
+ * $Id: b1lli.h,v 1.8.8.2 2001/05/17 20:41:52 kai Exp $
  *
  * ISDN lowlevel-module for AVM B1-card.
  *
  * Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
- *
- * $Log: b1lli.h,v $
- * Revision 1.8.8.1  2001/03/15 09:58:30  kai
- * spelling fix
- *
- * Revision 1.8  1999/07/01 15:26:54  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
- *
- * Revision 1.7  1999/06/21 15:24:25  calle
- * extend information in /proc.
- *
- * Revision 1.6  1999/04/15 19:49:36  calle
- * fix fuer die B1-PCI. Jetzt geht z.B. auch IRQ 17 ...
- *
- * Revision 1.5  1998/10/25 14:50:28  fritz
- * Backported from MIPS (Cobalt).
- *
- * Revision 1.4  1998/03/29 16:05:02  calle
- * changes from 2.0 tree merged.
- *
- * Revision 1.1.2.9  1998/03/20 14:30:02  calle
- * added cardnr to detect if you try to add same T1 to different io address.
- * change number of nccis depending on number of channels.
- *
- * Revision 1.1.2.8  1998/03/04 17:32:33  calle
- * Changes for T1.
- *
- * Revision 1.1.2.7  1998/02/27 15:38:29  calle
- * T1 running with slow link.
- *
- * Revision 1.1.2.6  1998/02/24 17:57:36  calle
- * changes for T1.
- *
- * Revision 1.3  1998/01/31 10:54:37  calle
- * include changes for PCMCIA cards from 2.0 version
- *
- * Revision 1.2  1997/12/10 19:38:42  calle
- * get changes from 2.0 tree
- *
- * Revision 1.1.2.2  1997/11/26 16:57:26  calle
- * more changes for B1/M1/T1.
- *
- * Revision 1.1.2.1  1997/11/26 10:47:01  calle
- * prepared for M1 (Mobile) and T1 (PMX) cards.
- * prepared to set configuration after load to support other D-channel
- * protocols, point-to-point and leased lines.
- *
- * Revision 1.1  1997/03/04 21:27:32  calle
- * First version in isdn4linux
- *
- * Revision 2.2  1997/02/12 09:31:39  calle
- * new version
- *
- * Revision 1.1  1997/01/31 10:32:20  calle
- * Initial revision
  *
  */
 
diff -urN linux-2.2.20-pre5/include/linux/b1pcmcia.h linux/include/linux/b1pcmcia.h
--- linux-2.2.20-pre5/include/linux/b1pcmcia.h	Sun Mar 25 08:31:05 2001
+++ linux/include/linux/b1pcmcia.h	Mon Dec  3 22:19:42 2001
@@ -1,27 +1,10 @@
 /*
- * $Id: b1pcmcia.h,v 1.1 1999/07/01 15:26:56 calle Exp $
+ * $Id: b1pcmcia.h,v 1.1.8.1 2001/05/17 20:41:52 kai Exp $
  *
  * Exported functions of module b1pcmcia to be called by
  * avm_cs card services module.
  *
  * Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
- *
- * $Log: b1pcmcia.h,v $
- * Revision 1.1  1999/07/01 15:26:56  calle
- * complete new version (I love it):
- * + new hardware independed "capi_driver" interface that will make it easy to:
- *   - support other controllers with CAPI-2.0 (i.e. USB Controller)
- *   - write a CAPI-2.0 for the passive cards
- *   - support serial link CAPI-2.0 boxes.
- * + wrote "capi_driver" for all supported cards.
- * + "capi_driver" (supported cards) now have to be configured with
- *   make menuconfig, in the past all supported cards where included
- *   at once.
- * + new and better informations in /proc/capi/
- * + new ioctl to switch trace of capi messages per controller
- *   using "avmcapictrl trace [contr] on|off|...."
- * + complete testcircle with all supported cards and also the
- *   PCMCIA cards (now patch for pcmcia-cs-3.0.13 needed) done.
  *
  */
 
diff -urN linux-2.2.20-pre5/include/linux/hysdn_if.h linux/include/linux/hysdn_if.h
--- linux-2.2.20-pre5/include/linux/hysdn_if.h	Mon Dec  3 22:19:35 2001
+++ linux/include/linux/hysdn_if.h	Mon Dec  3 22:19:42 2001
@@ -1,4 +1,4 @@
-/* $Id: hysdn_if.h,v 1.1.8.1 2001/03/13 16:17:10 kai Exp $
+/* $Id: hysdn_if.h,v 1.1.8.2 2001/05/17 20:41:52 kai Exp $
 
  * Linux driver for HYSDN cards, ioctl definitions shared by hynetmgr and driver.
  * written by Werner Cornelius (werner@titro.de) for Hypercope GmbH
@@ -18,15 +18,6 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Log: hysdn_if.h,v $
- * Revision 1.1.8.1  2001/03/13 16:17:10  kai
- * spelling fixes from 2.4.3-pre
- *
- * Revision 1.1  2000/02/10 19:47:50  werner
- *
- * Initial release
- *
  *
  */
 
diff -urN linux-2.2.20-pre5/include/linux/ioport.h linux/include/linux/ioport.h
--- linux-2.2.20-pre5/include/linux/ioport.h	Sun Mar 25 08:31:03 2001
+++ linux/include/linux/ioport.h	Mon Dec  3 22:19:42 2001
@@ -32,4 +32,21 @@
 extern void autoirq_setup(int waittime);
 extern int autoirq_report(int waittime);
 
+/*
+ * for compatibility with 2.4
+ */
+
+extern inline int check_mem_region(unsigned long from, unsigned long extent)
+{
+	return 0;
+}
+
+extern inline void request_mem_region(unsigned long from, unsigned long extent,const char *name)
+{
+}
+
+extern inline void release_mem_region(unsigned long from, unsigned long extent)
+{
+}
+
 #endif	/* _LINUX_PORTIO_H */
diff -urN linux-2.2.20-pre5/include/linux/sched.h linux/include/linux/sched.h
--- linux-2.2.20-pre5/include/linux/sched.h	Mon Dec  3 22:19:35 2001
+++ linux/include/linux/sched.h	Mon Dec  3 22:19:42 2001
@@ -506,7 +506,7 @@
 extern unsigned long volatile jiffies;
 extern unsigned long itimer_ticks;
 extern unsigned long itimer_next;
-extern struct timeval xtime;
+extern volatile struct timeval xtime;
 extern void do_timer(struct pt_regs *);
 
 extern unsigned int * prof_buffer;
diff -urN linux-2.2.20-pre5/include/scsi/sg.h linux/include/scsi/sg.h
--- linux-2.2.20-pre5/include/scsi/sg.h	Sun Mar 25 08:31:09 2001
+++ linux/include/scsi/sg.h	Mon Dec  3 22:19:42 2001
@@ -9,12 +9,14 @@
 Original driver (sg.h):
 *       Copyright (C) 1992 Lawrence Foard
 2.x extensions to driver:
-*       Copyright (C) 1998 - 2000 Douglas Gilbert
+*       Copyright (C) 1998 - 2001 Douglas Gilbert
 
-    Version: 2.1.39 (20000626)
+    Version: 2.1.40 (20010620)
     This version for 2.2.x series kernels
     D. P. Gilbert (dgilbert@interlog.com, dougg@triode.net.au)
 
+    Changes since 2.1.38 (20000626)
+        - fix bug that caused long wait when large buffer requested
     Changes since 2.1.38 (20000527)
         - more scatter gather fine tuning for sym53c416
     Changes since 2.1.37 (20000504)
