]> git.neil.brown.name Git - history.git/commitdiff
Import 2.3.99pre7-6 2.3.99pre7-6
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:34:31 +0000 (15:34 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:34:31 +0000 (15:34 -0500)
63 files changed:
Documentation/IO-APIC.txt [deleted file]
Documentation/i386/IO-APIC.txt [new file with mode: 0644]
Documentation/pci.txt
Documentation/usb/usb-serial.txt
arch/i386/kernel/ptrace.c
arch/m68k/atari/atakeyb.c
arch/sparc64/mm/ultra.S
drivers/atm/iphase.c
drivers/atm/suni.c
drivers/block/amiflop.c
drivers/block/ps2esdi.c
drivers/block/rd.c
drivers/cdrom/optcd.c
drivers/cdrom/sjcd.c
drivers/char/misc.c
drivers/char/msp3400.c
drivers/char/mxser.c
drivers/char/pcmcia/serial_cb.c
drivers/char/synclink.c
drivers/i2o/i2o_lan.c
drivers/macintosh/mediabay.c
drivers/net/3c59x.c
drivers/net/Config.in
drivers/net/epic100.c
drivers/net/pcmcia/ibmtr_cs.c
drivers/net/pcmcia/netwave_cs.c
drivers/net/starfire.c
drivers/net/via-rhine.c
drivers/sbus/char/vfc_i2c.c
drivers/sound/awacs_defs.h [deleted file]
drivers/sound/dmasound/awacs_defs.h [new file with mode: 0644]
drivers/usb/serial/ezusb_convert.pl
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/keyspan_pda.c
drivers/usb/serial/omninet.c
drivers/usb/serial/usb-serial.h
drivers/usb/serial/usbserial.c
drivers/usb/serial/visor.c
drivers/usb/serial/visor.h
drivers/usb/serial/whiteheat.c
drivers/usb/serial/whiteheat.h [new file with mode: 0644]
drivers/video/clgenfb.c
drivers/video/sbusfb.c
drivers/video/tdfxfb.c
drivers/video/vga16fb.c
fs/buffer.c
fs/nfs/write.c
fs/proc/array.c
fs/proc/base.c
fs/smbfs/file.c
fs/super.c
include/asm-sparc64/system.h
include/linux/file.h
include/linux/fs.h
include/linux/mm.h
include/linux/sched.h
kernel/fork.c
kernel/ksyms.c
kernel/ptrace.c
mm/filemap.c
mm/page_io.c
mm/vmscan.c
net/sunrpc/sched.c

diff --git a/Documentation/IO-APIC.txt b/Documentation/IO-APIC.txt
deleted file mode 100644 (file)
index 1a7dbd4..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-Most (all) Intel-MP compliant SMP boards have the so-called 'IO-APIC',
-which is an enhanced interrupt controller, it enables us to route
-hardware interrupts to multiple CPUs, or to CPU groups.
-
-Linux supports all variants of compliant SMP boards, including ones with
-multiple IO-APICs. (multiple IO-APICs are used in high-end servers to
-distribute IRQ load further).
-
-There are (a few) known breakages in certain older boards, which bugs are
-usually worked around by the kernel. If your MP-compliant SMP board does
-not boot Linux, then consult the linux-smp mailing list archives first.
-
-If your box boots fine with enabled IO-APIC IRQs, then your
-/proc/interrupts will look like this one:
-
-   ---------------------------->
-  hell:~> cat /proc/interrupts
-             CPU0
-    0:    1360293    IO-APIC-edge  timer
-    1:          4    IO-APIC-edge  keyboard
-    2:          0          XT-PIC  cascade
-   13:          1          XT-PIC  fpu
-   14:       1448    IO-APIC-edge  ide0
-   16:      28232   IO-APIC-level  Intel EtherExpress Pro 10/100 Ethernet
-   17:      51304   IO-APIC-level  eth0
-  NMI:          0
-  ERR:          0
-  hell:~>
-  <----------------------------
-
-some interrupts are still listed as 'XT PIC', but this is not a problem,
-none of those IRQ sources is performance-critical.
-
-
-in the unlikely case that your board does not create a working mp-table,
-you can use the pirq= boot parameter to 'hand-construct' IRQ entries. This
-is nontrivial though and cannot be automated. One sample /etc/lilo.conf
-entry:
-
-       append="pirq=15,11,10"
-
-the actual numbers depend on your system, on your PCI cards and on their
-PCI slot position. Usually PCI slots are 'daisy chained' before they are
-connected to the PCI chipset IRQ routing facility (the incoming PIRQ1-4
-lines):
-
-               ,-.        ,-.        ,-.        ,-.        ,-.
-     PIRQ4 ----| |-.    ,-| |-.    ,-| |-.    ,-| |--------| |
-               |S|  \  /  |S|  \  /  |S|  \  /  |S|        |S|
-     PIRQ3 ----|l|-. `/---|l|-. `/---|l|-. `/---|l|--------|l|
-               |o|  \/    |o|  \/    |o|  \/    |o|        |o|
-     PIRQ2 ----|t|-./`----|t|-./`----|t|-./`----|t|--------|t|
-               |1| /\     |2| /\     |3| /\     |4|        |5|
-     PIRQ1 ----| |-  `----| |-  `----| |-  `----| |--------| |
-               `-'        `-'        `-'        `-'        `-'
-
-every PCI card emits a PCI IRQ, which can be INTA,INTB,INTC,INTD:
-
-                               ,-.
-                         INTD--| |
-                               |S|
-                         INTC--|l|
-                               |o|
-                         INTB--|t|
-                               |x|
-                         INTA--| |
-                               `-'
-
-These INTA-D PCI IRQs are always 'local to the card', their real meaning
-depends on which slot they are in. If you look at the daisy chaining diagram,
-a card in slot4, issuing INTA IRQ, it will end up as a signal on PIRQ2 of
-the PCI chipset. Most cards issue INTA, this creates optimal distribution
-between the PIRQ lines. (distributing IRQ sources properly is not a
-necessity, PCI IRQs can be shared at will, but it's a good for performance
-to have non shared interrupts). Slot5 should be used for videocards, they
-do not use interrupts normally, thus they are not daisy chained either.
-
-so if you have your SCSI card (IRQ11) in Slot1, Tulip card (IRQ9) in
-Slot2, then you'll have to specify this pirq= line:
-
-       append="pirq=11,9"
-
-the following script tries to figure out such a default pirq= line from
-your PCI configuration:
-
-       echo -n pirq=; echo `scanpci | grep T_L | cut -c56-` | sed 's/ /,/g'
-
-note that this script wont work if you have skipped a few slots or if your
-board does not do default daisy-chaining. (or the IO-APIC has the PIRQ pins
-connected in some strange way). E.g. if in the above case you have your SCSI
-card (IRQ11) in Slot3, and have Slot1 empty:
-
-       append="pirq=0,9,11"
-
-[value '0' is a generic 'placeholder', reserved for empty (or non-IRQ emitting)
-slots.]
-
-generally, it's always possible to find out the correct pirq= settings, just
-permute all IRQ numbers properly ... it will take some time though. An
-'incorrect' pirq line will cause the booting process to hang, or a device
-won't function properly (if it's inserted as eg. a module).
-
-If you have 2 PCI buses, then you can use up to 8 pirq values. Although such
-boards tend to have a good configuration.
-
-Be prepared that it might happen that you need some strange pirq line:
-
-       append="pirq=0,0,0,0,0,0,9,11"
-
-use smart try-and-err techniques to find out the correct pirq line ...
-
-good luck and mail to linux-smp@vger.rutgers.edu or
-linux-kernel@vger.rutgers.edu if you have any problems that are not covered
-by this document.
-
--- mingo
-
diff --git a/Documentation/i386/IO-APIC.txt b/Documentation/i386/IO-APIC.txt
new file mode 100644 (file)
index 0000000..1a7dbd4
--- /dev/null
@@ -0,0 +1,117 @@
+Most (all) Intel-MP compliant SMP boards have the so-called 'IO-APIC',
+which is an enhanced interrupt controller, it enables us to route
+hardware interrupts to multiple CPUs, or to CPU groups.
+
+Linux supports all variants of compliant SMP boards, including ones with
+multiple IO-APICs. (multiple IO-APICs are used in high-end servers to
+distribute IRQ load further).
+
+There are (a few) known breakages in certain older boards, which bugs are
+usually worked around by the kernel. If your MP-compliant SMP board does
+not boot Linux, then consult the linux-smp mailing list archives first.
+
+If your box boots fine with enabled IO-APIC IRQs, then your
+/proc/interrupts will look like this one:
+
+   ---------------------------->
+  hell:~> cat /proc/interrupts
+             CPU0
+    0:    1360293    IO-APIC-edge  timer
+    1:          4    IO-APIC-edge  keyboard
+    2:          0          XT-PIC  cascade
+   13:          1          XT-PIC  fpu
+   14:       1448    IO-APIC-edge  ide0
+   16:      28232   IO-APIC-level  Intel EtherExpress Pro 10/100 Ethernet
+   17:      51304   IO-APIC-level  eth0
+  NMI:          0
+  ERR:          0
+  hell:~>
+  <----------------------------
+
+some interrupts are still listed as 'XT PIC', but this is not a problem,
+none of those IRQ sources is performance-critical.
+
+
+in the unlikely case that your board does not create a working mp-table,
+you can use the pirq= boot parameter to 'hand-construct' IRQ entries. This
+is nontrivial though and cannot be automated. One sample /etc/lilo.conf
+entry:
+
+       append="pirq=15,11,10"
+
+the actual numbers depend on your system, on your PCI cards and on their
+PCI slot position. Usually PCI slots are 'daisy chained' before they are
+connected to the PCI chipset IRQ routing facility (the incoming PIRQ1-4
+lines):
+
+               ,-.        ,-.        ,-.        ,-.        ,-.
+     PIRQ4 ----| |-.    ,-| |-.    ,-| |-.    ,-| |--------| |
+               |S|  \  /  |S|  \  /  |S|  \  /  |S|        |S|
+     PIRQ3 ----|l|-. `/---|l|-. `/---|l|-. `/---|l|--------|l|
+               |o|  \/    |o|  \/    |o|  \/    |o|        |o|
+     PIRQ2 ----|t|-./`----|t|-./`----|t|-./`----|t|--------|t|
+               |1| /\     |2| /\     |3| /\     |4|        |5|
+     PIRQ1 ----| |-  `----| |-  `----| |-  `----| |--------| |
+               `-'        `-'        `-'        `-'        `-'
+
+every PCI card emits a PCI IRQ, which can be INTA,INTB,INTC,INTD:
+
+                               ,-.
+                         INTD--| |
+                               |S|
+                         INTC--|l|
+                               |o|
+                         INTB--|t|
+                               |x|
+                         INTA--| |
+                               `-'
+
+These INTA-D PCI IRQs are always 'local to the card', their real meaning
+depends on which slot they are in. If you look at the daisy chaining diagram,
+a card in slot4, issuing INTA IRQ, it will end up as a signal on PIRQ2 of
+the PCI chipset. Most cards issue INTA, this creates optimal distribution
+between the PIRQ lines. (distributing IRQ sources properly is not a
+necessity, PCI IRQs can be shared at will, but it's a good for performance
+to have non shared interrupts). Slot5 should be used for videocards, they
+do not use interrupts normally, thus they are not daisy chained either.
+
+so if you have your SCSI card (IRQ11) in Slot1, Tulip card (IRQ9) in
+Slot2, then you'll have to specify this pirq= line:
+
+       append="pirq=11,9"
+
+the following script tries to figure out such a default pirq= line from
+your PCI configuration:
+
+       echo -n pirq=; echo `scanpci | grep T_L | cut -c56-` | sed 's/ /,/g'
+
+note that this script wont work if you have skipped a few slots or if your
+board does not do default daisy-chaining. (or the IO-APIC has the PIRQ pins
+connected in some strange way). E.g. if in the above case you have your SCSI
+card (IRQ11) in Slot3, and have Slot1 empty:
+
+       append="pirq=0,9,11"
+
+[value '0' is a generic 'placeholder', reserved for empty (or non-IRQ emitting)
+slots.]
+
+generally, it's always possible to find out the correct pirq= settings, just
+permute all IRQ numbers properly ... it will take some time though. An
+'incorrect' pirq line will cause the booting process to hang, or a device
+won't function properly (if it's inserted as eg. a module).
+
+If you have 2 PCI buses, then you can use up to 8 pirq values. Although such
+boards tend to have a good configuration.
+
+Be prepared that it might happen that you need some strange pirq line:
+
+       append="pirq=0,0,0,0,0,0,9,11"
+
+use smart try-and-err techniques to find out the correct pirq line ...
+
+good luck and mail to linux-smp@vger.rutgers.edu or
+linux-kernel@vger.rutgers.edu if you have any problems that are not covered
+by this document.
+
+-- mingo
+
index a1a85e59a9e959900274be6e359c1678d6cb230e..63e035a9390cdd095e7b8c03cbd638bf407afe22 100644 (file)
@@ -62,9 +62,8 @@ contains:
                        deregistration of the driver or when it's manually pulled
                        out of a hot-pluggable slot). This function can be called
                        from interrupt context.
-       suspend,        Power management hooks (currently used only for CardBus
-       resume          cards) -- called when the device goes to sleep or is
-                       resumed.
+       suspend,        Power management hooks -- called when the device goes to
+       resume          sleep or is resumed.
 
 The ID table is an array of struct pci_device_id ending with a all-zero entry.
 Each entry consists of:
index 1ea46bbaab1ac0e991eb2cef14f994c269558965..193ab6ddce8b7ce97858dd7e8e2c7790c65cd7c1 100644 (file)
@@ -10,30 +10,30 @@ INTRODUCTION
 
 CONFIGURATION
 
-  Currently the driver can handle up to 16 different serial interfaces at
-  one time. Once more of the drivers become stable, this number will be
-  increased to the full 256. 
+  Currently the driver can handle up to 256 different serial interfaces at
+  one time. 
 
-  The major number that the driver uses is 188 so to use the driver,
-  create the following nodes:
+  If you are not using devfs:
+    The major number that the driver uses is 188 so to use the driver,
+    create the following nodes:
        mknod /dev/ttyUSB0 c 188 0
        mknod /dev/ttyUSB1 c 188 1
        mknod /dev/ttyUSB2 c 188 2
        mknod /dev/ttyUSB3 c 188 3
-       mknod /dev/ttyUSB4 c 188 4
-       mknod /dev/ttyUSB5 c 188 5
-       mknod /dev/ttyUSB6 c 188 6
-       mknod /dev/ttyUSB7 c 188 7
-       mknod /dev/ttyUSB8 c 188 8
-       mknod /dev/ttyUSB9 c 188 9
-       mknod /dev/ttyUSB10 c 188 10
-       mknod /dev/ttyUSB11 c 188 11
-       mknod /dev/ttyUSB12 c 188 12
-       mknod /dev/ttyUSB13 c 188 13
-       mknod /dev/ttyUSB14 c 188 14
-       mknod /dev/ttyUSB15 c 188 15
-       mknod /dev/ttyUSB16 c 188 16
-
+               .
+               .
+               .
+       mknod /dev/ttyUSB254 c 188 254
+       mknod /dev/ttyUSB255 c 188 255
+
+  If you are using devfs:
+    The devices supported by this driver will show up as
+    /dev/usb/tts/{0,1,...}
+
+  When the device is connected and recognized by the driver, the driver
+  will print to the system log, which node(s) the device has been bound
+  to.
+  
 
 SPECIFIC DEVICES SUPPORTED
 
@@ -45,8 +45,9 @@ ConnectTech WhiteHEAT 4 port converter
   being fully supported.
 
 Current status:
-  The device's firmware is downloaded on connection, but the use of a
-  special Anchor Chips extension is currently giving me problems.
+  The device's firmware is downloaded on connection, the new firmware 
+  runs properly and all four ports are successfuly recognized and connected.
+  Now data flow needs to be implemented properly.
   This driver is not fully operational.
 
 
@@ -61,7 +62,9 @@ Current status:
   
   When the device is connected, try talking to it on the second port
   (this is usually /dev/ttyUSB1 if you do not have any other usb-serial
-  devices in the system.)
+  devices in the system.) The system log should tell you which port is
+  the port to use for the HotSync transfer. The "Generic" port can be used
+  for other device communication, such as a PPP link.
 
   There is a webpage and mailing lists for this portion of the driver at: 
   http://usbvisor.sourceforge.net/
@@ -91,6 +94,19 @@ Current status:
    O_NONBLOCK, select()
 
 
+FTDI Single Port Serial Driver
+
+  This is a single port DB-25 serial adapter. More information about this
+  device and the Linux driver can be found at:
+       http://reality.sgi.com/bryder_wellington/ftdi_sio/
+
+
+ZyXEL omni.net lcd plus ISDN TA
+
+  This is an ISDN TA. Please report both successes and troubles to the
+  author at omninet@kroah.com
+
+
 Generic Serial driver
 
   If your device is not one of the above listed devices, compatible with
index ed64f15a2d0de0bae750b30ffa83303005fb4164..de965615045c9eff01374cd729a4f3abd2157ab0 100644 (file)
@@ -134,7 +134,6 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
 {
        struct task_struct *child;
        struct user * dummy = NULL;
-       unsigned long flags;
        int i, ret;
 
        lock_kernel();
@@ -151,15 +150,19 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
        ret = -ESRCH;
        read_lock(&tasklist_lock);
        child = find_task_by_pid(pid);
-       read_unlock(&tasklist_lock);    /* FIXME!!! */
+       if (child)
+               get_task_struct(child);
+       read_unlock(&tasklist_lock);
        if (!child)
                goto out;
+
        ret = -EPERM;
        if (pid == 1)           /* you may not mess with init */
-               goto out;
+               goto out_tsk;
+
        if (request == PTRACE_ATTACH) {
                if (child == current)
-                       goto out;
+                       goto out_tsk;
                if ((!child->dumpable ||
                    (current->uid != child->euid) ||
                    (current->uid != child->suid) ||
@@ -168,34 +171,33 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
                    (current->gid != child->sgid) ||
                    (!cap_issubset(child->cap_permitted, current->cap_permitted)) ||
                    (current->gid != child->gid)) && !capable(CAP_SYS_PTRACE))
-                       goto out;
+                       goto out_tsk;
                /* the same process cannot be attached many times */
                if (child->flags & PF_PTRACED)
-                       goto out;
+                       goto out_tsk;
                child->flags |= PF_PTRACED;
 
-               write_lock_irqsave(&tasklist_lock, flags);
+               write_lock_irq(&tasklist_lock);
                if (child->p_pptr != current) {
                        REMOVE_LINKS(child);
                        child->p_pptr = current;
                        SET_LINKS(child);
                }
-               write_unlock_irqrestore(&tasklist_lock, flags);
+               write_unlock_irq(&tasklist_lock);
 
                send_sig(SIGSTOP, child, 1);
                ret = 0;
-               goto out;
+               goto out_tsk;
        }
        ret = -ESRCH;
        if (!(child->flags & PF_PTRACED))
-               goto out;
+               goto out_tsk;
        if (child->state != TASK_STOPPED) {
                if (request != PTRACE_KILL)
-                       goto out;
+                       goto out_tsk;
        }
        if (child->p_pptr != current)
-               goto out;
-
+               goto out_tsk;
        switch (request) {
        /* when I and D space are separate, these will need to be fixed. */
        case PTRACE_PEEKTEXT: /* read word at location addr. */ 
@@ -270,7 +272,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
                                  data &= ~DR_CONTROL_RESERVED;
                                  for(i=0; i<4; i++)
                                          if ((0x5f54 >> ((data >> (16 + 4*i)) & 0xf)) & 1)
-                                                 goto out;
+                                                 goto out_tsk;
                          }
 
                          addr -= (long) &dummy->u_debugreg;
@@ -347,11 +349,11 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
                        break;
                child->flags &= ~(PF_PTRACED|PF_TRACESYS);
                child->exit_code = data;
-               write_lock_irqsave(&tasklist_lock, flags);
+               write_lock_irq(&tasklist_lock);
                REMOVE_LINKS(child);
                child->p_pptr = child->p_opptr;
                SET_LINKS(child);
-               write_unlock_irqrestore(&tasklist_lock, flags);
+               write_unlock_irq(&tasklist_lock);
                /* make sure the single step bit is not set. */
                tmp = get_stack_long(child, EFL_OFFSET) & ~TRAP_FLAG;
                put_stack_long(child, EFL_OFFSET, tmp);
@@ -435,6 +437,8 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
                ret = -EIO;
                break;
        }
+out_tsk:
+       free_task_struct(child);
 out:
        unlock_kernel();
        return ret;
index 8eeaa898504683eb7e1a0cb6974d31ebf839ac39..ebef991e98183b05219c7f5ea9c6808c0bc0bd81 100644 (file)
@@ -287,8 +287,8 @@ static void atakeyb_rep( unsigned long ignore )
        /* A keyboard int may have come in before we disabled the irq, so
         * double-check whether rep_scancode is still != 0 */
        if (rep_scancode) {
+               init_timer(&atakeyb_rep_timer);
                atakeyb_rep_timer.expires = jiffies + key_repeat_rate;
-               atakeyb_rep_timer.prev = atakeyb_rep_timer.next = NULL;
                add_timer( &atakeyb_rep_timer );
 
                handle_scancode(rep_scancode, 1);
@@ -444,7 +444,6 @@ static void keyboard_interrupt(int irq, void *dummy, struct pt_regs *fp)
                    del_timer( &atakeyb_rep_timer );
                    rep_scancode = scancode;
                    atakeyb_rep_timer.expires = jiffies + key_repeat_delay;
-                   atakeyb_rep_timer.prev = atakeyb_rep_timer.next = NULL;
                    add_timer( &atakeyb_rep_timer );
                }
 
index 1c3714e5ba528d2d9b867a7412770285bda368ed..ff4cac1c053af5b38c4de0ff1ec226859ee44cd7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: ultra.S,v 1.41 2000/03/27 10:38:51 davem Exp $
+/* $Id: ultra.S,v 1.42 2000/05/05 18:47:41 davem Exp $
  * ultra.S: Don't expand these all over the place...
  *
  * Copyright (C) 1997, 2000 David S. Miller (davem@redhat.com)
@@ -38,7 +38,7 @@ __flush_tlb_range: /* %o0=(ctx&0x3ff), %o1=start&PAGE_MASK, %o2=SECONDARY_CONTEX
                    */
 #define TLB_MAGIC      207 /* Students, do you know how I calculated this?  -DaveM */
 /*IC3*/        cmp             %o5, %o4
-       be,pt           %xcc, __flush_tlb_page
+       bleu,pt         %xcc, __flush_tlb_page
         srlx           %o5, 13, %g5
        cmp             %g5, TLB_MAGIC
        bgeu,pn         %icc, __flush_tlb_range_constant_time
index a1e5c4dd42bc41696208a497824c29df7b1d260a..4882bfe196e6d5db2b02d7d3ed4c28e0d3978b4e 100644 (file)
@@ -81,7 +81,8 @@ static unsigned char ia_phy_get(struct atm_dev *dev, unsigned long addr);
 static IADEV *ia_dev[8] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
 static struct atm_dev *_ia_dev[8] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
 static int iadev_count = 0;
-static struct timer_list ia_timer;
+static void ia_led_timer(unsigned long arg);
+static struct timer_list ia_timer = { function: ia_led_timer };
 struct atm_vcc *vcc_close_que[100];
 static int IA_TX_BUF = DFL_TX_BUFFERS, IA_TX_BUF_SZ = DFL_TX_BUF_SZ;
 static int IA_RX_BUF = DFL_RX_BUFFERS, IA_RX_BUF_SZ = DFL_RX_BUF_SZ;
@@ -2728,11 +2729,7 @@ static int ia_open(struct atm_vcc *vcc, short vpi, int vci)
         {
            static u8 first = 1; 
            if (first) {
-              ia_timer.next = NULL;
-              ia_timer.prev = NULL;
               ia_timer.expires = jiffies + 3*HZ;
-              ia_timer.data = 0UL;
-              ia_timer.function = ia_led_timer;
               add_timer(&ia_timer);
               first = 0;
            }           
@@ -3255,10 +3252,7 @@ int init_module(void)
                return -ENXIO;  
        }  
        // MOD_INC_USE_COUNT; 
-       init_timer(&ia_timer);
        ia_timer.expires = jiffies + 3*HZ;
-       ia_timer.data = 0UL;
-       ia_timer.function = ia_led_timer;
        add_timer(&ia_timer); 
    
        return 0;  
@@ -3319,4 +3313,4 @@ void cleanup_module(void)
 }  
 
 #endif  
-  
+
index 0de6e8eadcf81d4ccd1653374646a30dfabc4aad..7af56d4812e59d0f36af80d0879e96d3c2f63006 100644 (file)
@@ -254,8 +254,8 @@ static int suni_start(struct atm_dev *dev)
                poll_timer.function = suni_hz;
                poll_timer.data = 1;
 #if 0
-printk(KERN_DEBUG "[u] p=0x%lx,n=0x%lx\n",(unsigned long) poll_timer.prev,
-    (unsigned long) poll_timer.next);
+printk(KERN_DEBUG "[u] p=0x%lx,n=0x%lx\n",(unsigned long) poll_timer.list.prev,
+    (unsigned long) poll_timer.list.next);
 #endif
                add_timer(&poll_timer);
        }
index 0c7af176e75ea75133d3f4de487ab2136146e585..095fc0870606d1b3d5b77f562c66fad2d15f3234 100644 (file)
@@ -1824,19 +1824,16 @@ int __init amiga_floppy_init(void)
        }
 
        /* initialize variables */
-       motor_on_timer.next = NULL;
-       motor_on_timer.prev = NULL;
+       init_timer(&motor_on_timer);
        motor_on_timer.expires = 0;
        motor_on_timer.data = 0;
        motor_on_timer.function = motor_on_callback;
        for (i = 0; i < FD_MAX_UNITS; i++) {
-               motor_off_timer[i].next = NULL;
-               motor_off_timer[i].prev = NULL;
+               init_timer(&motor_off_timer[i]);
                motor_off_timer[i].expires = 0;
                motor_off_timer[i].data = i|0x80000000;
                motor_off_timer[i].function = fd_motor_off;
-               flush_track_timer[i].next = NULL;
-               flush_track_timer[i].prev = NULL;
+               init_timer(&flush_track_timer[i]);
                flush_track_timer[i].expires = 0;
                flush_track_timer[i].data = i;
                flush_track_timer[i].function = flush_track_callback;
@@ -1844,8 +1841,7 @@ int __init amiga_floppy_init(void)
                unit[i].track = -1;
        }
 
-       post_write_timer.next = NULL;
-       post_write_timer.prev = NULL;
+       init_timer(&post_write_timer);
        post_write_timer.expires = 0;
        post_write_timer.data = 0;
        post_write_timer.function = post_write;
index 305c89a0039b86cab4b6eadaa2434b6ad028fbf6..766ea0a182161fc1f146ecf5d95fda4980e9f5b9 100644 (file)
@@ -379,9 +379,9 @@ static void __init ps2esdi_geninit(void)
        reset_status = 0;
        reset_start = jiffies;
        while (!reset_status) {
-               esdi_timer.expires = HZ;
+               init_timer(&esdi_timer);
+               esdi_timer.expires = jiffies + HZ;
                esdi_timer.data = 0;
-               esdi_timer.next = esdi_timer.prev = NULL;
                add_timer(&esdi_timer);
                sleep_on(&ps2esdi_int);
        }
index 11a06ef616c4b15736e755e835f1949e19424ef5..5308e95fd2e882982c73247da74b82f33080867b 100644 (file)
@@ -436,8 +436,8 @@ int __init rd_init (void)
 
 #ifdef MODULE
 module_init(rd_init);
-module_exit(rd_cleanup);
 #endif
+module_exit(rd_cleanup);
 
 /* loadable module support */
 MODULE_PARM     (rd_size, "1i");
index 9a167203748d9270ee2dbdd08415b0f1ec742292..ad190c6ef15adc5dafdedc1cf4dcab14e75bd69b 100644 (file)
@@ -265,23 +265,18 @@ inline static int flag_low(int flag, unsigned long timeout)
 /* Timed waiting for status or data */
 static int sleep_timeout;      /* max # of ticks to sleep */
 static DECLARE_WAIT_QUEUE_HEAD(waitq);
-static struct timer_list delay_timer = {NULL, NULL, 0, 0, NULL};
-
-#define SET_TIMER(func, jifs) \
-       delay_timer.expires = jiffies+(jifs); \
-       delay_timer.function = (void *) (func); \
-       add_timer(&delay_timer);
-#define CLEAR_TIMER    del_timer(&delay_timer)
+static void sleep_timer(unsigned long data);
+static struct timer_list delay_timer = {function: sleep_timer};
 
 
 /* Timer routine: wake up when desired flag goes low,
    or when timeout expires. */
-static void sleep_timer(void)
+static void sleep_timer(unsigned long data)
 {
        int flags = inb(STATUS_PORT) & FL_STDT;
 
        if (flags == FL_STDT && --sleep_timeout > 0) {
-               SET_TIMER(sleep_timer, HZ/100); /* multi-statement macro */
+               mod_timer(&delay_timer, jiffies + HZ/100); /* multi-statement macro */
        } else
                wake_up(&waitq);
 }
@@ -297,7 +292,7 @@ static int sleep_flag_low(int flag, unsigned long timeout)
        sleep_timeout = timeout;
        flag_high = inb(STATUS_PORT) & flag;
        if (flag_high && sleep_timeout > 0) {
-               SET_TIMER(sleep_timer, HZ/100);
+               mod_timer(&delay_timer, jiffies + HZ/100);
                sleep_on(&waitq);
                flag_high = inb(STATUS_PORT) & flag;
        }
@@ -1079,15 +1074,11 @@ static volatile int error = 0;  /* %% do something with this?? */
 static int tries;              /* ibid?? */
 static int timeout = 0;
 
-static struct timer_list req_timer = {NULL, NULL, 0, 0, NULL};
+static void poll(unsigned long data);
+static struct timer_list req_timer = {function: poll};
 
-#define SET_REQ_TIMER(func, jifs) \
-       req_timer.expires = jiffies+(jifs); \
-       req_timer.function = (void *) (func); \
-       add_timer(&req_timer);
-#define CLEAR_REQ_TIMER        del_timer(&req_timer)
 
-static void poll(void)
+static void poll(unsigned long data)
 {
        static volatile int read_count = 1;
        int flags;
@@ -1363,7 +1354,7 @@ static void poll(void)
                }
        }
 
-       SET_REQ_TIMER(poll, HZ/100);
+       mod_timer(&req_timer, jiffies + HZ/100);
 }
 
 
@@ -1401,7 +1392,7 @@ static void do_optcd_request(request_queue_t * q)
                                timeout = READ_TIMEOUT;
                                tries = 5;
                                /* %% why not start right away?? */
-                               SET_REQ_TIMER(poll, HZ/100);
+                               mod_timer(&req_timer, jiffies + HZ/100);
                        }
                        break;
                }
@@ -1945,8 +1936,8 @@ static int opt_release(struct inode *ip, struct file *fp)
                        status = exec_cmd(COMOPEN);
                        DEBUG((DEBUG_VFS, "exec_cmd COMOPEN: %02x", -status));
                }
-               CLEAR_TIMER;
-               CLEAR_REQ_TIMER;
+               del_timer(&delay_timer);
+               del_timer(&req_timer);
        }
        MOD_DEC_USE_COUNT;
        return 0;
index 5182d415d3bf0e06a127fe710ed48454d93e48f5..5b8db1278e66acf8864eea46006187d63792d883 100644 (file)
@@ -153,7 +153,7 @@ static struct sjcd_stat statistic;
 /*
  * Timer.
  */
-static struct timer_list sjcd_delay_timer = { NULL, NULL, 0, 0, NULL };
+static struct timer_list sjcd_delay_timer = { function: NULL };
 
 #define SJCD_SET_TIMER( func, tmout )           \
     ( sjcd_delay_timer.expires = jiffies+tmout,         \
index b98f9a21c6e12f2ddb122f8cf884f3895d9a5582..ca084211855876d93f2ab22ee5e61f97a5b19244 100644 (file)
@@ -85,12 +85,24 @@ static int misc_read_proc(char *buf, char **start, off_t offset,
                          int len, int *eof, void *private)
 {
        struct miscdevice *p;
+       int written;
 
-       len=0;
-       for (p = misc_list.next; p != &misc_list && len < 4000; p = p->next)
-               len += sprintf(buf+len, "%3i %s\n",p->minor, p->name ?: "");
+       written=0;
+       for (p = misc_list.next; p != &misc_list && written < len; p = p->next) {
+               written += sprintf(buf+written, "%3i %s\n",p->minor, p->name ?: "");
+               if (written < offset) {
+                       offset -= written;
+                       written = 0;
+               }
+       }
        *start = buf + offset;
-       return len > offset ? len - offset : 0;
+       written -= offset;
+       if(written > len) {
+               *eof = 0;
+               return len;
+       }
+       *eof = 1;
+       return (written<0) ? 0 : written;
 }
 
 
index 630d6a94c22d4834f15db8fa37bd6dfe215f947e..6b86db95be81cdbbdb5d176ed919b726b76dc802 100644 (file)
@@ -1236,7 +1236,7 @@ static int
 msp3400c_mixer_open(struct inode *inode, struct file *file)
 {
         int minor = MINOR(inode->i_rdev);
-       struct i2c_client *client;
+       struct i2c_client *client = NULL;
        struct msp3400c *msp;
        int i;
 
@@ -1246,12 +1246,12 @@ msp3400c_mixer_open(struct inode *inode, struct file *file)
                if (msp->mixer_num == minor) {
                        client = msps[i];
                        file->private_data = client;
-                       break;
+                       goto match;
                }
        }
-       if (MSP3400_MAX == i)
-               return -ENODEV;
+       return -ENODEV;
 
+match:
        /* lock bttv in memory while the mixer is in use  */
        if (client->adapter->inc_use)
                client->adapter->inc_use(client->adapter);
index 176ebe8d829cbb22a4944125478343d8088aa2ef..8de8336d1b8d3bef298db97604d346dff9e4607b 100644 (file)
@@ -170,11 +170,6 @@ static mxser_pciinfo mxser_pcibrds[] =
        {PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C104, MXSER_BOARD_C104_PCI},
 };
 
-typedef struct _moxa_pci_info {
-       unsigned short busNum;
-       unsigned short devNum;
-} moxa_pci_info;
-
 static int ioaddr[MXSER_BOARDS] = {0, 0, 0, 0};
 static int ttymajor = MXSERMAJOR;
 static int calloutmajor = MXSERCUMAJOR;
@@ -198,7 +193,7 @@ struct mxser_hwconf {
        int uart_type;
        int ioaddr[MXSER_PORTS_PER_BOARD];
        int baud_base[MXSER_PORTS_PER_BOARD];
-       moxa_pci_info pciInfo;
+       struct pci_dev *pdev;
 };
 
 struct mxser_struct {
@@ -304,7 +299,7 @@ void cleanup_module(void);
 static void mxser_getcfg(int board, struct mxser_hwconf *hwconf);
 int mxser_init(void);
 static int mxser_get_ISA_conf(int, struct mxser_hwconf *);
-static int mxser_get_PCI_conf(int, int, int, struct mxser_hwconf *);
+static int mxser_get_PCI_conf(struct pci_dev *, int, struct mxser_hwconf *);
 static void mxser_do_softint(void *);
 static int mxser_open(struct tty_struct *, struct file *);
 static void mxser_close(struct tty_struct *, struct file *);
@@ -454,33 +449,21 @@ static void mxser_getcfg(int board, struct mxser_hwconf *hwconf)
        mxsercfg[board] = *hwconf;
 }
 
-static int mxser_get_PCI_conf(int busnum, int devnum, int board_type, struct mxser_hwconf *hwconf)
+static int mxser_get_PCI_conf(struct pci_dev *pdev, int board_type, struct mxser_hwconf *hwconf)
 {
        int i;
-       unsigned int val, ioaddress;
+       unsigned int ioaddress;
 
        hwconf->board_type = board_type;
        hwconf->ports = mxser_numports[board_type - 1];
-       pcibios_read_config_dword(busnum, devnum, PCI_BASE_ADDRESS_2, &val);
-       if (val == 0xffffffff)
-               return (MXSER_ERR_IOADDR);
-       else
-               ioaddress = val & 0xffffffc;
+       ioaddress = pci_resource_start (pdev, 2);
        for (i = 0; i < hwconf->ports; i++)
                hwconf->ioaddr[i] = ioaddress + 8 * i;
 
-       pcibios_read_config_dword(busnum, devnum, PCI_BASE_ADDRESS_3, &val);
-       if (val == 0xffffffff)
-               return (MXSER_ERR_VECTOR);
-       else
-               ioaddress = val & 0xffffffc;
+       ioaddress = pci_resource_start (pdev, 3);
        hwconf->vector = ioaddress;
 
-       pcibios_read_config_dword(busnum, devnum, PCI_INTERRUPT_LINE, &val);
-       if (val == 0xffffffff)
-               return (MXSER_ERR_IRQ);
-       else
-               hwconf->irq = val & 0xff;
+       hwconf->irq = pdev->irq;
 
        hwconf->uart_type = PORT_16550A;
        hwconf->vector_mask = 0;
@@ -496,7 +479,6 @@ int mxser_init(void)
        int i, m, retval, b;
        int n, index;
        int ret1, ret2;
-       unsigned char busnum, devnum;
        struct mxser_hwconf hwconf;
 
        printk("MOXA Smartio family driver version %s\n", MXSER_VERSION);
@@ -577,8 +559,7 @@ int mxser_init(void)
 
                        continue;
                }
-               hwconf.pciInfo.busNum = 0;
-               hwconf.pciInfo.devNum = 0;
+               hwconf.pdev = NULL;
 
                if (mxser_initbrd(m, &hwconf) < 0)
                        continue;
@@ -613,8 +594,7 @@ int mxser_init(void)
 
                        continue;
                }
-               hwconf.pciInfo.busNum = 0;
-               hwconf.pciInfo.devNum = 0;
+               hwconf.pdev = NULL;
 
                if (mxser_initbrd(m, &hwconf) < 0)
                        continue;
@@ -627,29 +607,26 @@ int mxser_init(void)
        /* start finding PCI board here */
 
 #ifdef CONFIG_PCI
-       if (pci_present()) 
        {
+               struct pci_dev *pdev = NULL;
+
                n = sizeof(mxser_pcibrds) / sizeof(mxser_pciinfo);
                index = 0;
                b = 0;
                while (b < n) {
-                       if (pcibios_find_device(mxser_pcibrds[b].vendor_id,
-                                             mxser_pcibrds[b].device_id,
-                                               index,
-                                               &busnum,
-                                               &devnum) != 0) {
-                               b++;
-                               index = 0;
-                               continue;
-                       }
-                       hwconf.pciInfo.busNum = busnum;
-                       hwconf.pciInfo.devNum = devnum;
-                       printk("Found MOXA %s board(BusNo=%d,DevNo=%d)\n", mxser_brdname[mxser_pcibrds[b].board_type - 1], busnum, devnum >> 3);
-                       index++;
+                       pdev = pci_find_device(mxser_pcibrds[b].vendor_id,
+                                              mxser_pcibrds[b].device_id, pdev);
+                       if (!pdev)
+                               break;
+                       b++;
+                       hwconf.pdev = pdev;
+                       printk("Found MOXA %s board(BusNo=%d,DevNo=%d)\n",
+                               mxser_brdname[mxser_pcibrds[b].board_type - 1],
+                               pdev->bus->number, PCI_SLOT(pdev->devfn >> 3));
                        if (m >= MXSER_BOARDS) {
                                printk("Too many Smartio family boards find (maximum %d),board not configured\n", MXSER_BOARDS);
                        } else {
-                               retval = mxser_get_PCI_conf(busnum, devnum,
+                               retval = mxser_get_PCI_conf(pdev,
                                   mxser_pcibrds[b].board_type, &hwconf);
                                if (retval < 0) {
                                        if (retval == MXSER_ERR_IRQ)
index a6e62fb42d96b63824eef4a165eba7b70efe0633..457b2f647bbe34b93c338147a1a6241ef82a0048 100644 (file)
@@ -125,7 +125,7 @@ static dev_node_t *serial_attach(dev_locator_t *loc)
     return node;
 
 err_out_unregister:
-    unregister_serial(0x40 + line);
+    unregister_serial(line);
 err_out:
     MOD_DEC_USE_COUNT;
     return NULL;
index e2e33c748645f7afc8640467fe4586728821792b..8eb55b500ebf2bff518ce9932e632059f8dbdfc1 100644 (file)
@@ -324,8 +324,7 @@ struct mgsl_struct {
        char device_name[25];           /* device instance name */
 
        unsigned int bus_type;  /* expansion bus type (ISA,EISA,PCI) */
-       unsigned char bus;              /* expansion bus number (zero based) */
-       unsigned char function;         /* PCI device number */
+       struct pci_dev *pdev;   /* pointer to PCI device info */
 
        unsigned int io_base;           /* base I/O address of adapter */
        unsigned int io_addr_size;      /* size of the I/O address range */
@@ -4524,50 +4523,24 @@ int mgsl_enumerate_devices()
 #ifdef CONFIG_PCI
        /* Auto detect PCI adapters */
        
-       if ( pcibios_present() ) {
-               unsigned char bus;
-               unsigned char func;
+       {
                unsigned int  shared_mem_base;
                unsigned int  lcr_mem_base;
                unsigned int  io_base;
                unsigned char irq_line;
+               struct pci_dev *pdev = NULL;
                
-               for(i=0;;i++){
-                       if ( PCIBIOS_SUCCESSFUL == pcibios_find_device(
-                               MICROGATE_VENDOR_ID, SYNCLINK_DEVICE_ID, i, &bus, &func) ) {
+               while ((pdev = pci_find_device(
+                               MICROGATE_VENDOR_ID, SYNCLINK_DEVICE_ID, pdev))) {
                                
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
-                               struct pci_dev *pdev = pci_find_slot(bus,func);
                                irq_line = pdev->irq;                           
-#else                                                                                          
-                               if (pcibios_read_config_byte(bus,func,
-                                       PCI_INTERRUPT_LINE,&irq_line) ) {
-                                       printk( "%s(%d):USC I/O addr not set.\n",
-                                               __FILE__,__LINE__);
-                                       continue;
-                               }
-#endif
 
-                               if (pcibios_read_config_dword(bus,func,
-                                       PCI_BASE_ADDRESS_3,&shared_mem_base) ) {
-                                       printk( "%s(%d):Shared mem addr not set.\n",
-                                               __FILE__,__LINE__);
-                                       continue;
-                               }
-                                                       
-                               if (pcibios_read_config_dword(bus,func,
-                                       PCI_BASE_ADDRESS_0,&lcr_mem_base) ) {
-                                       printk( "%s(%d):LCR mem addr not set.\n",
-                                               __FILE__,__LINE__);
-                                       continue;
-                               }
-                               
-                               if (pcibios_read_config_dword(bus,func,
-                                       PCI_BASE_ADDRESS_2,&io_base) ) {
-                                       printk( "%s(%d):USC I/O addr not set.\n",
-                                               __FILE__,__LINE__);
+                               shared_mem_base = pci_resource_start (pdev, 3);
+                               lcr_mem_base = pci_resource_start (pdev, 0);
+                               io_base = pci_resource_start (pdev, 2);
+
+                               if (pci_enable_device (pdev))
                                        continue;
-                               }
                                
                                info = mgsl_allocate_device();
                                if ( !info ) {
@@ -4579,29 +4552,23 @@ int mgsl_enumerate_devices()
                
                                /* Copy user configuration info to device instance data */
                
-                               info->io_base = io_base & PCI_BASE_ADDRESS_IO_MASK;
+                               info->io_base = io_base;
                                info->irq_level = (unsigned int)irq_line;
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
                                info->irq_level = irq_cannonicalize(info->irq_level);
-#else          
-                               if (info->irq_level == 2)
-                                       info->irq_level = 9;
-#endif                 
-                               info->phys_memory_base = shared_mem_base & PCI_BASE_ADDRESS_MEM_MASK;
+                               info->phys_memory_base = shared_mem_base;
                                
                                /* Because veremap only works on page boundaries we must map
                                 * a larger area than is actually implemented for the LCR
                                 * memory range. We map a full page starting at the page boundary.
                                 */
-                               info->phys_lcr_base = lcr_mem_base & PCI_BASE_ADDRESS_MEM_MASK;
+                               info->phys_lcr_base = lcr_mem_base;
                                info->lcr_offset    = info->phys_lcr_base & (PAGE_SIZE-1);
                                info->phys_lcr_base &= ~(PAGE_SIZE-1);
                                
                                info->bus_type = MGSL_BUS_TYPE_PCI;
                                info->io_addr_size = 8;
                                info->irq_flags = SA_SHIRQ;
-                               info->bus = bus;
-                               info->function = func;
+                               info->pdev = pdev;
                
                                /* override default max frame size if arg available */
                                if ( num_devices < MAX_TOTAL_DEVICES && 
@@ -4621,9 +4588,6 @@ int mgsl_enumerate_devices()
                                
                                /* add new device to device list */
                                mgsl_add_device( info );
-                       } else {
-                               break;
-                       }
                }
        }
 #endif
index 2957424d688399957bc63ea1e563010ed31d0e55..10b6821d91884110abdbecb7891643db986f1b67 100644 (file)
@@ -1287,15 +1287,13 @@ struct net_device *i2o_lan_register_device(struct i2o_device *i2o_dev)
 #ifdef CONFIG_FDDI
        case I2O_LAN_FDDI:
        {
-               int size = sizeof(struct net_device) + sizeof(struct i2o_lan_local)
-                       + sizeof("fddi%d ");
+               int size = sizeof(struct net_device) + sizeof(struct i2o_lan_local);
 
                dev = (struct net_device *) kmalloc(size, GFP_KERNEL);
                if (dev == NULL)
                        return NULL;
                memset((char *)dev, 0, size);
                dev->priv = (void *)(dev + 1);
-               dev->name = (char *)(dev + 1) + sizeof(struct i2o_lan_local);
 
                if (dev_alloc_name(dev, "fddi%d") < 0) {
                        printk(KERN_WARNING "i2o_lan: Too many FDDI devices.\n");
index cc1b44d2ce08d75132278140d68d70910fda0463..439526804675ffefed297a8335194642f607a382 100644 (file)
@@ -252,7 +252,7 @@ set_mb_power(int which, int onoff)
                MBDBG("mediabay%d: powering up\n", which);
        } else {
                feature_clear(mb->dev_node, FEATURE_Mediabay_floppy_enable);
-               feature_clear(mb->dev_node, FEATURE_Mediabay_IDE_enable);
+               feature_clear(mb->dev_node, FEATURE_IDE1_enable);
                feature_clear(mb->dev_node, FEATURE_Mediabay_PCI_enable);
                feature_clear(mb->dev_node, FEATURE_SWIM3_enable);
                feature_clear(mb->dev_node, FEATURE_Mediabay_power);
@@ -271,9 +271,9 @@ set_media_bay(int which, int id)
        
        switch (id) {
        case MB_CD:
-               feature_set(bay->dev_node, FEATURE_Mediabay_IDE_enable);
+               feature_set(bay->dev_node, FEATURE_IDE1_enable);
                udelay(10);
-               feature_set(bay->dev_node, FEATURE_Mediabay_IDE_reset);
+               feature_set(bay->dev_node, FEATURE_IDE1_reset);
                printk(KERN_INFO "media bay %d contains a CD-ROM drive\n", which);
                break;
        case MB_FD:
@@ -397,7 +397,7 @@ media_bay_step(int i)
                }
 #ifdef CONFIG_BLK_DEV_IDE
                MBDBG("mediabay%d: waiting IDE reset (kind:%d)\n", i, bay->content_id);
-               feature_clear(bay->dev_node, FEATURE_Mediabay_IDE_reset);
+               feature_clear(bay->dev_node, FEATURE_IDE1_reset);
                bay->timer = MS_TO_HZ(MB_IDE_WAIT);
                bay->state = mb_ide_resetting;
 #else
index 45603a0c10ce6cbcd2d7484fa4beab0999ca2079..c5fcec9bc404b979c69f027e71c0b1d0b4d494fb 100644 (file)
@@ -154,7 +154,7 @@ static int rx_nocopy = 0, rx_copy = 0, queued_packet = 0, rx_csumhits;
 
 #include <linux/delay.h>
 
-static char *version __devinitdata =
+static char version[] __devinitdata =
 "3c59x.c:v0.99L+LK1.1.5  30 Apr 2000  Donald Becker and others  http://cesdis.gsfc.nasa.gov/linux/drivers/vortex.html " "$Revision: 1.78 $\n";
 
 MODULE_AUTHOR("Donald Becker <becker@cesdis.gsfc.nasa.gov>");
@@ -830,8 +830,8 @@ static int __devinit vortex_probe1(struct pci_dev *pdev,
                }
 
                /* wake up and enable device */         
-               if ((retval = pci_enable_device(pdev))) {
-                       printk (KERN_ERR "%s: Cannot enable device, aborting\n", dev->name);
+               if (pci_enable_device (pdev)) {
+                       retval = -EIO;
                        goto free_region;
                }
 
@@ -2477,8 +2477,6 @@ static int __init vortex_init (void)
 {
        int rc;
        
-       MOD_INC_USE_COUNT;
-
        rc = pci_module_init (&vortex_driver);
        if (rc < 0)
                goto out;
@@ -2494,7 +2492,6 @@ static int __init vortex_init (void)
                vortex_have_eisa = 1;
 
 out:
-       MOD_DEC_USE_COUNT;
        return rc;
 }
 
index df3e315fedd7fe9cd105d4c3e77c757043aa8bb5..e6ad34366740d86f105d34607d07884d6bc274c5 100644 (file)
@@ -55,16 +55,16 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then
    if [ "$CONFIG_NET_VENDOR_3COM" = "y" ]; then
       tristate '    3c501 "EtherLink" support' CONFIG_EL1
       tristate '    3c503 "EtherLink II" support' CONFIG_EL2
-      tristate '    3c505 "Etherlink Plus" support' CONFIG_ELPLUS
+      tristate '    3c505 "EtherLink Plus" support' CONFIG_ELPLUS
       if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
         tristate '    3c507 support (EXPERIMENTAL)' CONFIG_EL16
       fi
-      tristate '    3c509/3c529 (MCA)/3c579 "Etherlink III" support' CONFIG_EL3
+      tristate '    3c509/3c529 (MCA)/3c579 "EtherLink III" support' CONFIG_EL3
       tristate '    3c515 ISA Fast EtherLink' CONFIG_3C515
       if [ "$CONFIG_MCA" = "y" ]; then
-        tristate '    3c523 support' CONFIG_ELMC
+        tristate '    3c523 EtherLinkMC support' CONFIG_ELMC
         if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
-           tristate '    3c527 support (EXPERIMENTAL)' CONFIG_ELMC_II
+           tristate '    3c527 EtherLink/MC 32 support (EXPERIMENTAL)' CONFIG_ELMC_II
         fi
       fi
       tristate '    3c590/3c900 series (592/595/597) "Vortex/Boomerang" support' CONFIG_VORTEX
index 954549c883ec1f836d7e41e356847be69b0c4f56..80a756ae8537c00748b5b4849b973efaf55361c0 100644 (file)
@@ -84,14 +84,14 @@ static int rx_copybreak = 200;
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
 #include <linux/init.h>
+#include <linux/spinlock.h>
 #include <asm/bitops.h>
 #include <asm/io.h>
-#include <asm/spinlock.h>
 
 /* These identify the driver base version and may not be removed. */
-static const char version[] __devinitdata =
+static char version[] __devinitdata =
 "epic100.c:v1.09+LK1.1.2 4/28/2000 Written by Donald Becker <becker@scyld.com>\n";
-static const char version2[] __devinitdata =
+static char version2[] __devinitdata =
 "      http://www.scyld.com/network/epic100.html\n";
 
 #define EPIC100_MODULE_NAME "epic100"
index 74f4bb61204e0ae5e2a1800725e4410b02a08365..9d3e2b6c3954ed1148ff687614e601667954783a 100644 (file)
@@ -283,7 +283,7 @@ static void ibmtr_detach(dev_link_t *link)
     cli();
     {
        struct tok_info *ti = (struct tok_info *)dev->priv;
-       if (ti->tr_timer.next) del_timer(&(ti->tr_timer));
+       if (timer_pending(&ti->tr_timer)) del_timer(&ti->tr_timer);
     }
     if (link->state & DEV_RELEASE_PENDING) {
         del_timer(&link->release);
index 2e67ff35d2a5f5b8a9e27dfa76e4ce7264fac27b..8cfbb96b516938d4a31e3ccc7d6c61b81a693de5 100644 (file)
@@ -502,7 +502,7 @@ static dev_link_t *netwave_attach(void)
     dev->do_ioctl = &netwave_ioctl;
 
     ether_setup(dev);
-    strcpy(dev->name, priv->node.dev_name)
+    strcpy(dev->name, priv->node.dev_name);
     dev->init = &netwave_init;
     dev->open = &netwave_open;
     dev->stop = &netwave_close;
index fc3936a788443759e79475766c82d132b1724bab..5c90b54e0005e93951163b439f7a8f25c7d306a6 100644 (file)
@@ -99,9 +99,9 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 #include <asm/io.h>
 
 /* These identify the driver base version and may not be removed. */
-static const char version1[] __devinitdata =
+static char version1[] __devinitdata =
 "starfire.c:v0.15+LK1.1.2 4/28/2000  Written by Donald Becker <becker@scyld.com>\n";
-static const char version2[] __devinitdata =
+static char version2[] __devinitdata =
 " Undates and info at http://www.scyld.com/network/starfire.html\n";
 
 MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
index 2b908fb4f6bfa82a6aa8bb9ba864f0a13a84458a..77816670f30ef086f40874eae790f7a544fea23d 100644 (file)
@@ -121,9 +121,9 @@ static const int multicast_filter_limit = 32;
 #include <asm/io.h>
 
 /* These identify the driver base version and may not be removed. */
-static const char version1[] __devinitdata =
+static char version1[] __devinitdata =
 "via-rhine.c:v1.05-LK1.1.5  5/2/2000  Written by Donald Becker\n";
-static const char version2[] __devinitdata =
+static char version2[] __devinitdata =
 "  http://www.scyld.com/network/via-rhine.html\n";
 
 
index 6731caa78f3b719ee16267e715f7868e506e6a73..08577384341b8297ee9221f874cb2751188c5cd6 100644 (file)
@@ -88,8 +88,7 @@ void vfc_i2c_delay_wakeup(struct vfc_dev *dev)
 
 void vfc_i2c_delay_no_busy(struct vfc_dev *dev, unsigned long usecs) 
 {
-       dev->poll_timer.next = NULL;
-       dev->poll_timer.prev = NULL;
+       init_timer(&dev->poll_timer);
        dev->poll_timer.expires = jiffies + 
                ((unsigned long)usecs*(HZ))/1000000;
        dev->poll_timer.data=(unsigned long)dev;
diff --git a/drivers/sound/awacs_defs.h b/drivers/sound/awacs_defs.h
deleted file mode 100644 (file)
index 2757347..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-/*********************************************************/
-/* This file was written by someone, somewhere, sometime */
-/* And is released into the Public Domain                */
-/*********************************************************/
-
-#ifndef _AWACS_DEFS_H_
-#define _AWACS_DEFS_H_
-
-/*******************************/
-/* AWACs Audio Register Layout */
-/*******************************/
-
-struct awacs_regs {
-    unsigned   control;        /* Audio control register */
-    unsigned   pad0[3];
-    unsigned   codec_ctrl;     /* Codec control register */
-    unsigned   pad1[3];
-    unsigned   codec_stat;     /* Codec status register */
-    unsigned   pad2[3];
-    unsigned   clip_count;     /* Clipping count register */
-    unsigned   pad3[3];
-    unsigned   byteswap;       /* Data is little-endian if 1 */
-};
-
-/*******************/
-/* Audio Bit Masks */
-/*******************/
-
-/* Audio Control Reg Bit Masks */
-/* ----- ------- --- --- ----- */
-#define MASK_ISFSEL    (0xf)           /* Input SubFrame Select */
-#define MASK_OSFSEL    (0xf << 4)      /* Output SubFrame Select */
-#define MASK_RATE      (0x7 << 8)      /* Sound Rate */
-#define MASK_CNTLERR   (0x1 << 11)     /* Error */
-#define MASK_PORTCHG   (0x1 << 12)     /* Port Change */
-#define MASK_IEE       (0x1 << 13)     /* Enable Interrupt on Error */
-#define MASK_IEPC      (0x1 << 14)     /* Enable Interrupt on Port Change */
-#define MASK_SSFSEL    (0x3 << 15)     /* Status SubFrame Select */
-
-/* Audio Codec Control Reg Bit Masks */
-/* ----- ----- ------- --- --- ----- */
-#define MASK_NEWECMD   (0x1 << 24)     /* Lock: don't write to reg when 1 */
-#define MASK_EMODESEL  (0x3 << 22)     /* Send info out on which frame? */
-#define MASK_EXMODEADDR        (0x3ff << 12)   /* Extended Mode Address -- 10 bits */
-#define MASK_EXMODEDATA        (0xfff)         /* Extended Mode Data -- 12 bits */
-
-/* Audio Codec Control Address Values / Masks */
-/* ----- ----- ------- ------- ------ - ----- */
-#define MASK_ADDR0     (0x0 << 12)     /* Expanded Data Mode Address 0 */
-#define MASK_ADDR_MUX  MASK_ADDR0      /* Mux Control */
-#define MASK_ADDR_GAIN MASK_ADDR0
-
-#define MASK_ADDR1     (0x1 << 12)     /* Expanded Data Mode Address 1 */
-#define MASK_ADDR_MUTE MASK_ADDR1
-#define MASK_ADDR_RATE MASK_ADDR1
-
-#define MASK_ADDR2     (0x2 << 12)     /* Expanded Data Mode Address 2 */
-#define MASK_ADDR_VOLA MASK_ADDR2      /* Volume Control A -- Headphones */
-#define MASK_ADDR_VOLHD MASK_ADDR2
-
-#define MASK_ADDR4     (0x4 << 12)     /* Expanded Data Mode Address 4 */
-#define MASK_ADDR_VOLC MASK_ADDR4      /* Volume Control C -- Speaker */
-#define MASK_ADDR_VOLSPK MASK_ADDR4
-
-/* Address 0 Bit Masks & Macros */
-/* ------- - --- ----- - ------ */
-#define MASK_GAINRIGHT (0xf)           /* Gain Right Mask */
-#define MASK_GAINLEFT  (0xf << 4)      /* Gain Left Mask */
-#define MASK_GAINLINE  (0x1 << 8)      /* Change Gain for Line??? */
-#define MASK_GAINMIC   (0x0 << 8)      /* Change Gain for Mic??? */
-
-#define MASK_MUX_CD    (0x1 << 9)      /* Select CD in MUX */
-#define MASK_MUX_AUDIN (0x1 << 10)     /* Select Audio In in MUX */
-#define MASK_MUX_MIC   (0x1 << 11)     /* Select Mic in MUX */
-#define MASK_MUX_LINE  MASK_MUX_AUDIN
-
-#define GAINRIGHT(x)   ((x) & MASK_GAINRIGHT)
-#define GAINLEFT(x)    (((x) << 4) & MASK_GAINLEFT)
-
-/* Address 1 Bit Masks */
-/* ------- - --- ----- */
-#define MASK_ADDR1RES1 (0x3)           /* Reserved */
-#define MASK_RECALIBRATE (0x1 << 2)    /* Recalibrate */
-#define MASK_SAMPLERATE        (0x7 << 3)      /* Sample Rate: */
-#define MASK_LOOPTHRU  (0x1 << 6)      /* Loopthrough Enable */
-#define MASK_CMUTE     (0x1 << 7)      /* Output C (Speaker) Mute when 1 */
-#define MASK_SPKMUTE   MASK_CMUTE
-#define MASK_ADDR1RES2 (0x1 << 8)      /* Reserved */
-#define MASK_AMUTE     (0x1 << 9)      /* Output A (Headphone) Mute when 1 */
-#define MASK_HDMUTE    MASK_AMUTE
-#define MASK_PAROUT    (0x3 << 10)     /* Parallel Out (???) */
-
-#define SAMPLERATE_48000       (0x0 << 3)      /* 48 or 44.1 kHz */
-#define SAMPLERATE_32000       (0x1 << 3)      /* 32 or 29.4 kHz */
-#define SAMPLERATE_24000       (0x2 << 3)      /* 24 or 22.05 kHz */
-#define SAMPLERATE_19200       (0x3 << 3)      /* 19.2 or 17.64 kHz */
-#define SAMPLERATE_16000       (0x4 << 3)      /* 16 or 14.7 kHz */
-#define SAMPLERATE_12000       (0x5 << 3)      /* 12 or 11.025 kHz */
-#define SAMPLERATE_9600                (0x6 << 3)      /* 9.6 or 8.82 kHz */
-#define SAMPLERATE_8000                (0x7 << 3)      /* 8 or 7.35 kHz */
-
-/* Address 2 & 4 Bit Masks & Macros */
-/* ------- - - - --- ----- - ------ */
-#define MASK_OUTVOLRIGHT (0xf)         /* Output Right Volume */
-#define MASK_ADDR2RES1 (0x2 << 4)      /* Reserved */
-#define MASK_ADDR4RES1 MASK_ADDR2RES1
-#define MASK_OUTVOLLEFT        (0xf << 6)      /* Output Left Volume */
-#define MASK_ADDR2RES2 (0x2 << 10)     /* Reserved */
-#define MASK_ADDR4RES2 MASK_ADDR2RES2
-
-#define VOLRIGHT(x)    (((~(x)) & MASK_OUTVOLRIGHT))
-#define VOLLEFT(x)     (((~(x)) << 6) & MASK_OUTVOLLEFT)
-
-/* Audio Codec Status Reg Bit Masks */
-/* ----- ----- ------ --- --- ----- */
-#define MASK_EXTEND    (0x1 << 23)     /* Extend */
-#define MASK_VALID     (0x1 << 22)     /* Valid Data? */
-#define MASK_OFLEFT    (0x1 << 21)     /* Overflow Left */
-#define MASK_OFRIGHT   (0x1 << 20)     /* Overflow Right */
-#define MASK_ERRCODE   (0xf << 16)     /* Error Code */
-#define MASK_REVISION  (0xf << 12)     /* Revision Number */
-#define MASK_MFGID     (0xf << 8)      /* Mfg. ID */
-#define MASK_CODSTATRES        (0xf << 4)      /* bits 4 - 7 reserved */
-#define MASK_INPPORT   (0xf)           /* Input Port */
-#define MASK_HDPCONN   8               /* headphone plugged in */
-
-/* Clipping Count Reg Bit Masks */
-/* -------- ----- --- --- ----- */
-#define MASK_CLIPLEFT  (0xff << 7)     /* Clipping Count, Left Channel */
-#define MASK_CLIPRIGHT (0xff)          /* Clipping Count, Right Channel */
-
-/* DBDMA ChannelStatus Bit Masks */
-/* ----- ------------- --- ----- */
-#define MASK_CSERR     (0x1 << 7)      /* Error */
-#define MASK_EOI       (0x1 << 6)      /* End of Input -- only for Input Channel */
-#define MASK_CSUNUSED  (0x1f << 1)     /* bits 1-5 not used */
-#define MASK_WAIT      (0x1)           /* Wait */
-
-/* Various Rates */
-/* ------- ----- */
-#define RATE_48000     (0x0 << 8)      /* 48 kHz */
-#define RATE_44100     (0x0 << 8)      /* 44.1 kHz */
-#define RATE_32000     (0x1 << 8)      /* 32 kHz */
-#define RATE_29400     (0x1 << 8)      /* 29.4 kHz */
-#define RATE_24000     (0x2 << 8)      /* 24 kHz */
-#define RATE_22050     (0x2 << 8)      /* 22.05 kHz */
-#define RATE_19200     (0x3 << 8)      /* 19.2 kHz */
-#define RATE_17640     (0x3 << 8)      /* 17.64 kHz */
-#define RATE_16000     (0x4 << 8)      /* 16 kHz */
-#define RATE_14700     (0x4 << 8)      /* 14.7 kHz */
-#define RATE_12000     (0x5 << 8)      /* 12 kHz */
-#define RATE_11025     (0x5 << 8)      /* 11.025 kHz */
-#define RATE_9600      (0x6 << 8)      /* 9.6 kHz */
-#define RATE_8820      (0x6 << 8)      /* 8.82 kHz */
-#define RATE_8000      (0x7 << 8)      /* 8 kHz */
-#define RATE_7350      (0x7 << 8)      /* 7.35 kHz */
-
-#define RATE_LOW       1       /* HIGH = 48kHz, etc;  LOW = 44.1kHz, etc. */
-
-
-/* Burgundy values */
-
-#define MASK_ADDR_BURGUNDY_INPSEL21 (0x11 << 12)
-#define MASK_ADDR_BURGUNDY_INPSEL3 (0x12 << 12)
-
-#define MASK_ADDR_BURGUNDY_GAINCH1 (0x13 << 12)
-#define MASK_ADDR_BURGUNDY_GAINCH2 (0x14 << 12)
-#define MASK_ADDR_BURGUNDY_GAINCH3 (0x15 << 12)
-#define MASK_ADDR_BURGUNDY_GAINCH4 (0x16 << 12)
-
-#define MASK_ADDR_BURGUNDY_VOLCH1 (0x20 << 12)
-#define MASK_ADDR_BURGUNDY_VOLCH2 (0x21 << 12)
-#define MASK_ADDR_BURGUNDY_VOLCH3 (0x22 << 12)
-#define MASK_ADDR_BURGUNDY_VOLCH4 (0x23 << 12)
-
-#define MASK_ADDR_BURGUNDY_OUTPUTSELECTS (0x2B << 12)
-#define MASK_ADDR_BURGUNDY_OUTPUTENABLES (0x2F << 12)
-
-#define MASK_ADDR_BURGUNDY_MASTER_VOLUME (0x30 << 12)
-
-#define MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES (0x60 << 12)
-
-#define MASK_ADDR_BURGUNDY_ATTENSPEAKER (0x62 << 12)
-#define MASK_ADDR_BURGUNDY_ATTENLINEOUT (0x63 << 12)
-#define MASK_ADDR_BURGUNDY_ATTENHP (0x64 << 12)
-
-#define MASK_ADDR_BURGUNDY_VOLCD (MASK_ADDR_BURGUNDY_VOLCH1)
-#define MASK_ADDR_BURGUNDY_VOLLINE (MASK_ADDR_BURGUNDY_VOLCH2)
-#define MASK_ADDR_BURGUNDY_VOLMIC (MASK_ADDR_BURGUNDY_VOLCH3)
-#define MASK_ADDR_BURGUNDY_VOLMODEM (MASK_ADDR_BURGUNDY_VOLCH4)
-
-#define MASK_ADDR_BURGUNDY_GAINCD (MASK_ADDR_BURGUNDY_GAINCH1)
-#define MASK_ADDR_BURGUNDY_GAINLINE (MASK_ADDR_BURGUNDY_GAINCH2)
-#define MASK_ADDR_BURGUNDY_GAINMIC (MASK_ADDR_BURGUNDY_GAINCH3)
-#define MASK_ADDR_BURGUNDY_GAINMODEM (MASK_ADDR_BURGUNDY_VOLCH4)
-
-
-/* These are all default values for the burgundy */
-#define DEF_BURGUNDY_INPSEL21 (0xAA)
-#define DEF_BURGUNDY_INPSEL3 (0x0A)
-
-#define DEF_BURGUNDY_GAINCD (0x33)
-#define DEF_BURGUNDY_GAINLINE (0x44)
-#define DEF_BURGUNDY_GAINMIC (0x44)
-#define DEF_BURGUNDY_GAINMODEM (0x06)
-
-/* Remember: lowest volume here is 0x9b */
-#define DEF_BURGUNDY_VOLCD (0xCCCCCCCC)
-#define DEF_BURGUNDY_VOLLINE (0x00000000)
-#define DEF_BURGUNDY_VOLMIC (0x00000000)
-#define DEF_BURGUNDY_VOLMODEM (0xCCCCCCCC)
-
-#define DEF_BURGUNDY_OUTPUTSELECTS (0x010f010f)
-#define DEF_BURGUNDY_OUTPUTENABLES (0x0A)
-
-#define DEF_BURGUNDY_MASTER_VOLUME (0xFFFFFFFF)
-
-#define DEF_BURGUNDY_MORE_OUTPUTENABLES (0x7E)
-
-#define DEF_BURGUNDY_ATTENSPEAKER (0x44)
-#define DEF_BURGUNDY_ATTENLINEOUT (0xCC)
-#define DEF_BURGUNDY_ATTENHP (0xCC)
-
-#endif /* _AWACS_DEFS_H_ */
diff --git a/drivers/sound/dmasound/awacs_defs.h b/drivers/sound/dmasound/awacs_defs.h
new file mode 100644 (file)
index 0000000..2757347
--- /dev/null
@@ -0,0 +1,224 @@
+/*********************************************************/
+/* This file was written by someone, somewhere, sometime */
+/* And is released into the Public Domain                */
+/*********************************************************/
+
+#ifndef _AWACS_DEFS_H_
+#define _AWACS_DEFS_H_
+
+/*******************************/
+/* AWACs Audio Register Layout */
+/*******************************/
+
+struct awacs_regs {
+    unsigned   control;        /* Audio control register */
+    unsigned   pad0[3];
+    unsigned   codec_ctrl;     /* Codec control register */
+    unsigned   pad1[3];
+    unsigned   codec_stat;     /* Codec status register */
+    unsigned   pad2[3];
+    unsigned   clip_count;     /* Clipping count register */
+    unsigned   pad3[3];
+    unsigned   byteswap;       /* Data is little-endian if 1 */
+};
+
+/*******************/
+/* Audio Bit Masks */
+/*******************/
+
+/* Audio Control Reg Bit Masks */
+/* ----- ------- --- --- ----- */
+#define MASK_ISFSEL    (0xf)           /* Input SubFrame Select */
+#define MASK_OSFSEL    (0xf << 4)      /* Output SubFrame Select */
+#define MASK_RATE      (0x7 << 8)      /* Sound Rate */
+#define MASK_CNTLERR   (0x1 << 11)     /* Error */
+#define MASK_PORTCHG   (0x1 << 12)     /* Port Change */
+#define MASK_IEE       (0x1 << 13)     /* Enable Interrupt on Error */
+#define MASK_IEPC      (0x1 << 14)     /* Enable Interrupt on Port Change */
+#define MASK_SSFSEL    (0x3 << 15)     /* Status SubFrame Select */
+
+/* Audio Codec Control Reg Bit Masks */
+/* ----- ----- ------- --- --- ----- */
+#define MASK_NEWECMD   (0x1 << 24)     /* Lock: don't write to reg when 1 */
+#define MASK_EMODESEL  (0x3 << 22)     /* Send info out on which frame? */
+#define MASK_EXMODEADDR        (0x3ff << 12)   /* Extended Mode Address -- 10 bits */
+#define MASK_EXMODEDATA        (0xfff)         /* Extended Mode Data -- 12 bits */
+
+/* Audio Codec Control Address Values / Masks */
+/* ----- ----- ------- ------- ------ - ----- */
+#define MASK_ADDR0     (0x0 << 12)     /* Expanded Data Mode Address 0 */
+#define MASK_ADDR_MUX  MASK_ADDR0      /* Mux Control */
+#define MASK_ADDR_GAIN MASK_ADDR0
+
+#define MASK_ADDR1     (0x1 << 12)     /* Expanded Data Mode Address 1 */
+#define MASK_ADDR_MUTE MASK_ADDR1
+#define MASK_ADDR_RATE MASK_ADDR1
+
+#define MASK_ADDR2     (0x2 << 12)     /* Expanded Data Mode Address 2 */
+#define MASK_ADDR_VOLA MASK_ADDR2      /* Volume Control A -- Headphones */
+#define MASK_ADDR_VOLHD MASK_ADDR2
+
+#define MASK_ADDR4     (0x4 << 12)     /* Expanded Data Mode Address 4 */
+#define MASK_ADDR_VOLC MASK_ADDR4      /* Volume Control C -- Speaker */
+#define MASK_ADDR_VOLSPK MASK_ADDR4
+
+/* Address 0 Bit Masks & Macros */
+/* ------- - --- ----- - ------ */
+#define MASK_GAINRIGHT (0xf)           /* Gain Right Mask */
+#define MASK_GAINLEFT  (0xf << 4)      /* Gain Left Mask */
+#define MASK_GAINLINE  (0x1 << 8)      /* Change Gain for Line??? */
+#define MASK_GAINMIC   (0x0 << 8)      /* Change Gain for Mic??? */
+
+#define MASK_MUX_CD    (0x1 << 9)      /* Select CD in MUX */
+#define MASK_MUX_AUDIN (0x1 << 10)     /* Select Audio In in MUX */
+#define MASK_MUX_MIC   (0x1 << 11)     /* Select Mic in MUX */
+#define MASK_MUX_LINE  MASK_MUX_AUDIN
+
+#define GAINRIGHT(x)   ((x) & MASK_GAINRIGHT)
+#define GAINLEFT(x)    (((x) << 4) & MASK_GAINLEFT)
+
+/* Address 1 Bit Masks */
+/* ------- - --- ----- */
+#define MASK_ADDR1RES1 (0x3)           /* Reserved */
+#define MASK_RECALIBRATE (0x1 << 2)    /* Recalibrate */
+#define MASK_SAMPLERATE        (0x7 << 3)      /* Sample Rate: */
+#define MASK_LOOPTHRU  (0x1 << 6)      /* Loopthrough Enable */
+#define MASK_CMUTE     (0x1 << 7)      /* Output C (Speaker) Mute when 1 */
+#define MASK_SPKMUTE   MASK_CMUTE
+#define MASK_ADDR1RES2 (0x1 << 8)      /* Reserved */
+#define MASK_AMUTE     (0x1 << 9)      /* Output A (Headphone) Mute when 1 */
+#define MASK_HDMUTE    MASK_AMUTE
+#define MASK_PAROUT    (0x3 << 10)     /* Parallel Out (???) */
+
+#define SAMPLERATE_48000       (0x0 << 3)      /* 48 or 44.1 kHz */
+#define SAMPLERATE_32000       (0x1 << 3)      /* 32 or 29.4 kHz */
+#define SAMPLERATE_24000       (0x2 << 3)      /* 24 or 22.05 kHz */
+#define SAMPLERATE_19200       (0x3 << 3)      /* 19.2 or 17.64 kHz */
+#define SAMPLERATE_16000       (0x4 << 3)      /* 16 or 14.7 kHz */
+#define SAMPLERATE_12000       (0x5 << 3)      /* 12 or 11.025 kHz */
+#define SAMPLERATE_9600                (0x6 << 3)      /* 9.6 or 8.82 kHz */
+#define SAMPLERATE_8000                (0x7 << 3)      /* 8 or 7.35 kHz */
+
+/* Address 2 & 4 Bit Masks & Macros */
+/* ------- - - - --- ----- - ------ */
+#define MASK_OUTVOLRIGHT (0xf)         /* Output Right Volume */
+#define MASK_ADDR2RES1 (0x2 << 4)      /* Reserved */
+#define MASK_ADDR4RES1 MASK_ADDR2RES1
+#define MASK_OUTVOLLEFT        (0xf << 6)      /* Output Left Volume */
+#define MASK_ADDR2RES2 (0x2 << 10)     /* Reserved */
+#define MASK_ADDR4RES2 MASK_ADDR2RES2
+
+#define VOLRIGHT(x)    (((~(x)) & MASK_OUTVOLRIGHT))
+#define VOLLEFT(x)     (((~(x)) << 6) & MASK_OUTVOLLEFT)
+
+/* Audio Codec Status Reg Bit Masks */
+/* ----- ----- ------ --- --- ----- */
+#define MASK_EXTEND    (0x1 << 23)     /* Extend */
+#define MASK_VALID     (0x1 << 22)     /* Valid Data? */
+#define MASK_OFLEFT    (0x1 << 21)     /* Overflow Left */
+#define MASK_OFRIGHT   (0x1 << 20)     /* Overflow Right */
+#define MASK_ERRCODE   (0xf << 16)     /* Error Code */
+#define MASK_REVISION  (0xf << 12)     /* Revision Number */
+#define MASK_MFGID     (0xf << 8)      /* Mfg. ID */
+#define MASK_CODSTATRES        (0xf << 4)      /* bits 4 - 7 reserved */
+#define MASK_INPPORT   (0xf)           /* Input Port */
+#define MASK_HDPCONN   8               /* headphone plugged in */
+
+/* Clipping Count Reg Bit Masks */
+/* -------- ----- --- --- ----- */
+#define MASK_CLIPLEFT  (0xff << 7)     /* Clipping Count, Left Channel */
+#define MASK_CLIPRIGHT (0xff)          /* Clipping Count, Right Channel */
+
+/* DBDMA ChannelStatus Bit Masks */
+/* ----- ------------- --- ----- */
+#define MASK_CSERR     (0x1 << 7)      /* Error */
+#define MASK_EOI       (0x1 << 6)      /* End of Input -- only for Input Channel */
+#define MASK_CSUNUSED  (0x1f << 1)     /* bits 1-5 not used */
+#define MASK_WAIT      (0x1)           /* Wait */
+
+/* Various Rates */
+/* ------- ----- */
+#define RATE_48000     (0x0 << 8)      /* 48 kHz */
+#define RATE_44100     (0x0 << 8)      /* 44.1 kHz */
+#define RATE_32000     (0x1 << 8)      /* 32 kHz */
+#define RATE_29400     (0x1 << 8)      /* 29.4 kHz */
+#define RATE_24000     (0x2 << 8)      /* 24 kHz */
+#define RATE_22050     (0x2 << 8)      /* 22.05 kHz */
+#define RATE_19200     (0x3 << 8)      /* 19.2 kHz */
+#define RATE_17640     (0x3 << 8)      /* 17.64 kHz */
+#define RATE_16000     (0x4 << 8)      /* 16 kHz */
+#define RATE_14700     (0x4 << 8)      /* 14.7 kHz */
+#define RATE_12000     (0x5 << 8)      /* 12 kHz */
+#define RATE_11025     (0x5 << 8)      /* 11.025 kHz */
+#define RATE_9600      (0x6 << 8)      /* 9.6 kHz */
+#define RATE_8820      (0x6 << 8)      /* 8.82 kHz */
+#define RATE_8000      (0x7 << 8)      /* 8 kHz */
+#define RATE_7350      (0x7 << 8)      /* 7.35 kHz */
+
+#define RATE_LOW       1       /* HIGH = 48kHz, etc;  LOW = 44.1kHz, etc. */
+
+
+/* Burgundy values */
+
+#define MASK_ADDR_BURGUNDY_INPSEL21 (0x11 << 12)
+#define MASK_ADDR_BURGUNDY_INPSEL3 (0x12 << 12)
+
+#define MASK_ADDR_BURGUNDY_GAINCH1 (0x13 << 12)
+#define MASK_ADDR_BURGUNDY_GAINCH2 (0x14 << 12)
+#define MASK_ADDR_BURGUNDY_GAINCH3 (0x15 << 12)
+#define MASK_ADDR_BURGUNDY_GAINCH4 (0x16 << 12)
+
+#define MASK_ADDR_BURGUNDY_VOLCH1 (0x20 << 12)
+#define MASK_ADDR_BURGUNDY_VOLCH2 (0x21 << 12)
+#define MASK_ADDR_BURGUNDY_VOLCH3 (0x22 << 12)
+#define MASK_ADDR_BURGUNDY_VOLCH4 (0x23 << 12)
+
+#define MASK_ADDR_BURGUNDY_OUTPUTSELECTS (0x2B << 12)
+#define MASK_ADDR_BURGUNDY_OUTPUTENABLES (0x2F << 12)
+
+#define MASK_ADDR_BURGUNDY_MASTER_VOLUME (0x30 << 12)
+
+#define MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES (0x60 << 12)
+
+#define MASK_ADDR_BURGUNDY_ATTENSPEAKER (0x62 << 12)
+#define MASK_ADDR_BURGUNDY_ATTENLINEOUT (0x63 << 12)
+#define MASK_ADDR_BURGUNDY_ATTENHP (0x64 << 12)
+
+#define MASK_ADDR_BURGUNDY_VOLCD (MASK_ADDR_BURGUNDY_VOLCH1)
+#define MASK_ADDR_BURGUNDY_VOLLINE (MASK_ADDR_BURGUNDY_VOLCH2)
+#define MASK_ADDR_BURGUNDY_VOLMIC (MASK_ADDR_BURGUNDY_VOLCH3)
+#define MASK_ADDR_BURGUNDY_VOLMODEM (MASK_ADDR_BURGUNDY_VOLCH4)
+
+#define MASK_ADDR_BURGUNDY_GAINCD (MASK_ADDR_BURGUNDY_GAINCH1)
+#define MASK_ADDR_BURGUNDY_GAINLINE (MASK_ADDR_BURGUNDY_GAINCH2)
+#define MASK_ADDR_BURGUNDY_GAINMIC (MASK_ADDR_BURGUNDY_GAINCH3)
+#define MASK_ADDR_BURGUNDY_GAINMODEM (MASK_ADDR_BURGUNDY_VOLCH4)
+
+
+/* These are all default values for the burgundy */
+#define DEF_BURGUNDY_INPSEL21 (0xAA)
+#define DEF_BURGUNDY_INPSEL3 (0x0A)
+
+#define DEF_BURGUNDY_GAINCD (0x33)
+#define DEF_BURGUNDY_GAINLINE (0x44)
+#define DEF_BURGUNDY_GAINMIC (0x44)
+#define DEF_BURGUNDY_GAINMODEM (0x06)
+
+/* Remember: lowest volume here is 0x9b */
+#define DEF_BURGUNDY_VOLCD (0xCCCCCCCC)
+#define DEF_BURGUNDY_VOLLINE (0x00000000)
+#define DEF_BURGUNDY_VOLMIC (0x00000000)
+#define DEF_BURGUNDY_VOLMODEM (0xCCCCCCCC)
+
+#define DEF_BURGUNDY_OUTPUTSELECTS (0x010f010f)
+#define DEF_BURGUNDY_OUTPUTENABLES (0x0A)
+
+#define DEF_BURGUNDY_MASTER_VOLUME (0xFFFFFFFF)
+
+#define DEF_BURGUNDY_MORE_OUTPUTENABLES (0x7E)
+
+#define DEF_BURGUNDY_ATTENSPEAKER (0x44)
+#define DEF_BURGUNDY_ATTENLINEOUT (0xCC)
+#define DEF_BURGUNDY_ATTENHP (0xCC)
+
+#endif /* _AWACS_DEFS_H_ */
index 3c69e4c1c11e7041ced90b97cc35198738e3c5ac..13f11469116eb1c45e3c808485e5ba59c29a215d 100644 (file)
@@ -16,8 +16,8 @@ while (<STDIN>) {
     # ':' <len> <addr> <type> <len-data> <crc> '\r'
     #  len, type, crc are 2-char hex, addr is 4-char hex. type is 00 for
     # normal records, 01 for EOF
-    my($lenstring, $addrstring, $typestring, $reststring) =
-      /^:(\w\w)(\w\w\w\w)(\w\w)(\w+)$/;
+    my($lenstring, $addrstring, $typestring, $reststring, $doscrap) =
+      /^:(\w\w)(\w\w\w\w)(\w\w)(\w+)(\r?)$/;
     die "malformed line: $_" unless $reststring;
     last if $typestring eq '01';
     my($len) = hex($lenstring);
index a305283bb3cb979041dcce44513ab99b71134ada..cdad3cabe3b75112181ab17469fbf7c6e44c9835 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * USB FTDI SIO driver
  *
- *     (C) Copyright (C) 1999, 2000
+ *     Copyright (C) 1999, 2000
  *         Greg Kroah-Hartman (greg@kroah.com)
  *          Bill Ryder (bryder@sgi.com)
  *
index c63f1b856df6758c1797bdda5194a1f4c4f335d1..f91e1b592a4558b541a59f95fe11696078ca98c9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * USB Keyspan PDA Converter driver
  *
- *     (C) Copyright (C) 1999, 2000
+ *     Copyright (C) 1999, 2000
  *         Greg Kroah-Hartman (greg@kroah.com)
  *
  *     This program is free software; you can redistribute it and/or modify
index 2edcb6e86d1f69c1291d090012385ac8bd0ad606..9eb6767f08f1cf9060ca3c989855c694c91c9bc9 100644 (file)
@@ -8,6 +8,8 @@
  *
  * See Documentation/usb/usb-serial.txt for more information on using this driver
  *
+ * Please report both successes and troubles to the author at omninet@kroah.com
+ *
  */
 
 #include <linux/config.h>
index 9a2f1089649f9bcea4393191ea49093609bb2dee..b8e2e1d7445f5e0a5d5b041521a9991b9d157ee2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * USB Serial Converter driver
  *
- *     (C) Copyright (C) 1999, 2000
+ *     Copyright (C) 1999, 2000
  *         Greg Kroah-Hartman (greg@kroah.com)
  *
  *     This program is free software; you can redistribute it and/or modify
@@ -20,7 +20,7 @@
 #include <linux/config.h>
 
 #define SERIAL_TTY_MAJOR       188     /* Nice legal number now */
-#define SERIAL_TTY_MINORS      16      /* Actually we are allowed 255, but this is good for now */
+#define SERIAL_TTY_MINORS      255     /* loads of devices :) */
 
 #define MAX_NUM_PORTS          8       /* The maximum number of ports one device can grab at once */
 
index ea9a2983866dc2a394d29606525ff70f24740289..9fe65ae8dcf95b9cea9f4ca530c87db63396fd13 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * USB Serial Converter driver
  *
- *     (C) Copyright (C) 1999, 2000
+ *     Copyright (C) 1999, 2000
  *         Greg Kroah-Hartman (greg@kroah.com)
  *
  *     This program is free software; you can redistribute it and/or modify
  * 
  * (05/03/2000) gkh
  *     Added the Digi Acceleport driver from Al Borchers and Peter Berger.
+ * 
+ * (05/02/2000) gkh
+ *     Changed devfs and tty register code to work properly now. This was based on
+ *     the ACM driver changes by Vojtech Pavlik.
  *
  * (04/27/2000) Ryan VanderBijl
  *     Put calls to *_paranoia_checks into one function.
@@ -295,11 +299,6 @@ static struct usb_serial_device_type *usb_serial_devices[] = {
 };
 
 
-/* variables needed for the tty_driver structure */
-static char *driver_name       = "usb";
-static char *tty_driver_name   = "usb/tty/%d";
-
-
 /* local function prototypes */
 static int  serial_open (struct tty_struct *tty, struct file * filp);
 static void serial_close (struct tty_struct *tty, struct file * filp);
@@ -321,6 +320,7 @@ static struct usb_driver usb_serial_driver = {
 };
 
 static int                     serial_refcount;
+static struct tty_driver       serial_tty_driver;
 static struct tty_struct *     serial_tty[SERIAL_TTY_MINORS];
 static struct termios *                serial_termios[SERIAL_TTY_MINORS];
 static struct termios *                serial_termios_locked[SERIAL_TTY_MINORS];
@@ -886,48 +886,6 @@ static void generic_write_bulk_callback (struct urb *urb)
 }
 
 
-static struct tty_driver * usb_serial_tty_driver_init (struct usb_serial *serial)
-{
-       struct tty_driver *serial_tty_driver;
-
-       if (!(serial_tty_driver = kmalloc(sizeof(struct tty_driver), GFP_KERNEL))) {
-               err("Out of memory");
-               return NULL;
-       }
-
-       memset (serial_tty_driver, 0x00, sizeof(struct tty_driver));
-
-       /* initialize the entries that we don't want to be NULL */
-       serial_tty_driver->magic                = TTY_DRIVER_MAGIC;
-       serial_tty_driver->driver_name          = driver_name;
-       serial_tty_driver->name                 = tty_driver_name;
-       serial_tty_driver->major                = SERIAL_TTY_MAJOR;
-       serial_tty_driver->minor_start          = serial->minor;
-       serial_tty_driver->num                  = serial->num_ports;
-       serial_tty_driver->type                 = TTY_DRIVER_TYPE_SERIAL;
-       serial_tty_driver->subtype              = SERIAL_TYPE_NORMAL;
-       serial_tty_driver->flags                = TTY_DRIVER_REAL_RAW;
-       serial_tty_driver->refcount             = &serial_refcount;
-       serial_tty_driver->table                = serial_tty;
-       serial_tty_driver->termios              = serial_termios;
-       serial_tty_driver->termios_locked       = serial_termios_locked;
-       serial_tty_driver->open                 = serial_open;
-       serial_tty_driver->close                = serial_close;
-       serial_tty_driver->write                = serial_write;
-       serial_tty_driver->write_room           = serial_write_room;
-       serial_tty_driver->ioctl                = serial_ioctl;
-       serial_tty_driver->set_termios          = serial_set_termios;
-       serial_tty_driver->throttle             = serial_throttle;
-       serial_tty_driver->unthrottle           = serial_unthrottle;
-       serial_tty_driver->break_ctl            = serial_break;
-       serial_tty_driver->chars_in_buffer      = serial_chars_in_buffer;
-       serial_tty_driver->init_termios         = tty_std_termios;
-       serial_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
-
-       return serial_tty_driver;
-}
-
-
 static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum)
 {
        struct usb_serial *serial = NULL;
@@ -1047,18 +1005,6 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum)
        serial->num_bulk_out = num_bulk_out;
        serial->num_interrupt_in = num_interrupt_in;
 
-       /* initialize a tty_driver for this device */
-       serial->tty_driver = usb_serial_tty_driver_init (serial);
-       if (serial->tty_driver == NULL) {
-               err("Can't create a tty_serial_driver");
-               goto probe_error;
-       }
-
-       if (tty_register_driver (serial->tty_driver)) {
-               err("failed to register tty driver");
-               goto probe_error;
-       }
-       
        /* if this device type has a startup function, call it */
        if (type->startup) {
                if (type->startup (serial)) {
@@ -1142,14 +1088,16 @@ static void * usb_serial_probe(struct usb_device *dev, unsigned int ifnum)
        max_endpoints = MAX(max_endpoints, num_interrupt_in);
        for (i = 0; i < max_endpoints; ++i) {
                port = &serial->port[i];
-               port->number = i;
+               port->number = i + serial->minor;
                port->serial = serial;
                port->magic = USB_SERIAL_PORT_MAGIC;
        }
        
+       /* initialize the devfs nodes for this device and let the user know what ports we are bound to */
        for (i = 0; i < serial->num_ports; ++i) {
-               info("%s converter now attached to ttyUSB%d", 
-                    type->name, serial->minor + i);
+               tty_register_devfs (&serial_tty_driver, 0, serial->port[i].number);
+               info("%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)", 
+                    type->name, serial->port[i].number, serial->port[i].number);
        }
        
        return serial; /* success */
@@ -1181,13 +1129,6 @@ probe_error:
        /* return the minor range that this device had */
        return_serial (serial);
 
-       /* if this device has a tty_driver, then unregister it and free it */
-       if (serial->tty_driver) {
-               tty_unregister_driver (serial->tty_driver);
-               kfree (serial->tty_driver);
-               serial->tty_driver = NULL;
-       }
-
        /* free up any memory that we allocated */
        kfree (serial);
        MOD_DEC_USE_COUNT;
@@ -1237,18 +1178,13 @@ static void usb_serial_disconnect(struct usb_device *dev, void *ptr)
                }
 
                for (i = 0; i < serial->num_ports; ++i) {
-                       info("%s converter now disconnected from ttyUSB%d", serial->type->name, serial->minor + i);
+                       tty_unregister_devfs (&serial_tty_driver, serial->port[i].number);
+                       info("%s converter now disconnected from ttyUSB%d", serial->type->name, serial->port[i].number);
                }
 
                /* return the minor range that this device had */
                return_serial (serial);
 
-               /* if this device has a tty_driver, then unregister it and free it */
-               if (serial->tty_driver) {
-                       tty_unregister_driver (serial->tty_driver);
-                       kfree (serial->tty_driver);
-                       serial->tty_driver = NULL;
-               }
                /* free up any memory that we allocated */
                kfree (serial);
 
@@ -1260,6 +1196,35 @@ static void usb_serial_disconnect(struct usb_device *dev, void *ptr)
 }
 
 
+static struct tty_driver serial_tty_driver = {
+       magic:                  TTY_DRIVER_MAGIC,
+       driver_name:            "usb-serial",
+       name:                   "usb/tts/%d",
+       major:                  SERIAL_TTY_MAJOR,
+       minor_start:            0,
+       num:                    SERIAL_TTY_MINORS,
+       type:                   TTY_DRIVER_TYPE_SERIAL,
+       subtype:                SERIAL_TYPE_NORMAL,
+       flags:                  TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS,
+       
+       refcount:               &serial_refcount,
+       table:                  serial_tty,
+       termios:                serial_termios,
+       termios_locked:         serial_termios_locked,
+       
+       open:                   serial_open,
+       close:                  serial_close,
+       write:                  serial_write,
+       write_room:             serial_write_room,
+       ioctl:                  serial_ioctl,
+       set_termios:            serial_set_termios,
+       throttle:               serial_throttle,
+       unthrottle:             serial_unthrottle,
+       break_ctl:              serial_break,
+       chars_in_buffer:        serial_chars_in_buffer,
+};
+
+
 int usb_serial_init(void)
 {
        int i;
@@ -1282,9 +1247,18 @@ int usb_serial_init(void)
        if (!something)
                info ("USB Serial driver is not configured for any devices!");
 
+       /* register the tty driver */
+       serial_tty_driver.init_termios          = tty_std_termios;
+       serial_tty_driver.init_termios.c_cflag  = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
+       if (tty_register_driver (&serial_tty_driver)) {
+               err("failed to register tty driver");
+               return -1;
+       }
+
        /* register the USB driver */
        result = usb_register(&usb_serial_driver);
        if (result < 0) {
+               tty_unregister_driver(&serial_tty_driver);
                err("usb_register failed for the usb-serial driver. Error number %d", result);
                return -1;
        }
@@ -1296,6 +1270,7 @@ int usb_serial_init(void)
 void usb_serial_exit(void)
 {
        usb_deregister(&usb_serial_driver);
+       tty_unregister_driver(&serial_tty_driver);
 }
 
 
index 77f1199eb5ec4c2bc5fc36cb6735b4670be767a3..979a56f0119462732bb1c41df646c8f1412b5f25 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * USB HandSpring Visor driver
  *
- *     (C) Copyright (C) 1999, 2000
+ *     Copyright (C) 1999, 2000
  *         Greg Kroah-Hartman (greg@kroah.com)
  *
  *     This program is free software; you can redistribute it and/or modify
index a1173697de02009ebba1cc8f0086952c594d39c9..6407a7811d43da97e487553caacc085fd8799115 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * USB HandSpring Visor driver
  *
- *     (C) Copyright (C) 1999, 2000
+ *     Copyright (C) 1999, 2000
  *         Greg Kroah-Hartman (greg@kroah.com)
  *
  *     This program is free software; you can redistribute it and/or modify
index aa6c14b0b8e323d1c8fcd064d95521a4bc3052d0..58f761fbfe1fa689f78418b04bafffca3ca95393 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * USB ConnectTech WhiteHEAT driver
  *
- *     (C) Copyright (C) 1999, 2000
+ *     Copyright (C) 1999, 2000
  *         Greg Kroah-Hartman (greg@kroah.com)
  *
  *     This program is free software; you can redistribute it and/or modify
  *
  * See Documentation/usb/usb-serial.txt for more information on using this driver
  * 
+ * (05/04/2000) gkh
+ *     First cut at open and close commands. Data can flow through the ports at
+ *     default speeds now.
+ *
  * (03/26/2000) gkh
  *     Split driver up into device specific pieces.
  * 
@@ -45,6 +49,7 @@
 
 #include "whiteheat_fw.h"              /* firmware for the ConnectTech WhiteHEAT device */
 
+#include "whiteheat.h"                 /* WhiteHEAT specific commands */
 
 #define CONNECT_TECH_VENDOR_ID         0x0710
 #define CONNECT_TECH_FAKE_WHITE_HEAT_ID        0x0001
@@ -57,6 +62,7 @@ static void whiteheat_set_termios     (struct usb_serial_port *port, struct termios
 static void whiteheat_throttle         (struct usb_serial_port *port);
 static void whiteheat_unthrottle       (struct usb_serial_port *port);
 static int  whiteheat_startup          (struct usb_serial *serial);
+static void whiteheat_shutdown         (struct usb_serial *serial);
 
 /* All of the device info needed for the Connect Tech WhiteHEAT */
 static __u16   connecttech_vendor_id                   = CONNECT_TECH_VENDOR_ID;
@@ -91,14 +97,124 @@ struct usb_serial_device_type whiteheat_device = {
        throttle:               whiteheat_throttle,
        unthrottle:             whiteheat_unthrottle,
        set_termios:            whiteheat_set_termios,
+       shutdown:               whiteheat_shutdown,
+};
+
+struct whiteheat_private {
+       __u8                    command_finished;
+       wait_queue_head_t       wait_command;   /* for handling sleeping while waiting for a command to finish */
 };
 
 
+#define COMMAND_PORT           4
+#define COMMAND_TIMEOUT                (2*HZ)  /* 2 second timeout for a command */
+
 /*****************************************************************************
  * Connect Tech's White Heat specific driver functions
  *****************************************************************************/
+static void command_port_write_callback (struct urb *urb)
+{
+       unsigned char *data = urb->transfer_buffer;
+#ifdef DEBUG
+       int i;
+#endif
+
+       dbg ("command_port_write_callback");
+
+       if (urb->status) {
+               dbg ("nonzero urb status: %d", urb->status);
+               return;
+       }
+
+#ifdef DEBUG
+       if (urb->actual_length) {
+               printk (KERN_DEBUG __FILE__ ": data read - length = %d, data = ", urb->actual_length);
+               for (i = 0; i < urb->actual_length; ++i) {
+                       printk ("%.2x ", data[i]);
+               }
+               printk ("\n");
+       }
+#endif
+
+       return;
+}
+
+
+static void command_port_read_callback (struct urb *urb)
+{
+       struct whiteheat_private *info = (struct whiteheat_private *)urb->context;
+       unsigned char *data = urb->transfer_buffer;
+#ifdef DEBUG
+       int i;
+#endif
+
+       dbg ("command_port_write_callback");
+
+       if (urb->status) {
+               dbg ("nonzero urb status: %d", urb->status);
+               return;
+       }
+
+#ifdef DEBUG
+       if (urb->actual_length) {
+               printk (KERN_DEBUG __FILE__ ": data read - length = %d, data = ", urb->actual_length);
+               for (i = 0; i < urb->actual_length; ++i) {
+                       printk ("%.2x ", data[i]);
+               }
+               printk ("\n");
+       }
+#endif
+
+       /* right now, if the command is COMMAND_COMPLETE, just flip the bit saying the command finished */
+       /* in the future we're going to have to pay attention to the actual command that completed */
+       if (data[0] == WHITEHEAT_CMD_COMPLETE) {
+               info->command_finished = TRUE;
+       }
+       
+       return;
+}
+
+
+static int whiteheat_send_cmd (struct usb_serial *serial, __u8 command, __u8 *data, __u8 datasize)
+{
+       struct whiteheat_private *info;
+       struct usb_serial_port *port;
+       int timeout;
+       __u8 *transfer_buffer;
+
+       dbg("whiteheat_send_cmd: %d", command);
+
+       port = &serial->port[COMMAND_PORT];
+       info = (struct whiteheat_private *)port->private;
+       info->command_finished = FALSE;
+       
+       transfer_buffer = (__u8 *)port->write_urb->transfer_buffer;
+       transfer_buffer[0] = command;
+       memcpy (&transfer_buffer[1], data, datasize);
+       port->write_urb->transfer_buffer_length = datasize + 1;
+       if (usb_submit_urb (port->write_urb))
+               dbg ("submit urb failed");
+
+       /* wait for the command to complete */
+       timeout = COMMAND_TIMEOUT;
+       while (timeout && (info->command_finished == FALSE)) {
+               timeout = interruptible_sleep_on_timeout (&info->wait_command, timeout);
+       }
+
+       if (info->command_finished == FALSE) {
+               return -1;
+       }
+
+       return 0;
+}
+
+
 static int whiteheat_open (struct usb_serial_port *port, struct file *filp)
 {
+       struct whiteheat_min_set        open_command;
+       struct usb_serial_port          *command_port;
+       struct whiteheat_private        *info;
+
        dbg("whiteheat_open port %d", port->number);
 
        if (port->active) {
@@ -106,22 +222,50 @@ static int whiteheat_open (struct usb_serial_port *port, struct file *filp)
                return -EINVAL;
        }
        port->active = 1;
-       /*Start reading from the device*/
+
+       /* set up some stuff for our command port */
+       command_port = &port->serial->port[COMMAND_PORT];
+       if (command_port->private == NULL) {
+               info = (struct whiteheat_private *)kmalloc (sizeof(struct whiteheat_private), GFP_KERNEL);
+               if (info == NULL) {
+                       err("out of memory");
+                       return -ENOMEM;
+               }
+               
+               init_waitqueue_head(&info->wait_command);
+               command_port->private = info;
+               command_port->write_urb->complete = command_port_write_callback;
+               command_port->read_urb->complete = command_port_read_callback;
+               usb_submit_urb (command_port->read_urb);        
+       }
+       
+       /* Start reading from the device */
        if (usb_submit_urb(port->read_urb))
                dbg("usb_submit_urb(read bulk) failed");
 
+       /* send an open port command */
+       open_command.port = port->number - port->minor;
+       whiteheat_send_cmd (port->serial, WHITEHEAT_OPEN, (__u8 *)&open_command, sizeof(open_command));
+
        /* Need to do device specific setup here (control lines, baud rate, etc.) */
        /* FIXME!!! */
 
+       dbg("whiteheat_open exit");
+       
        return (0);
 }
 
 
 static void whiteheat_close(struct usb_serial_port *port, struct file * filp)
 {
+       struct whiteheat_min_set        close_command;
+       
        dbg("whiteheat_close port %d", port->number);
        
+       /* send a close command to the port */
+       close_command.port = port->number - port->minor;
+       whiteheat_send_cmd (port->serial, WHITEHEAT_CLOSE, (__u8 *)&close_command, sizeof(close_command));
+
        /* Need to change the control lines here */
        /* FIXME */
        
@@ -243,7 +387,24 @@ static int  whiteheat_startup (struct usb_serial *serial)
        response = ezusb_set_reset (serial, 0);
 
        /* we want this device to fail to have a driver assigned to it. */
-       return (1);
+       return 1;
+}
+
+
+static void whiteheat_shutdown (struct usb_serial *serial)
+{
+       struct usb_serial_port          *command_port;
+
+       dbg("whiteheat_shutdown");
+
+       /* set up some stuff for our command port */
+       command_port = &serial->port[COMMAND_PORT];
+       if (command_port->private != NULL) {
+               kfree (command_port->private);
+               command_port->private = NULL;
+       }
+
+       return;
 }
 
 #endif /* CONFIG_USB_SERIAL_WHITEHEAT */
diff --git a/drivers/usb/serial/whiteheat.h b/drivers/usb/serial/whiteheat.h
new file mode 100644 (file)
index 0000000..970a555
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * USB ConnectTech WhiteHEAT driver
+ *
+ *      Copyright (C) 1999, 2000
+ *          Greg Kroah-Hartman (greg@kroah.com)
+ *
+ *      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
+ *      the Free Software Foundation; either version 2 of the License, or
+ *      (at your option) any later version.
+ *
+ * See Documentation/usb/usb-serial.txt for more information on using this driver
+ *
+ */
+
+#ifndef __LINUX_USB_SERIAL_WHITEHEAT_H
+#define __LINUX_USB_SERIAL_WHITEHEAT_H
+
+
+#define FALSE                          0
+#define TRUE                           1
+
+/* WhiteHEAT commands */
+#define WHITEHEAT_OPEN                 1       /* open the port */
+#define WHITEHEAT_CLOSE                        2       /* close the port */
+#define WHITEHEAT_SETUP_PORT           3       /* change port settings */
+#define WHITEHEAT_SET_RTS              4       /* turn RTS on or off */
+#define WHITEHEAT_SET_DTR              5       /* turn DTR on or off */
+#define WHITEHEAT_SET_BREAK            6       /* turn BREAK on or off */
+#define WHITEHEAT_DUMP                 7       /* dump memory */
+#define WHITEHEAT_STATUS               8       /* get status */
+#define WHITEHEAT_PURGE                        9       /* clear the UART fifos */
+#define WHITEHEAT_GET_DTR_RTS          10      /* get the state of DTR and RTS for a port */
+#define WHITEHEAT_GET_HW_INFO          11      /* get EEPROM info and hardware ID */
+#define WHITEHEAT_REPORT_TX_DONE       12      /* get the next TX done */
+#define WHITEHEAT_EVENT                        13      /* unsolicited status events */
+#define WHITEHEAT_ECHO                 14      /* send data to the indicated IN endpoint */
+#define WHITEHEAT_DO_TEST              15      /* perform the specified test */
+#define WHITEHEAT_CMD_COMPLETE         16      /* reply for certain commands */
+
+/* Data for the WHITEHEAT_SETUP_PORT command */
+#define WHITEHEAT_CTS_FLOW             0x08
+#define WHITEHEAT_RTS_FLOW             0x80
+#define WHITEHEAT_DSR_FLOW             0x10
+#define WHITEHEAT_DTR_FLOW             0x02
+struct whiteheat_port_settings {
+       __u8    port;           /* port number (1 to N) */
+       __u32   baud;           /* any value allowed, default 9600, arrives little endian, range is 7 - 460800 */
+       __u8    bits;           /* 5, 6, 7, or 8, default 8 */
+       __u8    stop;           /* 1 or 2, default 1 (2 = 1.5 if bits = 5) */
+       __u8    parity;         /* 'n, e, o, 0, or 1' (ascii), default 'n'
+                                *      n = none        e = even        o = odd
+                                *      0 = force 0     1 = force 1     */
+       __u8    sflow;          /* 'n, r, t, or b' (ascii), default 'n'
+                                *      n = none
+                                *      r = receive (XOFF/XON transmitted when receiver fills / empties)
+                                *      t = transmit (XOFF/XON received will stop/start TX)
+                                *      b = both        */
+       __u8    xoff;           /* XOFF byte value, default 0x13 */
+       __u8    xon;            /* XON byte value, default 0x11 */
+       __u8    hflow;          /* bits indicate mode as follows:
+                                *      CTS (0x08) (CTS off/on will control/cause TX off/on)
+                                *      DSR (0x10) (DSR off/on will control/cause TX off/on)
+                                *      RTS (0x80) (RTS off/on when receiver fills/empties)
+                                *      DTR (0x02) (DTR off/on when receiver fills/empties) */
+       __u8    lloop;          /* local loopback 0 or 1, default 0 */
+};
+
+/* data for WHITEHEAT_SET_RTS, WHITEHEAT_SET_DTR, and WHITEHEAT_SET_BREAK commands */
+struct whiteheat_rdb_set {
+       __u8    port;           /* port number (1 to N) */
+       __u8    state;          /* 0 = off, non-zero = on */
+};
+
+/* data for:
+       WHITEHEAT_OPEN
+       WHITEHEAT_CLOSE
+       WHITEHEAT_STATUS
+       WHITEHEAT_GET_DTR_RTS
+       WHITEHEAT_REPORT_TX_DONE */
+struct whiteheat_min_set {
+       __u8    port;           /* port number (1 to N) */
+};
+
+/* data for WHITEHEAT_PURGE command */
+#define WHITEHEAT_PURGE_INPUT          0x01
+#define WHITEHEAT_PURGE_OUTPUT         0x02
+struct whiteheat_purge_set {
+       __u8    port;           /* port number (1 to N) */
+       __u8    what;           /* bit pattern of what to purge */
+};
+
+/* data for WHITEHEAT_DUMP command */
+struct whiteheat_dump_info {
+       __u8    mem_type;       /* memory type: 'd' = data, 'i' = idata, 'b' = bdata, 'x' = xdata */
+       __u16   addr;           /* memory address to dump, address range depends on the above mem_type:
+                                *      'd' = 0 to ff (80 to FF is SFR's)
+                                *      'i' = 80 to ff
+                                *      'b' = 20 to 2f (bits returned as bytes)
+                                *      'x' = 0000 to ffff (also code space)    */
+       __u16   length;         /* number of bytes to dump, max 64 */
+};
+
+/* data for WHITEHEAT_ECHO command */
+struct whiteheat_echo_set {
+       __u8    port;           /* port number (1 to N) */
+       __u8    length;         /* length of message to echo */
+       __u8    echo_data[61];  /* data to echo */
+};
+
+/* data returned from WHITEHEAT_STATUS command */
+#define WHITEHEAT_OVERRUN_ERROR                0x02
+#define WHITEHEAT_PARITY_ERROR         0x04
+#define WHITEHEAT_FRAMING_ERROR                0x08
+#define WHITEHEAT_BREAK_ERROR          0x10
+
+#define WHITEHEAT_OHFLOW               0x01    /* TX is stopped by CTS (waiting for CTS to go ON) */
+#define WHITEHEAT_IHFLOW               0x02    /* remote TX is stopped by RTS */
+#define WHITEHEAT_OSFLOW               0x04    /* TX is stopped by XOFF received (waiting for XON to occur) */
+#define WHITEHEAT_ISFLOW               0x08    /* remote TX is stopped by XOFF transmitted */
+#define WHITEHEAT_TX_DONE              0x80    /* TX has completed */
+
+#define WHITEHEAT_MODEM_EVENT          0x01
+#define WHITEHEAT_ERROR_EVENT          0x02
+#define WHITEHEAT_FLOW_EVENT           0x04
+#define WHITEHEAT_CONNECT_EVENT                0x08
+struct whiteheat_status_info {
+       __u8    port;           /* port number (1 to N) */
+       __u8    event;          /* indicates which of the following bytes are the current event */
+       __u8    modem;          /* modem signal status (copy of UART MSR register) */
+       __u8    error;          /* PFO and RX break (copy of UART LSR register) */
+       __u8    flow;           /* flow control state */
+       __u8    connect;        /* connect state, non-zero value indicates connected */
+};
+
+/* data returned from WHITEHEAT_EVENT command */
+struct whiteheat_event {
+       __u8    port;           /* port number (1 to N) */
+       __u8    event;          /* indicates which of the following bytes are the current event */
+       __u8    info;           /* either modem, error, flow, or connect information */
+};
+
+/* data retured by the WHITEHEAT_GET_HW_INFO command */
+struct whiteheat_hw_info {
+       __u8    hw_id;          /* hardware id number, WhiteHEAT = 0 */
+       __u8    sw_major_rev;   /* major version number */
+       __u8    sw_minor_rev;   /* minor version number */
+       struct whiteheat_hw_eeprom_info {
+               __u8    b0;                     /* B0 */
+               __u8    vendor_id_low;          /* vendor id (low byte) */
+               __u8    vendor_id_high;         /* vendor id (high byte) */
+               __u8    product_id_low;         /* product id (low byte) */
+               __u8    product_id_high;        /* product id (high byte) */
+               __u8    device_id_low;          /* device id (low byte) */
+               __u8    device_id_high;         /* device id (high byte) */
+               __u8    not_used_1;
+               __u8    serial_number_0;        /* serial number (low byte) */
+               __u8    serial_number_1;        /* serial number */
+               __u8    serial_number_2;        /* serial number */
+               __u8    serial_number_3;        /* serial number (high byte) */
+               __u8    not_used_2;
+               __u8    not_used_3;
+               __u8    checksum_low;           /* checksum (low byte) */
+               __u8    checksum_high;          /* checksum (high byte */
+       } hw_eeprom_info;       /* EEPROM contents */
+};
+
+#endif
+
index 9f05d7f03ed57703708e6ff0da4a0f85a1175f44..d6e2b8a2dc7e79c5dcbcd1574521c1d05610ded1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * drivers/video/clgenfb.c - driver for Cirrus Logic chipsets
  *
- * Copyright 1999 Jeff Garzik <jgarzik@mandrakesoft.com>
+ * Copyright 1999,2000 Jeff Garzik <jgarzik@mandrakesoft.com>
  *
  * Contributors (thanks, all!)
  *
@@ -31,7 +31,7 @@
  *
  */
 
-#define CLGEN_VERSION "1.9.4.5"
+#define CLGEN_VERSION "1.9.5"
 
 #include <linux/config.h>
 #include <linux/module.h>
 #include "vga.h"
 
 
-/*****************************************************************
- *
- * compatibility with older kernel versions
- *
- */
-
-#ifndef LINUX_VERSION_CODE
-#include <linux/version.h>
-#endif
-
-#ifndef KERNEL_VERSION
-#define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z))
-#endif
-
-#ifndef PCI_DEVICE_ID_CIRRUS_5462
-#define PCI_DEVICE_ID_CIRRUS_5462      0x00d0
-#endif
-
-
-
-
 /*****************************************************************
  *
  * debugging and utility macros
 #define MAX_NUM_BOARDS 7
 
 
-
-
 /*****************************************************************
  *
  * chipset information
@@ -161,7 +138,6 @@ typedef enum {
 } clgen_board_t;
 
 
-
 /*
  * per-board-type information, used for enumerating and abstracting
  * chip-specific information
@@ -311,7 +287,6 @@ static const struct {
 #endif /* CONFIG_PCI */
 
 
-
 #ifdef CONFIG_ZORRO
 static const struct {
        clgen_board_t btype;
@@ -495,10 +470,6 @@ static const char *clgenfb_name = "CLgen";
 int clgenfb_init (void);
 int clgenfb_setup (char *options);
 
-#ifdef MODULE
-static void clgenfb_cleanup (struct clgenfb_info *info);
-#endif
-
 static int clgenfb_open (struct fb_info *info, int user);
 static int clgenfb_release (struct fb_info *info, int user);
 static int clgenfb_ioctl (struct inode *inode, struct file *file,
@@ -2592,7 +2563,10 @@ static void clgen_pci_unmap (struct clgenfb_info *info)
        iounmap (info->fbmem);
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,13)
        release_mem_region(info->fbmem_phys, info->size);
+
+#if 0 /* if system didn't claim this region, we would... */
        release_mem_region(0xA0000, 65535);
+#endif
        if (release_io_ports)
                release_region(0x3C0, 32);
 #endif
@@ -2682,6 +2656,7 @@ static int __init clgen_pci_setup (struct clgenfb_info *info,
                       board_addr);
                return -1;
        }
+#if 0 /* if the system didn't claim this region, we would... */
        if (!request_mem_region(0xA0000, 65535, "clgenfb")) {
                pci_write_config_word (pdev, PCI_COMMAND, tmp16);
                printk(KERN_ERR "clgen: cannot reserve region 0x%lu, abort\n",
@@ -2689,6 +2664,7 @@ static int __init clgen_pci_setup (struct clgenfb_info *info,
                release_mem_region(board_addr, board_size);
                return -1;
        }
+#endif
        if (request_region(0x3C0, 32, "clgenfb"))
                release_io_ports = 1;
 
@@ -2932,25 +2908,15 @@ int __init clgenfb_init(void)
 #if defined(CONFIG_FB_OF)
 int __init clgen_of_init (struct device_node *dp)
 {
-       int rc;
-       
-       DPRINTK ("ENTER\n");
-
-       rc = clgenfb_init ();
-
-       DPRINTK ("EXIT, returning %d\n", rc);
-
-       return rc;
+       return clgenfb_init ();
 }
 #endif                         /* CONFIG_FB_OF */
 
 
-
     /*
      *  Cleanup (only needed for module)
      */
-#ifdef MODULE
-static void clgenfb_cleanup (struct clgenfb_info *info)
+static void __exit clgenfb_cleanup (struct clgenfb_info *info)
 {
        DPRINTK ("ENTER\n");
 
@@ -2967,9 +2933,6 @@ static void clgenfb_cleanup (struct clgenfb_info *info)
 
        DPRINTK ("EXIT\n");
 }
-#endif
-
-
 
 
 #ifndef MODULE
@@ -2999,33 +2962,14 @@ int __init clgenfb_setup(char *options) {
 #endif
 
 
-
-
-
     /*
      *  Modularization
      */
 
-#ifdef MODULE
-MODULE_AUTHOR("Copyright 1999 Jeff Garzik <jgarzik@mandrakesoft.com>");
+MODULE_AUTHOR("Copyright 1999,2000 Jeff Garzik <jgarzik@mandrakesoft.com>");
 MODULE_DESCRIPTION("Accelerated FBDev driver for Cirrus Logic chips");
 
-int init_module (void)
-{
-#if defined(CONFIG_FB_OF)
-/* Nothing to do, must be called from offb */
-       return 0;
-#else
-       int i;
-       
-       DPRINTK ("ENTER\n");
-       i = clgenfb_init ();
-       DPRINTK ("EXIT\n");
-       return i;
-#endif
-}
-
-void cleanup_module (void)
+static void __exit clgenfb_exit (void)
 {
        DPRINTK ("ENTER\n");
 
@@ -3034,7 +2978,10 @@ void cleanup_module (void)
        DPRINTK ("EXIT\n");
 }
 
-#endif                         /* MODULE */
+#ifdef MODULE
+module_init(clgenfb_init);
+#endif
+module_exit(clgenfb_exit);
 
 
 /**********************************************************************/
@@ -3144,7 +3091,6 @@ static void WHDR (const struct clgenfb_info *fb_info, unsigned char val)
 }
 
 
-
 /*** WSFR() - write to the "special function register" (SFR) ***/
 static void WSFR (struct clgenfb_info *fb_info, unsigned char val)
 {
@@ -3193,7 +3139,6 @@ static void WClut (struct clgenfb_info *fb_info, unsigned char regnum, unsigned
 }
 
 
-
 #if 0
 /*** RClut - read CLUT entry (range 0..63) ***/
 static void RClut (struct clgenfb_info *fb_info, unsigned char regnum, unsigned char *red,
@@ -3322,6 +3267,7 @@ static void clgen_BitBLT (caddr_t regbase, u_short curx, u_short cury, u_short d
        DPRINTK ("EXIT\n");
 }
 
+
 /*******************************************************************
        clgen_RectFill()
 
@@ -3402,6 +3348,7 @@ static void clgen_RectFill (struct clgenfb_info *fb_info,
        DPRINTK ("EXIT\n");
 }
 
+
 /**************************************************************************
  * bestclock() - determine closest possible clock lower(?) than the
  * desired pixel clock
@@ -3478,10 +3425,6 @@ static void bestclock (long freq, long *best, long *nom,
 }
 
 
-
-
-
-
 /* -------------------------------------------------------------------------
  *
  * debugging functions
@@ -3518,7 +3461,6 @@ void clgen_dbg_print_byte (const char *name, unsigned char val)
 }
 
 
-
 /**
  * clgen_dbg_print_regs
  * @base: If using newmmio, the newmmio base address, otherwise %NULL
@@ -3566,9 +3508,6 @@ void clgen_dbg_print_regs (caddr_t regbase, clgen_dbg_reg_class_t reg_class,...)
 }
 
 
-
-
-
 /**
  * clgen_dump
  * @clgeninfo:
@@ -3583,7 +3522,6 @@ void clgen_dump (void)
 }
 
 
-
 /**
  * clgen_dbg_reg_dump
  * @base: If using newmmio, the newmmio base address, otherwise %NULL
@@ -3685,5 +3623,5 @@ void clgen_dbg_reg_dump (caddr_t regbase)
        DPRINTK ("\n");
 }
 
-
 #endif                         /* CLGEN_DEBUG */
+
index 525a33247779ebadda6c00cba9fc0e26bf9bc6f4..38997e99bc7da27de750a3530c44aeaa5e0181b9 100644 (file)
@@ -131,10 +131,12 @@ static int sbusfb_open(struct fb_info *info, int user)
        struct fb_info_sbusfb *fb = sbusfbinfo(info);
        
        if (user) {
-               if (fb->open) return -EBUSY;
-               fb->mmaped = 0;
-               fb->open = 1;
-               fb->vtconsole = -1;
+               if (fb->open == 0) {
+                       fb->mmaped = 0;
+                       fb->open = 1;
+                       fb->vtconsole = -1;
+               }
+               fb->open++;
        } else
                fb->consolecnt++;
        MOD_INC_USE_COUNT;
@@ -146,15 +148,18 @@ static int sbusfb_release(struct fb_info *info, int user)
        struct fb_info_sbusfb *fb = sbusfbinfo(info);
 
        if (user) {     
-               if (fb->vtconsole != -1) {
-                       vt_cons[fb->vtconsole]->vc_mode = KD_TEXT;
-                       if (fb->mmaped) {
-                               fb->graphmode--;
-                               sbusfb_clear_margin(&fb_display[fb->vtconsole], 0);
+               fb->open--;
+               if (fb->open == 0) {
+                       if (fb->vtconsole != -1) {
+                               vt_cons[fb->vtconsole]->vc_mode = KD_TEXT;
+                               if (fb->mmaped) {
+                                       fb->graphmode--;
+                                       sbusfb_clear_margin(&fb_display[fb->vtconsole], 0);
+                               }
                        }
+                       if (fb->reset)
+                               fb->reset(fb);
                }
-               if (fb->reset)
-                       fb->reset(fb);
                fb->open = 0;
        } else
                fb->consolecnt--;
index 35dbad536ef876c6b6ec8a3f9e96e1955e994a40..54d6165e99651be626007f7f35ca1fc1659b8961 100644 (file)
@@ -2052,10 +2052,10 @@ int __init tdfxfb_init(void) {
       currcon = -1;
       if (!nohwcursor) tdfxfb_hwcursor_init();
        
+      init_timer(&fb_info.cursor.timer);
       fb_info.cursor.timer.function = do_flashcursor; 
-      fb_info.cursor.state = CM_ERASE;
-      fb_info.cursor.timer.prev = fb_info.cursor.timer.next=NULL;
       fb_info.cursor.timer.data = (unsigned long)(&fb_info);
+      fb_info.cursor.state = CM_ERASE;
       spin_lock_init(&fb_info.DAClock);
        
       strcpy(fb_info.fb_info.modename, "3Dfx "); 
index b88adcdc5b490ee68cef0ef3b3c3d53d18516bfd..43866a338f1ba3a2b32d7d01aa944fa92f85769e 100644 (file)
@@ -104,8 +104,6 @@ static struct { u_short blue, green, red, pad; } palette[256];
 
 static int             currcon   = 0;
 
-static int release_io_ports = 0;
-
 /* --------------------------------------------------------------------- */
 
        /*
@@ -918,16 +916,13 @@ static void vga16fb_blank(int blank, struct fb_info *fb_info)
        }
 }
 
-int __init vga16_init(void)
+int __init vga16fb_init(void)
 {
        int i,j;
 
        printk(KERN_DEBUG "vga16fb: initializing\n");
 
-       if (!request_mem_region(VGA_FB_PHYS, VGA_FB_PHYS_LEN, "vga16fb")) {
-               printk (KERN_ERR "vga16fb: unable to reserve VGA memory, exiting\n");
-               return -1;
-       }
+       /* XXX share VGA_FB_PHYS region with vgacon */
 
         vga16fb.video_vbase = ioremap(VGA_FB_PHYS, VGA_FB_PHYS_LEN);
        printk(KERN_INFO "vga16fb: mapped to 0x%p\n", vga16fb.video_vbase);
@@ -948,10 +943,7 @@ int __init vga16_init(void)
                palette[i].blue  = default_blu[j];
        }
 
-       /* note - does not cause failure, b/c vgacon probably still owns this 
-        * region (FIXME) */
-       if (request_region(0x3C0, 32, "vga16fb"))
-               release_io_ports = 1;
+       /* XXX share VGA I/O region with vgacon and others */
 
        disp.var = vga16fb_defined;
 
@@ -976,29 +968,18 @@ int __init vga16_init(void)
        return 0;
 }
 
-#ifndef MODULE
-int __init vga16fb_init(void)
-{
-    return vga16_init();
-}
-
-#else /* MODULE */
-
-int init_module(void)
-{
-    return vga16_init();
-}
-
-void cleanup_module(void)
+static void __exit vga16fb_exit(void)
 {
     unregister_framebuffer(&vga16fb.fb_info);
     iounmap(vga16fb.video_vbase);
-    release_mem_region(VGA_FB_PHYS, VGA_FB_PHYS_LEN);
-    if (release_io_ports)
-       release_region(0x3c0, 32);
+    /* XXX unshare VGA regions */
 }
 
+#ifdef MODULE
+module_init(vga16fb_init);
 #endif
+module_exit(vga16fb_exit);
+
 
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
index bf030e2a11e1af781ac1d4f6d5f9b0ec403d8905..63613b8293a6f3604aa25003deee7215762f80b8 100644 (file)
@@ -789,7 +789,7 @@ static void end_buffer_io_async(struct buffer_head * bh, int uptodate)
        /*
         * Run the hooks that have to be done when a page I/O has completed.
         */
-       if (test_and_clear_bit(PG_decr_after, &page->flags))
+       if (PageTestandClearDecrAfter(page))
                atomic_dec(&nr_async_pages);
 
        UnlockPage(page);
@@ -1957,7 +1957,7 @@ int brw_page(int rw, struct page *page, kdev_t dev, int b[], int size)
 
        if (!PageLocked(page))
                panic("brw_page: page not locked for I/O");
-//     clear_bit(PG_error, &page->flags);
+//     ClearPageError(page);
        /*
         * We pretty much rely on the page lock for this, because
         * create_page_buffers() might sleep.
index 5ca6430aa51e668dcc8bab188e607f65df2f21e7..c28ebdf261d77aefbea33845805b5253682d97e2 100644 (file)
@@ -1048,7 +1048,7 @@ done:
         dprintk("NFS:      nfs_updatepage returns %d (isize %Ld)\n",
                                                 status, (long long)inode->i_size);
        if (status < 0)
-               clear_bit(PG_uptodate, &page->flags);
+               ClearPageUptodate(page);
        return status;
 }
 
index 6f73e28dd1392182cde06eca278da1f4f8206f9a..f9c9ab87f4f79bcf7683d8d71dd883d4248a40b5 100644 (file)
@@ -148,20 +148,25 @@ static inline char * task_state(struct task_struct *p, char *buffer)
 {
        int g;
 
+       read_lock(&tasklist_lock);
        buffer += sprintf(buffer,
                "State:\t%s\n"
                "Pid:\t%d\n"
                "PPid:\t%d\n"
                "TracerPid:\t%d\n"
                "Uid:\t%d\t%d\t%d\t%d\n"
-               "Gid:\t%d\t%d\t%d\t%d\n"
-               "FDSize:\t%d\n"
-               "Groups:\t",
+               "Gid:\t%d\t%d\t%d\t%d\n",
                get_task_state(p),
                p->pid, p->p_opptr->pid, p->p_pptr->pid != p->p_opptr->pid ? p->p_opptr->pid : 0,
                p->uid, p->euid, p->suid, p->fsuid,
-               p->gid, p->egid, p->sgid, p->fsgid,
+               p->gid, p->egid, p->sgid, p->fsgid);
+       read_unlock(&tasklist_lock);    
+       task_lock(p);
+       buffer += sprintf(buffer,
+               "FDSize:\t%d\n"
+               "Groups:\t",
                p->files ? p->files->max_fds : 0);
+       task_unlock(p);
 
        for (g = 0; g < p->ngroups; g++)
                buffer += sprintf(buffer, "%d ", p->groups[g]);
@@ -264,20 +269,25 @@ extern inline char *task_cap(struct task_struct *p, char *buffer)
 }
 
 
-/* task is locked, so we are safe here */
-
 int proc_pid_status(struct task_struct *task, char * buffer)
 {
        char * orig = buffer;
-       struct mm_struct *mm = task->mm;
+       struct mm_struct *mm;
 #if defined(CONFIG_ARCH_S390)
        int line,len;
 #endif
 
        buffer = task_name(task, buffer);
        buffer = task_state(task, buffer);
-       if (mm)
+       task_lock(task);
+       mm = task->mm;
+       if(mm)
+               atomic_inc(&mm->mm_users);
+       task_unlock(task);
+       if (mm) {
                buffer = task_mem(mm, buffer);
+               mmput(mm);
+       }
        buffer = task_sig(task, buffer);
        buffer = task_cap(task, buffer);
 #if defined(CONFIG_ARCH_S390)
@@ -287,20 +297,24 @@ int proc_pid_status(struct task_struct *task, char * buffer)
        return buffer - orig;
 }
 
-/* task is locked, so we are safe here */
-
 int proc_pid_stat(struct task_struct *task, char * buffer)
 {
-       struct mm_struct *mm = task->mm;
        unsigned long vsize, eip, esp, wchan;
        long priority, nice;
        int tty_pgrp;
        sigset_t sigign, sigcatch;
        char state;
        int res;
+       pid_t ppid;
+       struct mm_struct *mm;
 
        state = *get_task_state(task);
        vsize = eip = esp = 0;
+       task_lock(task);
+       mm = task->mm;
+       if(mm)
+               atomic_inc(&mm->mm_users);
+       task_unlock(task);
        if (mm) {
                struct vm_area_struct *vma;
                down(&mm->mmap_sem);
@@ -330,13 +344,16 @@ int proc_pid_stat(struct task_struct *task, char * buffer)
        nice = task->priority;
        nice = 20 - (nice * 20 + DEF_PRIORITY / 2) / DEF_PRIORITY;
 
+       read_lock(&tasklist_lock);
+       ppid = task->p_opptr->pid;
+       read_unlock(&tasklist_lock);
        res = sprintf(buffer,"%d (%s) %c %d %d %d %d %d %lu %lu \
 %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %lu %lu %ld %lu %lu %lu %lu %lu \
 %lu %lu %lu %lu %lu %lu %lu %lu %d %d\n",
                task->pid,
                task->comm,
                state,
-               task->p_opptr->pid,
+               ppid,
                task->pgrp,
                task->session,
                task->tty ? kdev_t_to_nr(task->tty->device) : 0,
@@ -376,6 +393,8 @@ int proc_pid_stat(struct task_struct *task, char * buffer)
                task->cnswap,
                task->exit_signal,
                task->processor);
+       if(mm)
+               mmput(mm);
        return res;
 }
                
@@ -455,9 +474,14 @@ static void statm_pgd_range(pgd_t * pgd, unsigned long address, unsigned long en
 
 int proc_pid_statm(struct task_struct *task, char * buffer)
 {
-       struct mm_struct *mm = task->mm;
+       struct mm_struct *mm;
        int size=0, resident=0, share=0, trs=0, lrs=0, drs=0, dt=0;
 
+       task_lock(task);
+       mm = task->mm;
+       if(mm)
+               atomic_inc(&mm->mm_users);
+       task_unlock(task);
        if (mm) {
                struct vm_area_struct * vma;
                down(&mm->mmap_sem);
@@ -482,6 +506,7 @@ int proc_pid_statm(struct task_struct *task, char * buffer)
                        vma = vma->vm_next;
                }
                up(&mm->mmap_sem);
+               mmput(mm);
        }
        return sprintf(buffer,"%d %d %d %d %d %d %d\n",
                       size, resident, share, trs, lrs, drs, dt);
@@ -523,7 +548,7 @@ int proc_pid_statm(struct task_struct *task, char * buffer)
 ssize_t proc_pid_read_maps (struct task_struct *task, struct file * file, char * buf,
                          size_t count, loff_t *ppos)
 {
-       struct mm_struct *mm = task->mm;
+       struct mm_struct *mm;
        struct vm_area_struct * map, * next;
        char * destptr = buf, * buffer;
        loff_t lineno;
@@ -539,7 +564,14 @@ ssize_t proc_pid_read_maps (struct task_struct *task, struct file * file, char *
        if (!buffer)
                goto out;
 
-       if (!mm || count == 0)
+       if (count == 0)
+               goto getlen_out;
+       task_lock(task);
+       mm = task->mm;
+       if (mm)
+               atomic_inc(&mm->mm_users);
+       task_unlock(task);
+       if (!mm)
                goto getlen_out;
 
        /* Check whether the mmaps could change if we sleep */
@@ -637,6 +669,7 @@ ssize_t proc_pid_read_maps (struct task_struct *task, struct file * file, char *
 
        /* encode f_pos */
        *ppos = (lineno << MAPS_LINE_SHIFT) + column;
+       mmput(mm);
 
 getlen_out:
        retval = destptr - buf;
index 39111ef9738a8c40874ec9a04d6efea5bf8ecd72..1ac20eb440171a693655342027930c93d4ad499f 100644 (file)
@@ -65,9 +65,11 @@ static int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfs
        int result = -ENOENT;
        struct task_struct *task = inode->u.proc_i.task;
 
-       if (!task_lock(task))
-               return result;
+       task_lock(task);
        mm = task->mm;
+       if (mm)
+               atomic_inc(&mm->mm_users);
+       task_unlock(task);
        if (!mm)
                goto out;
        down(&mm->mmap_sem);
@@ -83,67 +85,80 @@ static int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfs
                vma = vma->vm_next;
        }
        up(&mm->mmap_sem);
+       mmput(mm);
 out:
-       task_unlock(task);
        return result;
 }
 
 static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
 {
+       struct fs_struct *fs;
        int result = -ENOENT;
-       if (task_lock(inode->u.proc_i.task)) {
-               struct fs_struct *fs = inode->u.proc_i.task->fs;
-               if (fs) {
-                       *mnt = mntget(fs->pwdmnt);
-                       *dentry = dget(fs->pwd);
-                       result = 0;
-               }
-               task_unlock(inode->u.proc_i.task);
+       task_lock(inode->u.proc_i.task);
+       fs = inode->u.proc_i.task->fs;
+       if(fs)
+               atomic_inc(&fs->count);
+       task_unlock(inode->u.proc_i.task);
+       if (fs) {
+               *mnt = mntget(fs->pwdmnt);
+               *dentry = dget(fs->pwd);
+               result = 0;
+               put_fs_struct(fs);
        }
        return result;
 }
 
 static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
 {
+       struct fs_struct *fs;
        int result = -ENOENT;
-       if (task_lock(inode->u.proc_i.task)) {
-               struct fs_struct *fs = inode->u.proc_i.task->fs;
-               if (fs) {
-                       *mnt = mntget(fs->rootmnt);
-                       *dentry = dget(fs->root);
-                       result = 0;
-               }
-               task_unlock(inode->u.proc_i.task);
+       task_lock(inode->u.proc_i.task);
+       fs = inode->u.proc_i.task->fs;
+       if(fs)
+               atomic_inc(&fs->count);
+       task_unlock(inode->u.proc_i.task);
+       if (fs) {
+               *mnt = mntget(fs->rootmnt);
+               *dentry = dget(fs->root);
+               result = 0;
        }
        return result;
 }
 
-/* task is locked and can't drop mm, so we are safe */
-
 static int proc_pid_environ(struct task_struct *task, char * buffer)
 {
-       struct mm_struct *mm = task->mm;
+       struct mm_struct *mm;
        int res = 0;
+       task_lock(task);
+       mm = task->mm;
+       if (mm)
+               atomic_inc(&mm->mm_users);
+       task_unlock(task);
        if (mm) {
                int len = mm->env_end - mm->env_start;
                if (len > PAGE_SIZE)
                        len = PAGE_SIZE;
                res = access_process_vm(task, mm->env_start, buffer, len, 0);
+               mmput(mm);
        }
        return res;
 }
 
-/* task is locked and can't drop mm, so we are safe */
-
 static int proc_pid_cmdline(struct task_struct *task, char * buffer)
 {
-       struct mm_struct *mm = task->mm;
+       struct mm_struct *mm;
        int res = 0;
+       task_lock(task);
+       mm = task->mm;
+       if (mm)
+               atomic_inc(&mm->mm_users);
+       task_unlock(task);
        if (mm) {
                int len = mm->arg_end - mm->arg_start;
                if (len > PAGE_SIZE)
                        len = PAGE_SIZE;
                res = access_process_vm(task, mm->arg_start, buffer, len, 0);
+               mmput(mm);
        }
        return res;
 }
@@ -219,10 +234,7 @@ static ssize_t pid_maps_read(struct file * file, char * buf,
        struct task_struct *task = inode->u.proc_i.task;
        ssize_t res;
 
-       if (!task_lock(task))
-               return -EIO;
        res = proc_pid_read_maps(task, file, buf, count, ppos);
-       task_unlock(task);
        return res;
 }
 
@@ -246,15 +258,20 @@ static ssize_t proc_info_read(struct file * file, char * buf,
        if (!(page = __get_free_page(GFP_KERNEL)))
                return -ENOMEM;
 
-       if (!task_lock(task)) {
+       /* FIXME: check that all proc_read function
+        *      handle a dying task gracefully.
+        *      The memory for the task structure
+        *      won't be freed, we've called get_task_struct().
+        */
+#if 0
+       if (!task->p_pptr) {
                free_page(page);
                return -EIO;
        }
+#endif
        
        length = inode->u.proc_i.op.proc_read(task, (char*)page);
 
-       task_unlock(task);
-
        if (length < 0) {
                free_page(page);
                return length;
index 67920a25278b5390127a2a8d68076c34d325ff93..d83672615ded44af31c5ce9c8dd7ee98a706a018 100644 (file)
@@ -56,7 +56,7 @@ smb_readpage_sync(struct dentry *dentry, struct page *page)
 
        /* We can't replace this with ClearPageError. why? is it a problem? 
           fs/buffer.c:brw_page does the same. */
-       /* clear_bit(PG_error, &page->flags); */
+       /* ClearPageError(page); */
 
 #ifdef SMBFS_DEBUG_VERBOSE
 printk("smb_readpage_sync: file %s/%s, count=%d@%ld, rsize=%d\n",
index 939ca9f368886e4a6d015bef2a47a8105aa8e9f7..f970f3252f1511a066596b9c5357298cac4dc97b 100644 (file)
@@ -980,11 +980,15 @@ static int do_umount(struct vfsmount *mnt, int umount_root, int flags)
        count = d_active_refs(sb->s_root);
        if (mnt->mnt_parent == mnt)
                count--;
-       if (count != 2)
+       if (count != 2) {
+               mntput(mnt);
                return -EBUSY;
+       }
 
-       if (sb->s_root->d_inode->i_state)
+       if (sb->s_root->d_inode->i_state) {
+               mntput(mnt);
                return -EBUSY;
+       }
 
        /* OK, that's the point of no return */
        mntput(mnt);
index 1429e7772e10fe0cfdb23d8a5dc69506c8dbe330..a32b80e46fd1d8a9293467d3a81054c562e3cfc3 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: system.h,v 1.57 2000/03/27 10:38:57 davem Exp $ */
+/* $Id: system.h,v 1.58 2000/05/05 18:47:41 davem Exp $ */
 #ifndef __SPARC64_SYSTEM_H
 #define __SPARC64_SYSTEM_H
 
@@ -257,6 +257,61 @@ static __inline__ unsigned long __xchg(unsigned long x, __volatile__ void * ptr,
 
 extern void die_if_kernel(char *str, struct pt_regs *regs) __attribute__ ((noreturn));
 
+/* 
+ * Atomic compare and exchange.  Compare OLD with MEM, if identical,
+ * store NEW in MEM.  Return the initial value in MEM.  Success is
+ * indicated by comparing RETURN with OLD.
+ */
+
+#define __HAVE_ARCH_CMPXCHG 1
+
+extern __inline__ unsigned long
+__cmpxchg_u32(volatile int *m, int old, int new)
+{
+       __asm__ __volatile__("cas [%2], %3, %0"
+                            : "=&r" (new)
+                            : "0" (new), "r" (m), "r" (old)
+                            : "memory");
+
+       return new;
+}
+
+extern __inline__ unsigned long
+__cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
+{
+       __asm__ __volatile__("casx [%2], %3, %0"
+                            : "=&r" (new)
+                            : "0" (new), "r" (m), "r" (old)
+                            : "memory");
+
+       return new;
+}
+
+/* This function doesn't exist, so you'll get a linker error
+   if something tries to do an invalid cmpxchg().  */
+extern void __cmpxchg_called_with_bad_pointer(void);
+
+static __inline__ unsigned long
+__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
+{
+       switch (size) {
+               case 4:
+                       return __cmpxchg_u32(ptr, old, new);
+               case 8:
+                       return __cmpxchg_u64(ptr, old, new);
+       }
+       __cmpxchg_called_with_bad_pointer();
+       return old;
+}
+
+#define cmpxchg(ptr,o,n)                                                \
+  ({                                                                    \
+     __typeof__(*(ptr)) _o_ = (o);                                      \
+     __typeof__(*(ptr)) _n_ = (n);                                      \
+     (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,          \
+                                   (unsigned long)_n_, sizeof(*(ptr))); \
+  })
+
 #endif /* !(__ASSEMBLY__) */
 
 #endif /* !(__SPARC64_SYSTEM_H) */
index 062a6ca6fdfc1b40ad3329f60a4db89187638ddb..354561d2c389011cf317e4c3dff5e911edc265b3 100644 (file)
@@ -59,9 +59,9 @@ static inline struct file * fget(unsigned int fd)
  * 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>: 
  * 
  * Since those functions where calling other functions, it was completely 
- * bogos to make them all "static inline".
+ * bogus to make them all "extern inline".
  *
- * The removal of this pseudo optimization saved me scandaleous:
+ * The removal of this pseudo optimization saved me scandalous:
  *
  *             3756 (i386 arch) 
  *
index 0b0e06a22216f0c280b2ee5df85feeb4677ae399..e98fc201abec7f0381404eb68c717704e330b470 100644 (file)
@@ -251,7 +251,7 @@ void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
 
 extern void set_bh_page(struct buffer_head *bh, struct page *page, unsigned long offset);
 
-#define touch_buffer(bh)       set_bit(PG_referenced, &bh->b_page->flags)
+#define touch_buffer(bh)       SetPageReferenced(bh->b_page)
 
 
 #include <linux/pipe_fs_i.h>
index a7a11d69e7fce045e9bf272c0263009da9e2d4ab..55028408c7d2b5c2f61f3b90cd4c392cb3b37762 100644 (file)
@@ -196,7 +196,11 @@ typedef struct page {
 #define SetPageError(page)     set_bit(PG_error, &(page)->flags)
 #define ClearPageError(page)   clear_bit(PG_error, &(page)->flags)
 #define PageReferenced(page)   test_bit(PG_referenced, &(page)->flags)
+#define SetPageReferenced(page)        set_bit(PG_referenced, &(page)->flags)
+#define PageTestandClearReferenced(page)       test_and_clear_bit(PG_referenced, &(page)->flags)
 #define PageDecrAfter(page)    test_bit(PG_decr_after, &(page)->flags)
+#define SetPageDecrAfter(page) set_bit(PG_decr_after, &(page)->flags)
+#define PageTestandClearDecrAfter(page)        test_and_clear_bit(PG_decr_after, &(page)->flags)
 #define PageSlab(page)         test_bit(PG_slab, &(page)->flags)
 #define PageSwapCache(page)    test_bit(PG_swap_cache, &(page)->flags)
 #define PageReserved(page)     test_bit(PG_reserved, &(page)->flags)
index 07d7f0d4bac072496781f1ca25fdcac1ef283709..efa940891a1ec31c330193f46b343fa96ea9a97a 100644 (file)
@@ -346,8 +346,8 @@ struct task_struct {
 /* Thread group tracking */
        u32 parent_exec_id;
        u32 self_exec_id;
-/* Protection of fields allocatio/deallocation */
-       struct semaphore exit_sem;
+/* Protection of (de-)allocation: mm, files, fs */
+       spinlock_t alloc_lock;
 };
 
 /*
@@ -418,7 +418,7 @@ struct task_struct {
     blocked:           {{0}},                                          \
     sigqueue:          NULL,                                           \
     sigqueue_tail:     &tsk.sigqueue,                                  \
-    exit_sem:          __MUTEX_INITIALIZER(tsk.exit_sem)               \
+    alloc_lock:                SPIN_LOCK_UNLOCKED                              \
 }
 
 
@@ -835,19 +835,14 @@ static inline void unhash_process(struct task_struct *p)
        write_unlock_irq(&tasklist_lock);
 }
 
-static inline int task_lock(struct task_struct *p)
+static inline void task_lock(struct task_struct *p)
 {
-       down(&p->exit_sem);
-       if (p->p_pptr)
-               return 1;
-       /* He's dead, Jim. You take his wallet, I'll take the tricorder... */
-       up(&p->exit_sem);
-       return 0;
+       spin_lock(&p->alloc_lock);
 }
 
 static inline void task_unlock(struct task_struct *p)
 {
-       up(&p->exit_sem);
+       spin_unlock(&p->alloc_lock);
 }
 
 #endif /* __KERNEL__ */
index febda79097c2f86e04cb2fd3bf1184145bb8ae5e..424b2ed555189b90c2608e40b6636636eeb967be 100644 (file)
@@ -680,7 +680,7 @@ int do_fork(unsigned long clone_flags, unsigned long usp, struct pt_regs *regs)
        p->p_cptr = NULL;
        init_waitqueue_head(&p->wait_chldexit);
        p->vfork_sem = NULL;
-       sema_init(&p->exit_sem, 1);
+       spin_lock_init(&p->alloc_lock);
 
        p->sigpending = 0;
        sigemptyset(&p->signal);
index dd67f9748c95f5a12eb0a8bd929a25fdf35d87cc..2191f1911e34afdcb37a7cffc9afb9d67bfe9139 100644 (file)
@@ -85,6 +85,7 @@ EXPORT_SYMBOL(exec_usermodehelper);
 
 #ifdef CONFIG_MODULES
 EXPORT_SYMBOL(get_module_symbol);
+EXPORT_SYMBOL(try_inc_mod_count);
 #endif
 EXPORT_SYMBOL(get_option);
 EXPORT_SYMBOL(get_options);
index 162c7083b8780137808327f691e910d7286b5b44..e009bca35e45f26fc431c58e7fdfb06007ce471c 100644 (file)
@@ -121,10 +121,13 @@ int access_process_vm(struct task_struct *tsk, unsigned long addr, void *buf, in
        struct vm_area_struct * vma;
 
        /* Worry about races with exit() */
-       lock_kernel();
+       task_lock(tsk);
        mm = tsk->mm;
-       atomic_inc(&mm->mm_users);
-       unlock_kernel();
+       if (mm)
+               atomic_inc(&mm->mm_users);
+       task_unlock(tsk);
+       if (!mm)
+               return 0;
 
        down(&mm->mmap_sem);
        vma = find_extend_vma(mm, addr);
index eb3119dd3ef92fb4ecb870a528b0d6b7647d97e1..7c5bede66f6bd8c1dc6a999b0c828a3cc3bb1976 100644 (file)
@@ -246,7 +246,7 @@ int shrink_mmap(int priority, int gfp_mask, zone_t *zone)
        if (!zone)
                BUG();
 
-       count = (nr_lru_pages << 1) >> priority;
+       count = nr_lru_pages >> priority;
        if (!count)
                return ret;
 
@@ -266,19 +266,23 @@ again:
                 * &young to make sure that we won't try to free it the next
                 * time */
                dispose = &young;
-               if (test_and_clear_bit(PG_referenced, &page->flags))
+               if (PageTestandClearReferenced(page))
                        goto dispose_continue;
 
-               if (p_zone->free_pages > p_zone->pages_high)
+               if (!page->buffers && page_count(page) > 1)
                        goto dispose_continue;
 
-               if (!page->buffers && page_count(page) > 1)
+               /*
+                * Ok, it wasn't young, so leave it at the end of
+                * the list ("old").
+                */
+               dispose = &old;
+               if (p_zone->free_pages > p_zone->pages_high)
                        goto dispose_continue;
 
                count--;
                /* Page not used -> free it or put it on the old list
                 * so it gets freed first the next time */
-               dispose = &old;
                if (TryLockPage(page))
                        goto dispose_continue;
 
@@ -394,7 +398,7 @@ inside:
                if (page->index == offset)
                        break;
        }
-       set_bit(PG_referenced, &page->flags);
+       SetPageReferenced(page);
 not_found:
        return page;
 }
index 76c47d212a2fe7a771ed97c86e98fa56ee08ff8f..b2b6359d0a54d6e0b1013a43579cc3305c431ebe 100644 (file)
@@ -74,7 +74,7 @@ static int rw_swap_page_base(int rw, swp_entry_t entry, struct page *page, int w
                return 0;
        }
        if (!wait) {
-               set_bit(PG_decr_after, &page->flags);
+               SetPageDecrAfter(page);
                atomic_inc(&nr_async_pages);
        }
 
index 0d0948457ecfb9647eba481fe85d6ff0cce23216..30f706e9430b9f4288d59c09a7e2b2718168fab8 100644 (file)
@@ -56,14 +56,10 @@ static int try_to_swap_out(struct mm_struct * mm, struct vm_area_struct* vma, un
                 * tables to the global page map.
                 */
                set_pte(page_table, pte_mkold(pte));
-               set_bit(PG_referenced, &page->flags);
+                SetPageReferenced(page);
                goto out_failed;
        }
 
-       /* Don't look at this page if it's in a zone that we're not interested in.. */
-       if (!page->zone->zone_wake_kswapd)
-               goto out_failed;
-
        if (TryLockPage(page))
                goto out_failed;
 
@@ -114,6 +110,13 @@ drop_pte:
        if (!(gfp_mask & __GFP_IO))
                goto out_unlock;
 
+       /*
+        * Don't do any of the expensive stuff if
+        * we're not really interested in this zone.
+        */
+       if (!page->zone->zone_wake_kswapd)
+               goto out_unlock;
+
        /*
         * Ok, it's really dirty. That means that
         * we should either create a new swap cache
index c4d946cb3c2c1d0689f34ae94463bdfc35ce777b..b1e75b87f223b41beaae4bc174d31dab6102782b 100644 (file)
@@ -1005,6 +1005,7 @@ rpciod(void *ptr)
        rpciod_pid = current->pid;
        up(&rpciod_running);
 
+       exit_fs(current);
        exit_files(current);
        exit_mm(current);