]> git.neil.brown.name Git - history.git/commitdiff
Import 2.4.0-test4pre6 2.4.0-test4pre6
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:36:45 +0000 (15:36 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:36:45 +0000 (15:36 -0500)
132 files changed:
Documentation/filesystems/Locking
Documentation/usb/usb-help.txt
MAINTAINERS
arch/i386/kernel/apm.c
arch/i386/kernel/microcode.c
arch/i386/kernel/mtrr.c
arch/m68k/atari/joystick.c
arch/m68k/bvme6000/rtc.c
arch/m68k/mvme16x/rtc.c
arch/mips64/sgi-ip27/ip27-rtc.c
arch/sparc64/solaris/socksys.c
drivers/block/acsi_slm.c
drivers/block/ll_rw_blk.c
drivers/block/lvm.c
drivers/block/paride/pg.c
drivers/block/paride/pt.c
drivers/block/rd.c
drivers/char/acquirewdt.c
drivers/char/agp/agpgart_fe.c
drivers/char/applicom.c
drivers/char/busmouse.c
drivers/char/drm/ffb_drv.c
drivers/char/drm/gamma_drv.c
drivers/char/drm/tdfx_drv.c
drivers/char/drm/vm.c
drivers/char/dsp56k.c
drivers/char/dtlk.c
drivers/char/ftape/zftape/zftape-init.c
drivers/char/h8.c
drivers/char/i810_rng.c
drivers/char/lp.c
drivers/char/mixcomwd.c
drivers/char/msp3400.c
drivers/char/nvram.c
drivers/char/pc110pad.c
drivers/char/pc_keyb.c
drivers/char/pcwd.c
drivers/char/ppdev.c
drivers/char/qpmouse.c
drivers/char/raw.c
drivers/char/rtc.c
drivers/char/sbc60xxwdt.c
drivers/char/softdog.c
drivers/char/tpqic02.c
drivers/char/tty_io.c
drivers/char/tvmixer.c
drivers/char/videodev.c
drivers/char/wdt.c
drivers/char/wdt285.c
drivers/char/wdt977.c
drivers/char/wdt_pci.c
drivers/i2c/i2c-dev.c
drivers/i2o/i2o_config.c
drivers/ide/ide-tape.c
drivers/ieee1394/raw1394.c
drivers/ieee1394/video1394.c
drivers/isdn/avmb1/capi.c
drivers/isdn/divert/divert_procfs.c
drivers/isdn/hysdn/hysdn_procconf.c
drivers/isdn/hysdn/hysdn_procfs.c
drivers/isdn/hysdn/hysdn_proclog.c
drivers/isdn/isdn_common.c
drivers/macintosh/adb.c
drivers/macintosh/via-pmu.c
drivers/mtd/mtdchar.c
drivers/net/ppp_generic.c
drivers/net/wan/cosa.c
drivers/pcmcia/ds.c
drivers/pnp/isapnp_proc.c
drivers/sbus/audio/audio.c
drivers/sbus/char/bpp.c
drivers/sbus/char/flash.c
drivers/sbus/char/jsflash.c
drivers/sbus/char/pcikbd.c
drivers/sbus/char/rtc.c
drivers/sbus/char/sunkbd.c
drivers/sbus/char/sunmouse.c
drivers/sbus/char/vfc_dev.c
drivers/scsi/sg.c
drivers/scsi/st.c
drivers/sgi/char/ds1286.c
drivers/sgi/char/graphics.c
drivers/sgi/char/shmiq.c
drivers/sgi/char/streamable.c
drivers/sgi/char/usema.c
drivers/sound/cmpci.c
drivers/sound/dmasound/dmasound_core.c
drivers/sound/emu10k1/audio.c
drivers/sound/emu10k1/midi.c
drivers/sound/es1370.c
drivers/sound/es1371.c
drivers/sound/esssolo1.c
drivers/sound/i810_audio.c
drivers/sound/maestro.c
drivers/sound/msnd.h
drivers/sound/msnd_pinnacle.c
drivers/sound/sonicvibes.c
drivers/sound/soundcard.c
drivers/sound/trident.c
drivers/sound/via82cxxx_audio.c
drivers/sound/vwsnd.c
drivers/sound/wavfront.c
drivers/telephony/ixj.c
drivers/usb/Config.in
drivers/usb/audio.c
drivers/usb/dabusb.c
drivers/usb/dc2xx.c
drivers/usb/evdev.c
drivers/usb/joydev.c
drivers/usb/mdc800.c
drivers/usb/mousedev.c
drivers/usb/printer.c
drivers/video/fbmem.c
fs/block_dev.c
fs/coda/dir.c
fs/coda/pioctl.c
fs/coda/psdev.c
fs/devfs/base.c
fs/ext2/file.c
fs/file_table.c
fs/hpfs/dir.c
fs/hpfs/file.c
fs/nfs/inode.c
fs/nfsd/vfs.c
fs/openpromfs/inode.c
fs/pipe.c
fs/smbfs/file.c
fs/udf/file.c
include/linux/blkdev.h
net/irda/irmod.c
net/netlink/netlink_dev.c
net/socket.c

index 0dd2cc8eb85ec83d711c161906eba2310e8f6038..421b1731809d71989ac3a22baaa3b2e68b2e4636 100644 (file)
@@ -66,6 +66,7 @@ getattr:                                              (see below)
 revalidate:    no                                      (see below)
        Additionally, ->rmdir() has i_zombie on victim and so does ->rename()
 in case when target exists and is a directory.
+       ->rename() on directories has (per-superblock) ->s_vfs_rename_sem.
        ->revalidate(), it may be called both with and without the i_sem
 on dentry->d_inode. VFS never calls it with i_zombie on dentry->d_inode,
 but watch for other methods directly calling this one...
@@ -226,7 +227,7 @@ ioctl:              yes     (see below)
 mmap:          no
 open:          maybe   (see below)
 flush:         yes
-release:       yes
+release:       no
 fsync:         yes     (see below)
 fasync:                yes     (see below)
 lock:          yes
@@ -238,12 +239,13 @@ The only exception is ->open() in the instances of file_operations that never
 end up in ->i_fop/->proc_fops, i.e. ones that belong to character devices
 (chrdev_open() takes lock before replacing ->f_op and calling the secondary
 method. As soon as we fix the handling of module reference counters all
-instances of ->open() will be called without the BKL. At the same point
-->release() will lose BKL. Currently ext2_release() is *the* source of
-contention on fs-intensive loads and dropping BKL on ->release() will get
-rid of that (we will still need some locking for cases when we close a file
-that had been opened r/w, but that can be done using the internal locking with
-smaller critical areas). sock_close() is also going to win from that change.
+instances of ->open() will be called without the BKL.
+
+Note: ext2_release() was *the* source of contention on fs-intensive
+loads and dropping BKL on ->release() helps to get rid of that (we still
+grab BKL for cases when we close a file that had been opened r/w, but that
+can and should be done using the internal locking with smaller critical areas).
+Current worst offender is ext2_get_block()...
 
 ->fasync() is a mess. This area needs a big cleanup and that will probably
 affect locking.
index 9abd4a08b063bf5086ba123570384533067867e4..5ad2aaa57b85bc095d11cc64da42d5a74e7644bc 100644 (file)
@@ -1,5 +1,5 @@
 usb-help.txt
-2000-March-24
+2000-July-12
 
 For USB help other than the readme files that are located in
 linux/Documentation/usb/*, see the following:
@@ -7,10 +7,12 @@ linux/Documentation/usb/*, see the following:
 Linux-USB project:  http://www.linux-usb.org
   mirrors at        http://www.suse.cz/development/linux-usb/
          and        http://usb.in.tum.de/linux-usb/
-Linux USB Guide:    http://linuxusbguide.sourceforge.net
+Linux USB Guide:    http://linux-usb.sourceforge.net
 Linux-USB device overview (working devices and drivers):
                     http://www.qbik.ch/usb/devices/
     
-The Linux-USB mailing list is linux-usb@suse.com .
+The Linux-USB mailing lists are:
+  linux-usb-users@lists.sourceforge.net   for general user help
+  linux-usb-devel@lists.sourceforge.net   for developer discussions
 
 ###
index 3cec9bac7f3ae2384cc4f93d79a87fd1327be96d..e0cf3259345f5e0f0b9807300abb93609687327d 100644 (file)
@@ -1156,79 +1156,91 @@ S:      Supported
 USB ACM DRIVER
 P:     Vojtech Pavlik
 M:     vojtech@suse.cz
-L:     linux-usb@suse.com
+L:     linux-usb-users@lists.sourceforge.net
+L:     linux-usb-devel@lists.sourceforge.net
 S:     Supported
 
 USB BLUETOOTH DRIVER
 P:     Greg Kroah-Hartman
 M:     greg@kroah.com
-L:     linux-usb@suse.com
+L:     linux-usb-users@lists.sourceforge.net
+L:     linux-usb-devel@lists.sourceforge.net
 S:     Maintained
 W:     http://www.kroah.com/linux-usb/
 
 USB HID/HIDBP/INPUT DRIVERS
 P:     Vojtech Pavlik
 M:     vojtech@suse.cz
-L:     linux-usb@suse.com
+L:     linux-usb-users@lists.sourceforge.net
+L:     linux-usb-devel@lists.sourceforge.net
 W:     http://www.suse.cz/development/input/
 S:     Supported
 
 USB HUB
 P:     Johannes Erdfelt
 M:     jerdfelt@sventech.com
-L:     linux-usb@suse.com
+L:     linux-usb-users@lists.sourceforge.net
+L:     linux-usb-devel@lists.sourceforge.net
 S:     Maintained
 
 USB OHCI DRIVER
 P:     Roman Weissgaerber
 M:     weissg@vienna.at
-L:     linux-usb@suse.com
+L:     linux-usb-users@lists.sourceforge.net
+L:     linux-usb-devel@lists.sourceforge.net
 S:     Maintained
 
 USB OV511 DRIVER
 P:     Mark McClelland
 M:     mmcclelland@delphi.com
-L:     linux-usb@suse.com
+L:     linux-usb-users@lists.sourceforge.net
+L:     linux-usb-devel@lists.sourceforge.net
 W:     http://alpha.dyndns.org/ov511/
 S:     Maintained
 
 USB PEGASUS DRIVER
 P:     Petko Manolov
 M:     petkan@spct.net
-L:     linux-usb@suse.com
+L:     linux-usb-users@lists.sourceforge.net
+L:     linux-usb-devel@lists.sourceforge.net
 S:     Maintained
 
 USB PRINTER DRIVER
 P:     Vojtech Pavlik
 M:     vojtech@suse.cz
-L:     linux-usb@suse.com
+L:     linux-usb-users@lists.sourceforge.net
+L:     linux-usb-devel@lists.sourceforge.net
 S:     Supported
 
 USB SERIAL DIGI ACCELEPORT DRIVER
 P:     Peter Berger and Al Borchers
 M:     pberger@brimson.com
 M:     alborchers@steinerpoint.com
-L:     linux-usb@suse.com
+L:     linux-usb-users@lists.sourceforge.net
+L:     linux-usb-devel@lists.sourceforge.net
 S:     Supported
 
 USB SERIAL DRIVER
 P:     Greg Kroah-Hartman
 M:     greg@kroah.com
-L:     linux-usb@suse.com
+L:     linux-usb-users@lists.sourceforge.net
+L:     linux-usb-devel@lists.sourceforge.net
 S:     Maintained
 W:     http://www.kroah.com/linux-usb/
 
 USB MASS STORAGE DRIVER
 P:     Matthew Dharm
 M:     mdharm-usb@one-eyed-alien.net
-L:     linux-usb@suse.com
+L:     linux-usb-users@lists.sourceforge.net
+L:     linux-usb-devel@lists.sourceforge.net
 S:     Maintained
 W:     http://www.one-eyed-alien.net/~mdharm/linux-usb/
 
 USB UHCI DRIVER
 P:     Georg Acher
 M:     usb@in.tum.de
-L:     linux-usb@suse.com 
+L:     linux-usb-users@lists.sourceforge.net
+L:     linux-usb-devel@lists.sourceforge.net
 W:     http://usb.in.tum.de
 S:     Maintained
        
index a915181a9df68f75d4649a1035db128d50efd2b3..bd7c62bdfd8581377891145a767357a1b9020ffa 100644 (file)
 #include <linux/sched.h>
 #include <linux/pm.h>
 #include <linux/kernel.h>
+#include <linux/smp_lock.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -1268,6 +1269,7 @@ static int do_release(struct inode * inode, struct file * filp)
        if (check_apm_user(as, "release"))
                return 0;
        filp->private_data = NULL;
+       lock_kernel();
        if (as->standbys_pending > 0) {
                standbys_pending -= as->standbys_pending;
                if (standbys_pending <= 0)
@@ -1292,6 +1294,7 @@ static int do_release(struct inode * inode, struct file * filp)
                else
                        as1->next = as->next;
        }
+       unlock_kernel();
        kfree_s(as, sizeof(*as));
        return 0;
 }
index c693b2dc2c12c64cb750515af18e34253645e7ca..0519aee0caaa3ea0360bc5c1c2e9327a89c2c7f0 100644 (file)
@@ -147,7 +147,9 @@ static int microcode_open(struct inode *inode, struct file *file)
 
 static int microcode_release(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        clear_bit(MICROCODE_IS_OPEN, &microcode_status);
+       unlock_kernel();
        return 0;
 }
 
index c0a158694398a1dbeb16788f12f598fe88ebfd4f..05b57c93a0e6a47b5a3b00b3093f39920f50b898 100644 (file)
 #include <asm/mtrr.h>
 #include <linux/init.h>
 #include <linux/smp.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -1532,6 +1533,7 @@ static int mtrr_close (struct inode *ino, struct file *file)
     unsigned int *fcount = file->private_data;
 
     if (fcount == NULL) return 0;
+    lock_kernel();
     max = get_num_var_ranges ();
     for (i = 0; i < max; ++i)
     {
@@ -1541,6 +1543,7 @@ static int mtrr_close (struct inode *ino, struct file *file)
            --fcount[i];
        }
     }
+    unlock_kernel();
     kfree (fcount);
     file->private_data = NULL;
     return 0;
index 2d20eb6536022a9dd56deb248546f2db0f6141d7..df41b38d8b1317960112b055672a7cb00a4bc8c4 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/poll.h>
 #include <linux/init.h>
 #include <linux/devfs_fs_kernel.h>
+#include <linux/smp_lock.h>
 
 #include <asm/atarikb.h>
 #include <asm/atari_joystick.h>
@@ -60,11 +61,13 @@ static int release_joystick(struct inode *inode, struct file *file)
 {
     int minor = DEVICE_NR(inode->i_rdev);
 
+    lock_kernel();
     joystick[minor].active = 0;
     joystick[minor].ready = 0;
 
     if ((joystick[0].active == 0) && (joystick[1].active == 0))
        ikbd_joystick_disable();
+    unlock_kernel();
     return 0;
 }
 
index 4a244f851e794a1de236e5b264da81464cbd98f0..263cdaff7c153eacd1116c3d1d22505538f7fcf8 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <linux/mc146818rtc.h> /* For struct rtc_time and ioctls, etc */
+#include <linux/smp_lock.h>
 #include <asm/bvme6000hw.h>
 
 #include <asm/io.h>
@@ -149,7 +150,9 @@ static int rtc_open(struct inode *inode, struct file *file)
 
 static int rtc_release(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        rtc_status = 0;
+       unlock_kernel();
        return 0;
 }
 
index a47e4c634b42cf2370d7552b6d1fb6da51463ca5..6776216292e71050370c7122e1fd666973cfc7d8 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <linux/mc146818rtc.h> /* For struct rtc_time and ioctls, etc */
+#include <linux/smp_lock.h>
 #include <asm/mvme16xhw.h>
 
 #include <asm/io.h>
@@ -138,7 +139,9 @@ static int rtc_open(struct inode *inode, struct file *file)
 
 static int rtc_release(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        rtc_status = 0;
+       unlock_kernel();
        return 0;
 }
 
index 0e3987296e62e7958b423b9b33b53363e5888fad..61fd5421bc1ad174fbb36e670c4c59e0292fd2ee 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <linux/proc_fs.h>
+#include <linux/smp_lock.h>
 
 #include <asm/m48t35.h>
 #include <asm/ioc3.h>
@@ -179,7 +180,9 @@ static int rtc_release(struct inode *inode, struct file *file)
         * in use, and clear the data.
         */
 
+       lock_kernel();
        rtc_status &= ~RTC_IS_OPEN;
+       unlock_kernel();
        return 0;
 }
 
index 9a2556bbc0b206d67cb2c60e3248d38218406685..01595faee101addb464c2cb5c6f513085185a1ad 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/malloc.h>
 #include <linux/in.h>
 #include <linux/devfs_fs_kernel.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/termios.h>
@@ -118,6 +119,7 @@ static int socksys_release(struct inode * inode, struct file * filp)
         struct T_primsg *it;
 
        /* XXX: check this */
+       lock_kernel();
        sock = (struct sol_socket_struct *)filp->private_data;
        SOLDD(("sock release %016lx(%016lx)\n", sock, filp));
        it = sock->pfirst;
@@ -131,6 +133,7 @@ static int socksys_release(struct inode * inode, struct file * filp)
        filp->private_data = NULL;
        SOLDD(("socksys_release %016lx\n", sock));
        mykfree((char*)sock);
+       unlock_kernel();
        return 0;
 }
 
index 785a0e551a5d593b6cafd1a5fbe48d0caec0e5d6..11a0a947f1ff723c3304c9b5ff6cd99cc3c08599 100644 (file)
@@ -66,6 +66,7 @@ not be guaranteed. There are several ways to assure this:
 #include <linux/mm.h>
 #include <linux/malloc.h>
 #include <linux/devfs_fs_kernel.h>
+#include <linux/smp_lock.h>
 
 #include <asm/pgtable.h>
 #include <asm/system.h>
@@ -799,10 +800,12 @@ static int slm_release( struct inode *inode, struct file *file )
        device = MINOR(inode->i_rdev);
        sip = &slm_info[device];
 
+       lock_kernel();
        if (file->f_mode & 2)
                sip->wbusy = 0;
        if (file->f_mode & 1)
                sip->rbusy = 0;
+       unlock_kernel();
        
        return( 0 );
 }
index 47cf8c69efcac77f25f7787de34b68bd0fc48ac6..6e094e4d808dceb0254ebc5ae5b59ce5dfe501e2 100644 (file)
@@ -578,7 +578,6 @@ static inline void attempt_front_merge(request_queue_t * q,
 static inline void __make_request(request_queue_t * q, int rw,
                                  struct buffer_head * bh)
 {
-       int major = MAJOR(bh->b_rdev);
        unsigned int sector, count;
        int max_segments = MAX_SEGMENTS;
        struct request * req = NULL;
@@ -590,26 +589,6 @@ static inline void __make_request(request_queue_t * q, int rw,
        count = bh->b_size >> 9;
        sector = bh->b_rsector;
 
-       if (blk_size[major]) {
-               unsigned long maxsector = (blk_size[major][MINOR(bh->b_rdev)] << 1) + 1;
-
-               if (maxsector < count || maxsector - count < sector) {
-                       bh->b_state &= (1 << BH_Lock) | (1 << BH_Mapped);
-                       if (!blk_size[major][MINOR(bh->b_rdev)])
-                               goto end_io;
-                       /* This may well happen - the kernel calls bread()
-                          without checking the size of the device, e.g.,
-                          when mounting a device. */
-                       printk(KERN_INFO
-                               "attempt to access beyond end of device\n");
-                       printk(KERN_INFO "%s: rw=%d, want=%d, limit=%d\n",
-                               kdevname(bh->b_rdev), rw,
-                                       (sector + count)>>1,
-                                       blk_size[major][MINOR(bh->b_rdev)]);
-                       goto end_io;
-               }
-       }
-
        rw_ahead = 0;   /* normal case; gets changed below for READA */
        switch (rw) {
                case READA:
@@ -758,9 +737,35 @@ end_io:
        bh->b_end_io(bh, test_bit(BH_Uptodate, &bh->b_state));
 }
 
-int generic_make_request (request_queue_t *q, int rw, struct buffer_head * bh)
+void generic_make_request (request_queue_t *q, int rw, struct buffer_head * bh)
 {
-       int ret;
+       int major = MAJOR(bh->b_rdev);
+
+       if (blk_size[major]) {
+               unsigned long maxsector = (blk_size[major][MINOR(bh->b_rdev)] << 1) + 1;
+               unsigned int sector, count;
+
+               count = bh->b_size >> 9;
+               sector = bh->b_rsector;
+
+               if (maxsector < count || maxsector - count < sector) {
+                       bh->b_state &= (1 << BH_Lock) | (1 << BH_Mapped);
+                       if (blk_size[major][MINOR(bh->b_rdev)]) {
+                               
+                               /* This may well happen - the kernel calls bread()
+                                  without checking the size of the device, e.g.,
+                                  when mounting a device. */
+                               printk(KERN_INFO
+                                      "attempt to access beyond end of device\n");
+                               printk(KERN_INFO "%s: rw=%d, want=%d, limit=%d\n",
+                                      kdevname(bh->b_rdev), rw,
+                                      (sector + count)>>1,
+                                      blk_size[major][MINOR(bh->b_rdev)]);
+                       }
+                       bh->b_end_io(bh, 0);
+                       return;
+               }
+       }
 
        /*
         * Resolve the mapping until finished. (drivers are
@@ -768,12 +773,9 @@ int generic_make_request (request_queue_t *q, int rw, struct buffer_head * bh)
         * by explicitly returning 0)
         */
        while (q->make_request_fn) {
-               ret = q->make_request_fn(q, rw, bh);
-               if (ret > 0) {
-                       q = blk_get_queue(bh->b_rdev);
-                       continue;
-               }
-               return ret;
+               if (q->make_request_fn(q, rw, bh) == 0)
+                       return;
+               q = blk_get_queue(bh->b_rdev);
        }
        /*
         * Does the block device want us to queue
@@ -784,8 +786,6 @@ int generic_make_request (request_queue_t *q, int rw, struct buffer_head * bh)
        if (q && !q->plugged)
                (q->request_fn)(q);
        spin_unlock_irq(&io_request_lock);
-
-       return 0;
 }
 
 /* This function can be used to request a number of buffers from a block
index 1e2a21cf1bbc3ce11ebcfd57c06a9eccb41ef46e..d8cf20d79d299af039b545f12d1ce0caaae91555 100644 (file)
@@ -301,6 +301,7 @@ static spinlock_t lvm_lock = SPIN_LOCK_UNLOCKED;
 
 static struct file_operations lvm_chr_fops =
 {
+       owner:          THIS_MODULE,
        open:           lvm_chr_open,
        release:        lvm_chr_close,
        ioctl:          lvm_chr_ioctl,
@@ -517,8 +518,6 @@ static int lvm_chr_open(struct inode *inode,
        /* Group special file open */
        if (VG_CHR(minor) > MAX_VG) return -ENXIO;
 
-       MOD_INC_USE_COUNT;
-
        lvm_chr_open_count++;
        return 0;
 } /* lvm_chr_open() */
@@ -743,6 +742,7 @@ static int lvm_chr_close(struct inode *inode, struct file *file)
             "%s -- lvm_chr_close   VG#: %d\n", lvm_name, VG_CHR(minor));
 #endif
 
+       lock_kernel();
 #ifdef LVM_TOTAL_RESET
        if (lvm_reset_spindown > 0) {
                lvm_reset_spindown = 0;
@@ -755,10 +755,7 @@ static int lvm_chr_close(struct inode *inode, struct file *file)
                lock = 0;       /* release lock */
                wake_up_interruptible(&lvm_wait);
        }
-
-#ifdef MODULE
-       if (GET_USE_COUNT(&__this_module) > 0) MOD_DEC_USE_COUNT;
-#endif
+       unlock_kernel();
 
        return 0;
 } /* lvm_chr_close() */
index c282d82a10b7d6477150208b3360ce18682dd5c6..e2709ce9726bd2309983322bf2f1f3b27c5cdc9b 100644 (file)
@@ -171,6 +171,7 @@ static int pg_drive_count;
 #include <linux/mtio.h>
 #include <linux/pg.h>
 #include <linux/wait.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 
@@ -604,10 +605,12 @@ static int pg_release (struct inode *inode, struct file *file)
        if ((unit >= PG_UNITS) || (PG.access <= 0)) 
                return -EINVAL;
 
+       lock_kernel();
        PG.access--;
 
        kfree(PG.bufptr);
        PG.bufptr = NULL;
+       unlock_kernel();
 
        return 0;
 
index 0d3e818380da9d9293840929b710575529787be6..5cb91ae0a908de7a3273e7aad5bdc70a52a67f44 100644 (file)
@@ -149,6 +149,7 @@ static int pt_drive_count;
 #include <linux/malloc.h>
 #include <linux/mtio.h>
 #include <linux/wait.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 
@@ -773,6 +774,7 @@ static int pt_release (struct inode *inode, struct file *file)
         if ((unit >= PT_UNITS) || (PT.access <= 0)) 
                 return -EINVAL;
 
+       lock_kernel();
        if (PT.flags & PT_WRITING) pt_write_fm(unit);
 
        if (PT.flags & PT_REWIND) pt_rewind(unit);      
@@ -781,6 +783,7 @@ static int pt_release (struct inode *inode, struct file *file)
 
        kfree(PT.bufptr);
        PT.bufptr = NULL;
+       unlock_kernel();
 
        return 0;
 
index 727c1c54324a9cfa6d605a44ec1dcb2c1acf3139..2db08531ab695ad0ae036c78027a75af674971e3 100644 (file)
@@ -59,6 +59,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/devfs_fs_kernel.h>
+#include <linux/smp_lock.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -298,11 +299,14 @@ static int initrd_release(struct inode *inode,struct file *file)
 {
        extern void free_initrd_mem(unsigned long, unsigned long);
 
-       if (--initrd_users) return 0;
-       blkdev_put(inode->i_bdev, BDEV_FILE);
-       iput(inode);
-       free_initrd_mem(initrd_start, initrd_end);
-       initrd_start = 0;
+       lock_kernel();
+       if (!--initrd_users) {
+               blkdev_put(inode->i_bdev, BDEV_FILE);
+               iput(inode);
+               free_initrd_mem(initrd_start, initrd_end);
+               initrd_start = 0;
+       }
+       unlock_kernel();
        return 0;
 }
 
index eaa9e6bae6d6b779ebb1d8ef018a697848b312c1..b28df7e34f9339d84869d1e6624a56bc66b06975 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 
 static int acq_is_open=0;
 static spinlock_t acq_lock;
@@ -140,6 +141,7 @@ static int acq_open(struct inode *inode, struct file *file)
 
 static int acq_close(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        if(MINOR(inode->i_rdev)==WATCHDOG_MINOR)
        {
                spin_lock(&acq_lock);
@@ -149,6 +151,7 @@ static int acq_close(struct inode *inode, struct file *file)
                acq_is_open=0;
                spin_unlock(&acq_lock);
        }
+       unlock_kernel();
        return 0;
 }
 
index e67beef382a01fbf2228efd1eb880ce1ff9e8b15..d16c62a22d8ee10bd32e7e90e681cbc9f1439415 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/miscdevice.h>
 #include <linux/agp_backend.h>
 #include <linux/agpgart.h>
+#include <linux/smp_lock.h>
 #include <asm/system.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -605,14 +606,17 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
        agp_file_private *priv = (agp_file_private *) file->private_data;
        agp_kern_info kerninfo;
 
+       lock_kernel();
        AGP_LOCK();
 
        if (agp_fe.backend_acquired != TRUE) {
                AGP_UNLOCK();
+               unlock_kernel();
                return -EPERM;
        }
        if (!(test_bit(AGP_FF_IS_VALID, &priv->access_flags))) {
                AGP_UNLOCK();
+               unlock_kernel();
                return -EPERM;
        }
        agp_copy_info(&kerninfo);
@@ -624,42 +628,51 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
        if (test_bit(AGP_FF_IS_CLIENT, &priv->access_flags)) {
                if ((size + offset) > current_size) {
                        AGP_UNLOCK();
+                       unlock_kernel();
                        return -EINVAL;
                }
                client = agp_find_client_by_pid(current->pid);
 
                if (client == NULL) {
                        AGP_UNLOCK();
+                       unlock_kernel();
                        return -EPERM;
                }
                if (!agp_find_seg_in_client(client, offset,
                                            size, vma->vm_page_prot)) {
                        AGP_UNLOCK();
+                       unlock_kernel();
                        return -EINVAL;
                }
                if (remap_page_range(vma->vm_start,
                                     (kerninfo.aper_base + offset),
                                     size, vma->vm_page_prot)) {
                        AGP_UNLOCK();
+                       unlock_kernel();
                        return -EAGAIN;
                }
                AGP_UNLOCK();
+               unlock_kernel();
                return 0;
        }
        if (test_bit(AGP_FF_IS_CONTROLLER, &priv->access_flags)) {
                if (size != current_size) {
                        AGP_UNLOCK();
+                       unlock_kernel();
                        return -EINVAL;
                }
                if (remap_page_range(vma->vm_start, kerninfo.aper_base,
                                     size, vma->vm_page_prot)) {
                        AGP_UNLOCK();
+                       unlock_kernel();
                        return -EAGAIN;
                }
                AGP_UNLOCK();
+               unlock_kernel();
                return 0;
        }
        AGP_UNLOCK();
+       unlock_kernel();
        return -EPERM;
 }
 
@@ -667,6 +680,7 @@ static int agp_release(struct inode *inode, struct file *file)
 {
        agp_file_private *priv = (agp_file_private *) file->private_data;
 
+       lock_kernel();
        AGP_LOCK();
 
        if (test_bit(AGP_FF_IS_CONTROLLER, &priv->access_flags)) {
@@ -688,6 +702,7 @@ static int agp_release(struct inode *inode, struct file *file)
        agp_remove_file_private(priv);
        kfree(priv);
        AGP_UNLOCK();
+       unlock_kernel();
        return 0;
 }
 
index d5091ff4df4cea015ab0edb5cc0ae9f866f20d55..c109c5965320e34b46c221120ac9f0d08f367de0 100644 (file)
@@ -101,21 +101,18 @@ static unsigned int ReadErrorCount;       /* number of read error       */
 static unsigned int DeviceErrorCount;  /* number of device error     */
 
 static loff_t ac_llseek(struct file *, loff_t, int);
-static int ac_open(struct inode *, struct file *);
 static ssize_t ac_read (struct file *, char *, size_t, loff_t *);
 static ssize_t ac_write (struct file *, const char *, size_t, loff_t *);
 static int ac_ioctl(struct inode *, struct file *, unsigned int,
                    unsigned long);
-static int ac_release(struct inode *, struct file *);
 static void ac_interrupt(int, void *, struct pt_regs *);
 
 struct file_operations ac_fops = {
+       owner:THIS_MODULE,
        llseek:ac_llseek,
        read:ac_read,
        write:ac_write,
        ioctl:ac_ioctl,
-       open:ac_open,
-       release:ac_release,
 };
 
 struct miscdevice ac_miscdev = {
@@ -124,6 +121,8 @@ struct miscdevice ac_miscdev = {
        &ac_fops
 };
 
+static int dummy;      /* dev_id for request_irq() */
+
 int ac_register_board(unsigned long physloc, unsigned long loc, 
                      unsigned char boardno)
 {
@@ -180,7 +179,7 @@ void cleanup_module(void)
                iounmap((void *) apbs[i].RamIO);
 
                if (apbs[i].irq)
-                       free_irq(apbs[i].irq, &ac_open);
+                       free_irq(apbs[i].irq, &dummy);
        }
 }
 
@@ -226,7 +225,7 @@ int __init applicom_init(void)
                        continue;
                }
 
-               if (request_irq(dev->irq, &ac_interrupt, SA_SHIRQ, "Applicom PCI", &ac_open)) {
+               if (request_irq(dev->irq, &ac_interrupt, SA_SHIRQ, "Applicom PCI", &dummy)) {
                        printk(KERN_INFO "Could not allocate IRQ %d for PCI Applicom device.\n", dev->irq);
                        iounmap(RamIO);
                        apbs[boardno - 1].RamIO = 0;
@@ -277,7 +276,7 @@ int __init applicom_init(void)
                printk(KERN_NOTICE "Applicom ISA card found at mem 0x%lx, irq %d\n", mem + (LEN_RAM_IO*i), irq);
 
                if (!numisa) {
-                       if (request_irq(irq, &ac_interrupt, SA_SHIRQ, "Applicom ISA", &ac_open)) {
+                       if (request_irq(irq, &ac_interrupt, SA_SHIRQ, "Applicom ISA", &dummy)) {
                                printk(KERN_WARNING "Could not allocate IRQ %d for ISA Applicom device.\n", irq);
                                iounmap((void *) RamIO);
                                apbs[boardno - 1].RamIO = 0;
@@ -346,19 +345,6 @@ static loff_t ac_llseek(struct file *file, loff_t offset, int origin)
        return -ESPIPE;
 }
 
-static int ac_open(struct inode *inode, struct file *filp)
-{
-       MOD_INC_USE_COUNT;
-       return 0;
-}
-
-static int ac_release(struct inode *inode, struct file *file)
-{
-       MOD_DEC_USE_COUNT;
-       return 0;
-}
-
-
 static ssize_t ac_write(struct file *file, const char *buf, size_t count, loff_t * ppos)
 {
        unsigned int NumCard;   /* Board number 1 -> 8           */
index bc8345cff0e9b090bcc303fbe4404496a5c24647..9bfe4b2b3c528d4be188401ac9104dcd0b89e38e 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/miscdevice.h>
 #include <linux/random.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -167,6 +168,7 @@ static int busmouse_release(struct inode *inode, struct file *file)
        struct busmouse_data *mse = (struct busmouse_data *)file->private_data;
        int ret = 0;
 
+       lock_kernel();
        busmouse_fasync(-1, file, 0);
 
        if (--mse->active == 0) {
@@ -178,6 +180,7 @@ static int busmouse_release(struct inode *inode, struct file *file)
                }
                mse->ready = 0;
        }
+       unlock_kernel();
 
        return ret;
 }
index a1ab1f27953f3f0aad939348ee7f82c8bd42f147..5ad4885bf7b890e07ec6b9c652c93d70828f4330 100644 (file)
@@ -6,6 +6,8 @@
 
 #include "drmP.h"
 
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <asm/oplib.h>
 #include <asm/upa.h>
 
@@ -44,6 +46,7 @@ extern int ffb_rmctx(struct inode *, struct file *, unsigned int, unsigned long)
 extern int ffb_context_switch(drm_device_t *, int, int);
 
 static struct file_operations ffb_fops = {
+       owner:          THIS_MODULE,
        open:           ffb_open,
        flush:          drm_flush,
        release:        ffb_release,
@@ -501,7 +504,6 @@ static int ffb_open(struct inode *inode, struct file *filp)
        DRM_DEBUG("open_count = %d\n", dev->open_count);
        ret = drm_open_helper(inode, filp, dev);
        if (!ret) {
-               MOD_INC_USE_COUNT;
                atomic_inc(&dev->total_open);
                spin_lock(&dev->count_lock);
                if (!dev->open_count++) {
@@ -517,9 +519,11 @@ static int ffb_open(struct inode *inode, struct file *filp)
 static int ffb_release(struct inode *inode, struct file *filp)
 {
        drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->dev;
+       drm_device_t *dev;
        int ret = 0;
 
+       lock_kernel();
+       dev = priv->dev;
        DRM_DEBUG("open_count = %d\n", dev->open_count);
        if (dev->lock.hw_lock != NULL
            && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)
@@ -541,7 +545,6 @@ static int ffb_release(struct inode *inode, struct file *filp)
        ret = drm_release(inode, filp);
 
        if (!ret) {
-               MOD_DEC_USE_COUNT;
                atomic_inc(&dev->total_close);
                spin_lock(&dev->count_lock);
                if (!--dev->open_count) {
@@ -550,14 +553,18 @@ static int ffb_release(struct inode *inode, struct file *filp)
                                          atomic_read(&dev->ioctl_count),
                                          dev->blocked);
                                spin_unlock(&dev->count_lock);
+                               unlock_kernel();
                                return -EBUSY;
                        }
                        spin_unlock(&dev->count_lock);
-                       return ffb_takedown(dev);
+                       ret = ffb_takedown(dev);
+                       unlock_kernel();
+                       return ret;
                }
                spin_unlock(&dev->count_lock);
        }
 
+       unlock_kernel();
        return ret;
 }
 
@@ -756,6 +763,7 @@ static int ffb_mmap(struct file *filp, struct vm_area_struct *vma)
        DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
                  vma->vm_start, vma->vm_end, VM_OFFSET(vma));
 
+       lock_kernel();
        minor = MINOR(filp->f_dentry->d_inode->i_rdev);
        ffb_priv = NULL;
        for (i = 0; i < ffb_dev_table_size; i++) {
@@ -763,13 +771,15 @@ static int ffb_mmap(struct file *filp, struct vm_area_struct *vma)
                if (ffb_priv->miscdev.minor == minor)
                        break;
        }
-       if (i >= ffb_dev_table_size)
+       if (i >= ffb_dev_table_size) {
+               unlock_kernel();
                return -EINVAL;
-
+       }
        /* We don't support/need dma mappings, so... */
-       if (!VM_OFFSET(vma))
+       if (!VM_OFFSET(vma)) {
+               unlock_kernel();
                return -EINVAL;
-
+       }
        for (i = 0; i < dev->map_count; i++) {
                unsigned long off;
 
@@ -781,16 +791,19 @@ static int ffb_mmap(struct file *filp, struct vm_area_struct *vma)
                        break;
        }
 
-       if (i >= dev->map_count)
+       if (i >= dev->map_count) {
+               unlock_kernel();
                return -EINVAL;
-
+       }
        if (!map ||
-           ((map->flags & _DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN)))
+           ((map->flags & _DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN))) {
+               unlock_kernel();
                return -EPERM;
-
-       if (map->size != (vma->vm_end - vma->vm_start))
+       }
+       if (map->size != (vma->vm_end - vma->vm_start)) {
+               unlock_kernel();
                return -EINVAL;
-
+       }
        /* Set read-only attribute before mappings are created
         * so it works for fb/reg maps too.
         */
@@ -813,9 +826,10 @@ static int ffb_mmap(struct file *filp, struct vm_area_struct *vma)
                if (io_remap_page_range(vma->vm_start,
                                        ffb_priv->card_phys_base + VM_OFFSET(vma),
                                        vma->vm_end - vma->vm_start,
-                                       vma->vm_page_prot, 0))
+                                       vma->vm_page_prot, 0)) {
+                       unlock_kernel();
                        return -EAGAIN;
-
+               }
                vma->vm_ops = &drm_vm_ops;
                break;
        case _DRM_SHM:
@@ -828,8 +842,10 @@ static int ffb_mmap(struct file *filp, struct vm_area_struct *vma)
                vma->vm_flags |= VM_LOCKED;
                break;
        default:
+               unlock_kernel();
                return -EINVAL; /* This should never happen. */
        };
+       unlock_kernel();
 
        vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
 
index 7e0d6e53e2510831eeb04748c5f3a51ac0d15b44..8809d18101d533025efa28be7c21cc3f33f23222 100644 (file)
@@ -29,6 +29,8 @@
  */
 
 #include <linux/config.h>
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include "drmP.h"
 #include "gamma_drv.h"
 EXPORT_SYMBOL(gamma_init);
@@ -44,14 +46,15 @@ EXPORT_SYMBOL(gamma_cleanup);
 static drm_device_t          gamma_device;
 
 static struct file_operations gamma_fops = {
-       open:    gamma_open,
-       flush:   drm_flush,
-       release: gamma_release,
-       ioctl:   gamma_ioctl,
-       mmap:    drm_mmap,
-       read:    drm_read,
-       fasync:  drm_fasync,
-       poll:    drm_poll,
+       owner:          THIS_MODULE,
+       open:           gamma_open,
+       flush:          drm_flush,
+       release:        gamma_release,
+       ioctl:          gamma_ioctl,
+       mmap:           drm_mmap,
+       read:           drm_read,
+       fasync:         drm_fasync,
+       poll:           drm_poll,
 };
 
 static struct miscdevice      gamma_misc = {
@@ -407,7 +410,6 @@ int gamma_open(struct inode *inode, struct file *filp)
        
        DRM_DEBUG("open_count = %d\n", dev->open_count);
        if (!(retcode = drm_open_helper(inode, filp, dev))) {
-               MOD_INC_USE_COUNT;
                atomic_inc(&dev->total_open);
                spin_lock(&dev->count_lock);
                if (!dev->open_count++) {
@@ -422,12 +424,13 @@ int gamma_open(struct inode *inode, struct file *filp)
 int gamma_release(struct inode *inode, struct file *filp)
 {
        drm_file_t    *priv   = filp->private_data;
-       drm_device_t  *dev    = priv->dev;
+       drm_device_t  *dev;
        int           retcode = 0;
 
+       lock_kernel();
+       dev    = priv->dev;
        DRM_DEBUG("open_count = %d\n", dev->open_count);
        if (!(retcode = drm_release(inode, filp))) {
-               MOD_DEC_USE_COUNT;
                atomic_inc(&dev->total_close);
                spin_lock(&dev->count_lock);
                if (!--dev->open_count) {
@@ -436,13 +439,17 @@ int gamma_release(struct inode *inode, struct file *filp)
                                          atomic_read(&dev->ioctl_count),
                                          dev->blocked);
                                spin_unlock(&dev->count_lock);
+                               unlock_kernel();
                                return -EBUSY;
                        }
                        spin_unlock(&dev->count_lock);
-                       return gamma_takedown(dev);
+                       retcode = gamma_takedown(dev);
+                       unlock_kernel();
+                       return retcode;
                }
                spin_unlock(&dev->count_lock);
        }
+       unlock_kernel();
        return retcode;
 }
 
index 23c9c55bf6abc1d9facd15aca96b90d919f43b7c..b0c41c93c4a30deb38545214007e347618f5b0bb 100644 (file)
@@ -30,6 +30,8 @@
  */
 
 #include <linux/config.h>
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include "drmP.h"
 #include "tdfx_drv.h"
 
@@ -44,6 +46,7 @@ static drm_device_t         tdfx_device;
 drm_ctx_t                    tdfx_res_ctx;
 
 static struct file_operations tdfx_fops = {
+       owner:  THIS_MODULE,
        open:    tdfx_open,
        flush:   drm_flush,
        release: tdfx_release,
@@ -343,7 +346,6 @@ int tdfx_open(struct inode *inode, struct file *filp)
        
        DRM_DEBUG("open_count = %d\n", dev->open_count);
        if (!(retcode = drm_open_helper(inode, filp, dev))) {
-               MOD_INC_USE_COUNT;
                atomic_inc(&dev->total_open);
                spin_lock(&dev->count_lock);
                if (!dev->open_count++) {
@@ -358,12 +360,13 @@ int tdfx_open(struct inode *inode, struct file *filp)
 int tdfx_release(struct inode *inode, struct file *filp)
 {
        drm_file_t    *priv   = filp->private_data;
-       drm_device_t  *dev    = priv->dev;
+       drm_device_t  *dev;
        int           retcode = 0;
 
+       lock_kernel();
+       dev    = priv->dev;
        DRM_DEBUG("open_count = %d\n", dev->open_count);
        if (!(retcode = drm_release(inode, filp))) {
-               MOD_DEC_USE_COUNT;
                atomic_inc(&dev->total_close);
                spin_lock(&dev->count_lock);
                if (!--dev->open_count) {
@@ -372,13 +375,17 @@ int tdfx_release(struct inode *inode, struct file *filp)
                                          atomic_read(&dev->ioctl_count),
                                          dev->blocked);
                                spin_unlock(&dev->count_lock);
+                               unlock_kernel();
                                return -EBUSY;
                        }
                        spin_unlock(&dev->count_lock);
-                       return tdfx_takedown(dev);
+                       retcode = tdfx_takedown(dev);
+                       unlock_kernel();
+                       return retcode;
                }
                spin_unlock(&dev->count_lock);
        }
+       unlock_kernel();
        return retcode;
 }
 
index b4c4c5bbf0a26ead6ad1c0c9291fee7e1ece3e3a..b6595c88c20a642d3d8800cdd1ce9b5c8cda54c6 100644 (file)
@@ -144,7 +144,6 @@ void drm_vm_open(struct vm_area_struct *vma)
        DRM_DEBUG("0x%08lx,0x%08lx\n",
                  vma->vm_start, vma->vm_end - vma->vm_start);
        atomic_inc(&dev->vma_count);
-       MOD_INC_USE_COUNT;
 
 #if DRM_DEBUG_CODE
        vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS);
@@ -169,7 +168,6 @@ void drm_vm_close(struct vm_area_struct *vma)
 
        DRM_DEBUG("0x%08lx,0x%08lx\n",
                  vma->vm_start, vma->vm_end - vma->vm_start);
-       MOD_DEC_USE_COUNT;
        atomic_dec(&dev->vma_count);
 
 #if DRM_DEBUG_CODE
index 6fe41e118c2988fa867eb6307e76419d42402d91..0ada290ac8a8e21d518cffa6548babbe5c7c67b3 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/devfs_fs_kernel.h>
+#include <linux/smp_lock.h>
 
 #include <asm/segment.h>
 #include <asm/atarihw.h>
@@ -483,7 +484,9 @@ static int dsp56k_release(struct inode *inode, struct file *file)
        {
        case DSP56K_DEV_56001:
 
+               lock_kernel();
                dsp56k.in_use = 0;
+               unlock_kernel();
 
                break;
        default:
index 475e1d0529b538b6672df94eba77f12cac468c33..867a7fcec541a45b38cc07c91c9c2b1693f662bc 100644 (file)
@@ -69,6 +69,7 @@
 #include <linux/poll.h>                /* for POLLIN, etc. */
 #include <linux/dtlk.h>                /* local header file for DoubleTalk values */
 #include <linux/devfs_fs_kernel.h>
+#include <linux/smp_lock.h>
 
 #ifdef TRACING
 #define TRACE_TEXT(str) printk(str);
@@ -333,7 +334,9 @@ static int dtlk_release(struct inode *inode, struct file *file)
        }
        TRACE_RET;
 
+       lock_kernel();
        del_timer(&dtlk_timer);
+       unlock_kernel();
 
        return 0;
 }
index fd81f24caa8671025a1fb1d54bec63fd04e0c8ff..a57e3abc19679b01cb56bce8029ce25a7bc3696b 100644 (file)
 #endif
 #include <linux/fcntl.h>
 #include <linux/wrapper.h>
+#include <linux/smp_lock.h>
 #include <linux/devfs_fs_kernel.h>
 
 #include <linux/zftape.h>
-#if LINUX_VERSION_CODE >=KERNEL_VER(2,1,16)
 #include <linux/init.h>
-#else
-#define __initdata
-#define __initfunc(__arg) __arg
-#endif
 
 #include "../zftape/zftape-init.h"
 #include "../zftape/zftape-read.h"
@@ -56,7 +52,6 @@ char zft_src[] __initdata = "$Source: /homes/cvs/ftape-stacked/ftape/zftape/zfta
 char zft_rev[] __initdata = "$Revision: 1.8 $";
 char zft_dat[] __initdata = "$Date: 1997/11/06 00:48:56 $";
 
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
 MODULE_AUTHOR("(c) 1996, 1997 Claus-Justus Heine "
              "(claus@momo.math.rwth-aachen.de)");
 MODULE_DESCRIPTION(ZFTAPE_VERSION " - "
@@ -64,7 +59,6 @@ MODULE_DESCRIPTION(ZFTAPE_VERSION " - "
                   "Support for QIC-113 compatible volume table "
                   "and builtin compression (lzrw3 algorithm)");
 MODULE_SUPPORTED_DEVICE("char-major-27");
-#endif
 
 /*      Global vars.
  */
@@ -90,38 +84,18 @@ static sigset_t orig_sigmask;
  */
 
 static int  zft_open (struct inode *ino, struct file *filep);
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,31)
 static int zft_close(struct inode *ino, struct file *filep);
-#else
-static void zft_close(struct inode *ino, struct file *filep);
-#endif
 static int  zft_ioctl(struct inode *ino, struct file *filep,
                      unsigned int command, unsigned long arg);
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,56)
 static int  zft_mmap(struct file *filep, struct vm_area_struct *vma);
-#else
-static int  zft_mmap(struct inode *ino, struct file *filep,
-                    struct vm_area_struct *vma);
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
 static ssize_t zft_read (struct file *fp, char *buff,
                         size_t req_len, loff_t *ppos);
 static ssize_t zft_write(struct file *fp, const char *buff,
                         size_t req_len, loff_t *ppos);
-#elif LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
-static long zft_read (struct inode *ino, struct file *fp, char *buff,
-                     unsigned long req_len);
-static long zft_write(struct inode *ino, struct file *fp, const char *buff,
-                     unsigned long req_len);
-#else
-static int  zft_read (struct inode *ino, struct file *fp, char *buff,
-                     int req_len); 
-static int  zft_write(struct inode *ino, struct file *fp, const char *buff,
-                     int req_len);
-#endif
 
 static struct file_operations zft_cdev =
 {
+       owner:          THIS_MODULE,
        read:           zft_read,
        write:          zft_write,
        ioctl:          zft_ioctl,
@@ -137,15 +111,6 @@ static int zft_open(struct inode *ino, struct file *filep)
        int result;
        TRACE_FUN(ft_t_flow);
 
-#if LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
-       if (!MOD_IN_USE) {
-               MOD_INC_USE_COUNT; /* lock module in memory */
-       }
-#else
-       MOD_INC_USE_COUNT; /*  sets MOD_VISITED and MOD_USED_ONCE,
-                           *  locking is done with can_unload()
-                           */
-#endif
        TRACE(ft_t_flow, "called for minor %d", MINOR(ino->i_rdev));
        if (busy_flag) {
                TRACE_ABORT(-EBUSY, ft_t_warn, "failed: already busy");
@@ -155,11 +120,6 @@ static int zft_open(struct inode *ino, struct file *filep)
             > 
            FTAPE_SEL_D) {
                busy_flag = 0;
-#if defined(MODULE) && LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
-               if (!zft_dirty()) {
-                       MOD_DEC_USE_COUNT; /* unlock module in memory */
-               }
-#endif
                TRACE_ABORT(-ENXIO, ft_t_err, "failed: illegal unit nr");
        }
        orig_sigmask = current->blocked;
@@ -168,11 +128,6 @@ static int zft_open(struct inode *ino, struct file *filep)
        if (result < 0) {
                current->blocked = orig_sigmask; /* restore mask */
                busy_flag = 0;
-#if defined(MODULE) && LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
-               if (!zft_dirty()) {
-                       MOD_DEC_USE_COUNT; /* unlock module in memory */
-               }
-#endif
                TRACE_ABORT(result, ft_t_err, "_ftape_open failed");
        } else {
                /* Mask signals that will disturb proper operation of the
@@ -191,13 +146,11 @@ static int zft_close(struct inode *ino, struct file *filep)
        int result;
        TRACE_FUN(ft_t_flow);
 
+       lock_kernel();
        if (!busy_flag || MINOR(ino->i_rdev) != zft_unit) {
                TRACE(ft_t_err, "failed: not busy or wrong unit");
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,31)
+               unlock_kernel();
                TRACE_EXIT 0;
-#else
-               TRACE_EXIT; /* keep busy_flag !(?) */
-#endif
        }
        sigfillset(&current->blocked);
        result = _zft_close();
@@ -206,16 +159,8 @@ static int zft_close(struct inode *ino, struct file *filep)
        }
        current->blocked = orig_sigmask; /* restore before open state */
        busy_flag = 0;
-#if defined(MODULE) && LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
-       if (!zft_dirty()) {
-               MOD_DEC_USE_COUNT; /* unlock module in memory */
-       }
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,31)
+       unlock_kernel();
        TRACE_EXIT 0;
-#else
-       TRACE_EXIT;
-#endif
 }
 
 /*      Ioctl for floppy tape device
@@ -241,24 +186,14 @@ static int zft_ioctl(struct inode *ino, struct file *filep,
 
 /*      Ioctl for floppy tape device
  */
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,56)
 static int  zft_mmap(struct file *filep, struct vm_area_struct *vma)
-#else
-static int zft_mmap(struct inode *ino,
-                   struct file *filep,
-                   struct vm_area_struct *vma)
-#endif
 {
        int result = -EIO;
        sigset_t old_sigmask;
        TRACE_FUN(ft_t_flow);
 
        if (!busy_flag || 
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,56)
            MINOR(filep->f_dentry->d_inode->i_rdev) != zft_unit || 
-#else
-           MINOR(ino->i_rdev) != zft_unit ||
-#endif
            ft_failure)
        {
                TRACE_ABORT(-EIO, ft_t_err,
@@ -266,34 +201,26 @@ static int zft_mmap(struct inode *ino,
        }
        old_sigmask = current->blocked; /* save mask */
        sigfillset(&current->blocked);
+       lock_kernel();
        if ((result = ftape_mmap(vma)) >= 0) {
 #ifndef MSYNC_BUG_WAS_FIXED
                static struct vm_operations_struct dummy = { NULL, };
                vma->vm_ops = &dummy;
 #endif
        }
+       unlock_kernel();
        current->blocked = old_sigmask; /* restore mask */
        TRACE_EXIT result;
 }
 
 /*      Read from floppy tape device
  */
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
 static ssize_t zft_read(struct file *fp, char *buff,
                        size_t req_len, loff_t *ppos)
-#elif LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
-static long zft_read(struct inode *ino, struct file *fp, char *buff,
-                    unsigned long req_len)
-#else
-static int  zft_read(struct inode *ino, struct file *fp, char *buff,
-                    int req_len)
-#endif
 {
        int result = -EIO;
        sigset_t old_sigmask;
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
        struct inode *ino = fp->f_dentry->d_inode;
-#endif
        TRACE_FUN(ft_t_flow);
 
        TRACE(ft_t_data_flow, "called with count: %ld", (unsigned long)req_len);
@@ -311,22 +238,12 @@ static int  zft_read(struct inode *ino, struct file *fp, char *buff,
 
 /*      Write to tape device
  */
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
 static ssize_t zft_write(struct file *fp, const char *buff,
                         size_t req_len, loff_t *ppos)
-#elif LINUX_VERSION_CODE >= KERNEL_VER(2,1,0)
-static long zft_write(struct inode *ino, struct file *fp, const char *buff,
-                     unsigned long req_len)
-#else
-static int  zft_write(struct inode *ino, struct file *fp, const char *buff,
-                     int req_len)
-#endif
 {
        int result = -EIO;
        sigset_t old_sigmask;
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,60)
        struct inode *ino = fp->f_dentry->d_inode;
-#endif
        TRACE_FUN(ft_t_flow);
 
        TRACE(ft_t_flow, "called with count: %ld", (unsigned long)req_len);
@@ -470,9 +387,6 @@ KERN_INFO
                                &zft_cdev, NULL);
        }
 
-#if LINUX_VERSION_CODE < KERNEL_VER(2,1,18)
-       register_symtab(&zft_symbol_table); /* add global zftape symbols */
-#endif
 #ifdef CONFIG_ZFT_COMPRESSOR
        (void)zft_compressor_init();
 #endif
@@ -484,24 +398,20 @@ KERN_INFO
 
 
 #ifdef MODULE
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
 /* Called by modules package before trying to unload the module
  */
 static int can_unload(void)
 {
-       return (zft_dirty() || busy_flag) ? -EBUSY : 0;
+       return (GET_USE_COUNT(THIS_MODULE)||zft_dirty()||busy_flag)?-EBUSY:0;
 }
-#endif
 /* Called by modules package when installing the driver
  */
 int init_module(void)
 {
-#if LINUX_VERSION_CODE >= KERNEL_VER(2,1,18)
        if (!mod_member_present(&__this_module, can_unload)) {
                return -EBUSY;
        }
        __this_module.can_unload = can_unload;
-#endif
        return zft_init();
 }
 
index acc898cb8c42aabb252a1e732a8c124d7a3f37bc..8a4b4de5120edec2e91d5deef14a869db9273605 100644 (file)
@@ -106,16 +106,6 @@ static int h8_monitor_timer_active = 0;
 
 static char  driver_version[] = "X0.0";/* no spaces */
 
-static struct file_operations h8_fops = {
-       /* twelve lines of crap^WNULLs were here */
-};
-
-static struct miscdevice h8_device = {
-        H8_MINOR_DEV,
-        "h8",
-        &h8_fops
-};
-
 union  intr_buf intrbuf;
 int    intr_buf_ptr;
 union   intr_buf xx;   
@@ -297,7 +287,6 @@ static void h8_intr(int irq, void *dev_id, struct pt_regs *regs)
 static void __exit h8_cleanup (void)
 {
        remove_proc_entry("driver/h8", NULL);
-        misc_deregister(&h8_device);
         release_region(h8_base, 8);
         free_irq(h8_irq, NULL);
 }
@@ -313,7 +302,6 @@ static int __init h8_init(void)
 
         create_proc_info_entry("driver/h8", 0, NULL, h8_get_info);
 
-        misc_register(&h8_device);
         request_region(h8_base, 8, "h8");
 
        h8_alloc_queues();
index 905d8e8cde945d2647b753dfebf7c2d14bac1cde..7a6718c02b76382cc1b65c120cae8868ef3a7959 100644 (file)
 #include <linux/random.h>
 #include <linux/sysctl.h>
 #include <linux/miscdevice.h>
+#include <linux/smp_lock.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -626,12 +627,16 @@ err_out:
 static int rng_dev_release (struct inode *inode, struct file *filp)
 {
 
-       if (rng_enable(0) != 0)
+       lock_kernel();
+       if (rng_enable(0) != 0) {
+               unlock_kernel();
                return -EIO;
+       }
 
        spin_lock_bh (&rng_lock);
        rng_open = 0;
        spin_unlock_bh (&rng_lock);
+       unlock_kernel();
 
        return 0;
 }
index 5e212af34664694682808918dfb47d6b80404de5..a602e3b3bc74bf6bcac506acc5d329ffd61efd76 100644 (file)
 #include <linux/kernel.h>
 #include <linux/major.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <linux/devfs_fs_kernel.h>
 #include <linux/malloc.h>
 #include <linux/fcntl.h>
@@ -407,9 +408,11 @@ static int lp_release(struct inode * inode, struct file * file)
 {
        unsigned int minor = MINOR(inode->i_rdev);
 
+       lock_kernel();
        kfree_s(lp_table[minor].lp_buffer, LP_BUFFER_SIZE);
        lp_table[minor].lp_buffer = NULL;
        LP_F(minor) &= ~LP_BUSY;
+       unlock_kernel();
        return 0;
 }
 
index 6352d6f73e7665020bd58b0323e65c4c0eef7b90..1daff0de7a45536758ced03e9de64bd8a038754d 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/watchdog.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
@@ -100,9 +101,11 @@ static int mixcomwd_open(struct inode *inode, struct file *file)
 static int mixcomwd_release(struct inode *inode, struct file *file)
 {
 
+       lock_kernel();
 #ifndef CONFIG_WATCHDOG_NOWAYOUT
        if(mixcomwd_timer_alive) {
                printk(KERN_ERR "mixcomwd: release called while internal timer alive");
+               unlock_kernel();
                return -EBUSY;
        }
        init_timer(&mixcomwd_timer);
@@ -114,6 +117,7 @@ static int mixcomwd_release(struct inode *inode, struct file *file)
 #endif
 
        clear_bit(0,&mixcomwd_opened);
+       unlock_kernel();
        return 0;
 }
 
index dce40c671b0bf157ac3ffa2c788afbc237912894..5c30ca2f0d7a68d83176ca0f7a1330bd5bc1c365 100644 (file)
@@ -1265,8 +1265,10 @@ msp3400c_mixer_release(struct inode *inode, struct file *file)
 {
        struct i2c_client *client = file->private_data;
 
+       lock_kernel();
        if (client->adapter->dec_use) 
                client->adapter->dec_use(client->adapter);
+       unlock_kernel();
         return 0;
 }
 
index a32cd18df45f9be74dcbd7cf732cb41f13c80d5a..6fa72fc8eea56bf5fc5faadbdae19a120dbd27ec 100644 (file)
@@ -34,6 +34,8 @@
 
 #include <linux/module.h>
 #include <linux/config.h>
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
 
 #define PC             1
 #define ATARI  2
@@ -341,11 +343,13 @@ static int nvram_open( struct inode *inode, struct file *file )
 
 static int nvram_release( struct inode *inode, struct file *file )
 {
+       lock_kernel();
        nvram_open_cnt--;
        if (file->f_flags & O_EXCL)
                nvram_open_mode &= ~NVRAM_EXCL;
        if (file->f_mode & 2)
                nvram_open_mode &= ~NVRAM_WRITE;
+       unlock_kernel();
 
        return( 0 );
 }
index dfef66e394908cd698a32c7d73e1d88cf596455d..556d8630e206d5e2426b077a6cbc40421c4fa61c 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/poll.h>
 #include <linux/ioport.h>
 #include <linux/interrupt.h>
+#include <linux/smp_lock.h>
 
 #include <asm/signal.h>
 #include <asm/io.h>
@@ -583,10 +584,11 @@ static int fasync_pad(int fd, struct file *filp, int on)
  
 static int close_pad(struct inode * inode, struct file * file)
 {
+       lock_kernel();
        fasync_pad(-1, file, 0);
-       if (--active)
-               return 0;
-       outb(0x30, current_params.io+2);        /* switch off digitiser */
+       if (!--active)
+               outb(0x30, current_params.io+2);  /* switch off digitiser */
+       unlock_kernel();
        return 0;
 }
 
index c265b927f4820afc509613fec89334ee45cc50d7..34e13c97f3a27e057a298b9c6a00776427f76968 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/miscdevice.h>
 #include <linux/malloc.h>
 #include <linux/kbd_kern.h>
+#include <linux/smp_lock.h>
 
 #include <asm/keyboard.h>
 #include <asm/bitops.h>
@@ -872,12 +873,16 @@ static int fasync_aux(int fd, struct file *filp, int on)
 
 static int release_aux(struct inode * inode, struct file * file)
 {
+       lock_kernel();
        fasync_aux(-1, file, 0);
-       if (--aux_count)
+       if (--aux_count) {
+               unlock_kernel();
                return 0;
+       }
        kbd_write_cmd(AUX_INTS_OFF);                        /* Disable controller ints */
        kbd_write_command_w(KBD_CCMD_MOUSE_DISABLE);
        aux_free_irq(AUX_DEV);
+       unlock_kernel();
        return 0;
 }
 
index b85a168de36b96d61a1566248d5d996fb09b8748..cb197afc5e2086682fb625456edf820521a494b7 100644 (file)
@@ -63,6 +63,7 @@
 #include <linux/init.h>
 #include <linux/proc_fs.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -451,6 +452,7 @@ static int pcwd_close(struct inode *ino, struct file *filep)
 {
        if (MINOR(ino->i_rdev)==WATCHDOG_MINOR)
        {
+               lock_kernel();
                is_open = 0;
 #ifndef CONFIG_WATCHDOG_NOWAYOUT
                /*  Disable the board  */
@@ -460,6 +462,7 @@ static int pcwd_close(struct inode *ino, struct file *filep)
                        outb_p(0xA5, current_readport + 3);
                        spin_unlock(&io_lock);
                }
+               unlock_kernel();
 #endif
        }
        return 0;
index 1f0b9fddcddff94ba7a50f655bc0fb07a6b8a27f..07877c1a7a9a1889a9e2e859d35c1d77a622e250 100644 (file)
@@ -52,6 +52,7 @@
 #include <linux/poll.h>
 #include <asm/uaccess.h>
 #include <linux/ppdev.h>
+#include <linux/smp_lock.h>
 
 #define PP_VERSION "ppdev: user-space parallel port driver"
 #define CHRDEV "ppdev"
@@ -531,6 +532,7 @@ static int pp_release (struct inode * inode, struct file * file)
        unsigned int minor = MINOR (inode->i_rdev);
        struct pp_struct *pp = file->private_data;
 
+       lock_kernel();
        if (pp->pdev && pp->pdev->port->ieee1284.mode != IEEE1284_MODE_COMPAT) {
                if (!(pp->flags & PP_CLAIMED)) {
                        parport_claim_or_block (pp->pdev);
@@ -556,6 +558,7 @@ static int pp_release (struct inode * inode, struct file * file)
                printk (KERN_DEBUG CHRDEV "%x: unregistered pardevice\n",
                        minor);
        }
+       unlock_kernel();
 
        kfree (pp);
 
index 6fd5a3d65038563058dc8b0ad081eedf3b4292e5..4db93b1fb2b6017570507d73347ccb10c03fe896 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/random.h>
 #include <linux/poll.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -141,6 +142,7 @@ static int release_qp(struct inode * inode, struct file * file)
 {
        unsigned char status;
 
+       lock_kernel();
        fasync_qp(-1, file, 0);
        if (!--qp_count) {
                if (!poll_qp_status())
@@ -151,6 +153,7 @@ static int release_qp(struct inode * inode, struct file * file)
                        printk("Warning: Mouse device busy in release_qp()\n");
                free_irq(QP_IRQ, NULL);
        }
+       unlock_kernel();
        return 0;
 }
 
index a3159c8367a4cfcddfa13b28763916cf09deb45e..4b1281b50c7fed60e1892941164acb97b689f69a 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/blkdev.h>
 #include <linux/raw.h>
 #include <linux/capability.h>
+#include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 
 #define dprintk(x...) 
@@ -126,9 +127,11 @@ int raw_release(struct inode *inode, struct file *filp)
        struct block_device *bdev;
        
        minor = MINOR(inode->i_rdev);
+       lock_kernel();
        bdev = raw_device_bindings[minor];
        blkdev_put(bdev, BDEV_RAW);
        raw_device_inuse[minor]--;
+       unlock_kernel();
        return 0;
 }
 
index f227b5094b5ada18be96d8102ccebed886a3a7f6..1f128e44c73a463bca5fb23726742a72e1c698fc 100644 (file)
@@ -65,6 +65,7 @@
 #include <linux/poll.h>
 #include <linux/proc_fs.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -537,6 +538,7 @@ static int rtc_release(struct inode *inode, struct file *file)
 
        unsigned char tmp;
 
+       lock_kernel();
        spin_lock_irq(&rtc_lock);
        tmp = CMOS_READ(RTC_CONTROL);
        tmp &=  ~RTC_PIE;
@@ -555,12 +557,15 @@ static int rtc_release(struct inode *inode, struct file *file)
                rtc_fasync (-1, file, 0);
        }
 
+#else
+       lock_kernel();
 #endif
 
        spin_lock_irq (&rtc_lock);
        rtc_irq_data = 0;
        spin_unlock_irq (&rtc_lock);
        rtc_status = rtc_status & ~RTC_IS_OPEN;
+       unlock_kernel();
        return 0;
 }
 
index a0bea62c00611fc71e354760a3a1a008ad2451fd..813594244595124dd166a550a29b38c77117d6be 100644 (file)
@@ -66,6 +66,7 @@
 #include <linux/malloc.h>
 #include <linux/ioport.h>
 #include <linux/fcntl.h>
+#include <linux/smp_lock.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -207,6 +208,7 @@ static int fop_open(struct inode * inode, struct file * file)
 
 static int fop_close(struct inode * inode, struct file * file)
 {
+       lock_kernel();
        if(MINOR(inode->i_rdev) == WATCHDOG_MINOR) 
        {
                if(wdt_expect_close)
@@ -217,6 +219,7 @@ static int fop_close(struct inode * inode, struct file * file)
                }
        }
        wdt_is_open = 0;
+       unlock_kernel();
        return 0;
 }
 
index a7620dda02ffa79864624305237699e3e070d43d..3d1c579079bac7a4ca200571566df6f230bcd5af 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/miscdevice.h>
 #include <linux/watchdog.h>
 #include <linux/reboot.h>
+#include <linux/smp_lock.h>
 #include <linux/init.h>
 #include <asm/uaccess.h>
 
@@ -79,7 +80,9 @@ static int softdog_open(struct inode *inode, struct file *file)
 {
        if(timer_alive)
                return -EBUSY;
+#ifdef CONFIG_WATCHDOG_NOWAYOUT         
        MOD_INC_USE_COUNT;
+#endif 
        /*
         *      Activate timer
         */
@@ -94,11 +97,12 @@ static int softdog_release(struct inode *inode, struct file *file)
         *      Shut off the timer.
         *      Lock it in if it's a module and we defined ...NOWAYOUT
         */
+        lock_kernel();
 #ifndef CONFIG_WATCHDOG_NOWAYOUT        
        del_timer(&watchdog_ticktock);
-       MOD_DEC_USE_COUNT;
 #endif 
        timer_alive=0;
+       unlock_kernel();
        return 0;
 }
 
@@ -146,6 +150,7 @@ static int softdog_ioctl(struct inode *inode, struct file *file,
 
 static struct file_operations softdog_fops=
 {
+       owner:          THIS_MODULE,
        write:          softdog_write,
        ioctl:          softdog_ioctl,
        open:           softdog_open,
index 3ca976b6ea753d876a0a29feacecaf0e0a8ff815..14a42682d85d2dff72215e13054550f334fd096b 100644 (file)
@@ -89,6 +89,7 @@
 #include <linux/mm.h>
 #include <linux/malloc.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 #include <linux/devfs_fs_kernel.h> 
 
 #include <asm/dma.h>
@@ -2411,6 +2412,7 @@ static int qic02_tape_release(struct inode * inode, struct file * filp)
 {
     kdev_t dev = inode->i_rdev;
 
+    lock_kernel();
     if (TP_DIAGS(dev))
     {
        printk("qic02_tape_release: dev=%s\n",  kdevname(dev));
@@ -2437,6 +2439,7 @@ static int qic02_tape_release(struct inode * inode, struct file * filp)
            (void) do_qic_cmd(QCMD_REWIND, TIM_R);
        }
     }
+    unlock_kernel();
     return 0;
 } /* qic02_tape_release */
 
index 60a5c41f5377dc9c9ff14a632a55d4bc6aaa8fa1..816f385e15349d740b3fcd177fdc7d366f594070 100644 (file)
@@ -1430,7 +1430,9 @@ init_dev_done:
 
 static int tty_release(struct inode * inode, struct file * filp)
 {
+       lock_kernel();
        release_dev(filp);
+       unlock_kernel();
        return 0;
 }
 
index 0ef5bbd0300f3cdd8ca3af1a096e5c526162f21c..c3db65bae67d1cb492bf8cc674ba470b02525702 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/errno.h>
 #include <linux/malloc.h>
 #include <linux/i2c.h>
+#include <linux/smp_lock.h>
 #include <linux/videodev.h>
 #include <asm/semaphore.h>
 #include <linux/init.h>
@@ -220,13 +221,18 @@ static int tvmixer_open(struct inode *inode, struct file *file)
 static int tvmixer_release(struct inode *inode, struct file *file)
 {
         struct TVMIXER *mix = file->private_data;
-       struct i2c_client *client = mix->dev;
+       struct i2c_client *client;
 
-       if (NULL == client)
+       lock_kernel();
+       client = mix->dev;
+       if (NULL == client) {
+               unlock_kernel();
                return -ENODEV;
+       }
 
        if (client->adapter->dec_use) 
                client->adapter->dec_use(client->adapter);
+       unlock_kernel();
         return 0;
 }
 
index 5103433e126840e0ffecf6730d5838caedaa2a9c..3657cb518759bfe1e4a3fdab5b89a2f980665621 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/errno.h>
@@ -158,11 +159,9 @@ static int video_open(struct inode *inode, struct file *file)
        if(vfl==NULL) {
                char modname[20];
 
-               MOD_INC_USE_COUNT;
                sprintf (modname, "char-major-%d-%d", VIDEO_MAJOR, minor);
                request_module(modname);
                vfl=video_device[minor];
-               MOD_DEC_USE_COUNT;
                if (vfl==NULL)
                        return -ENODEV;
        }
@@ -188,10 +187,13 @@ static int video_open(struct inode *inode, struct file *file)
        
 static int video_release(struct inode *inode, struct file *file)
 {
-       struct video_device *vfl=video_device[MINOR(inode->i_rdev)];
+       struct video_device *vfl;
+       lock_kernel();
+       vfl=video_device[MINOR(inode->i_rdev)];
        if(vfl->close)
                vfl->close(vfl);
        vfl->busy=0;
+       unlock_kernel();
        return 0;
 }
 
@@ -229,11 +231,15 @@ static int video_ioctl(struct inode *inode, struct file *file,
  
 int video_mmap(struct file *file, struct vm_area_struct *vma)
 {
+       int ret = -EINVAL;
        struct video_device *vfl=video_device[MINOR(file->f_dentry->d_inode->i_rdev)];
-       if(vfl->mmap)
-               return vfl->mmap(vfl, (char *)vma->vm_start, 
+       if(vfl->mmap) {
+               lock_kernel();
+               ret = vfl->mmap(vfl, (char *)vma->vm_start, 
                                (unsigned long)(vma->vm_end-vma->vm_start));
-       return -EINVAL;
+               unlock_kernel();
+       }
+       return ret;
 }
 
 /*
@@ -515,6 +521,7 @@ void video_unregister_device(struct video_device *vfd)
 
 static struct file_operations video_fops=
 {
+       owner:          THIS_MODULE,
        llseek:         video_lseek,
        read:           video_read,
        write:          video_write,
index 3ac86bf3ae5075054c0b61032f4503e4eb14adce..bde40c589967316af79b216b6383d6ddc2e4ea0a 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <linux/miscdevice.h>
 #include <linux/watchdog.h>
 #include "wd501p.h"
@@ -372,6 +373,7 @@ static int wdt_open(struct inode *inode, struct file *file)
  
 static int wdt_release(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        if(MINOR(inode->i_rdev)==WATCHDOG_MINOR)
        {
 #ifndef CONFIG_WATCHDOG_NOWAYOUT       
@@ -380,6 +382,7 @@ static int wdt_release(struct inode *inode, struct file *file)
 #endif         
                wdt_is_open=0;
        }
+       unlock_kernel();
        return 0;
 }
 
index 6efdd7f764f2a1b7677d89ae2e12d6f945b9a21b..66633fd2088c42ee991a19245f8427c791143467 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/reboot.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/smp_lock.h>
 
 #include <asm/irq.h>
 #include <asm/uaccess.h>
@@ -74,7 +75,6 @@ static int watchdog_open(struct inode *inode, struct file *file)
 {
        if(timer_alive)
                return -EBUSY;
-       MOD_INC_USE_COUNT;
        /*
         *      Ahead watchdog factor ten, Mr Sulu
         */
@@ -86,6 +86,7 @@ static int watchdog_open(struct inode *inode, struct file *file)
        request_irq(IRQ_TIMER4, watchdog_fire, 0, "watchdog", NULL);
 #else
        *CSR_SA110_CNTL |= 1 << 13;
+       MOD_INC_USE_COUNT;
 #endif
        timer_alive = 1;
        return 0;
@@ -94,9 +95,10 @@ static int watchdog_open(struct inode *inode, struct file *file)
 static int watchdog_release(struct inode *inode, struct file *file)
 {
 #ifdef ONLY_TESTING
+       lock_kernel();
        free_irq(IRQ_TIMER4, NULL);
        timer_alive = 0;
-       MOD_DEC_USE_COUNT;
+       unlock_kernel();
 #else
        /*
         *      It's irreversible!
@@ -153,6 +155,7 @@ static int watchdog_ioctl(struct inode *inode, struct file *file,
 
 static struct file_operations watchdog_fops=
 {
+       owner:          THIS_MODULE,
        write:          watchdog_write,
        ioctl:          watchdog_ioctl,
        open:           watchdog_open,
index 9bfbf0cc68d92be9dc987bfafca8f5ee28ac4404..fef6bc7fc6fbcf8d5feb29b6682e5d698ebfe13f 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 
 #include <asm/io.h>
 #include <asm/system.h>
@@ -38,7 +39,9 @@ static int wdt977_open(struct inode *inode, struct file *file)
 {
        if(timer_alive)
                return -EBUSY;
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
        MOD_INC_USE_COUNT;
+#endif
        timer_alive++;
 
        //max timeout value = 255 minutes (0xFF). Write 0 to disable WatchDog.
@@ -88,6 +91,7 @@ static int wdt977_release(struct inode *inode, struct file *file)
         *      Lock it in if it's a module and we defined ...NOWAYOUT
         */
 #ifndef CONFIG_WATCHDOG_NOWAYOUT
+       lock_kernel();
 
        // unlock the SuperIO chip
        outb(0x87,0x370); 
@@ -118,8 +122,8 @@ static int wdt977_release(struct inode *inode, struct file *file)
        // lock the SuperIO chip
        outb(0xAA,0x370);
 
-       MOD_DEC_USE_COUNT;
        timer_alive=0;
+       unlock_kernel();
 
        printk(KERN_INFO "Watchdog: shutdown.\n");
 #endif
@@ -162,6 +166,7 @@ static ssize_t wdt977_write(struct file *file, const char *data, size_t len, lof
 
 static struct file_operations wdt977_fops=
 {
+       owner:          THIS_MODULE,
        write:          wdt977_write,
        open:           wdt977_open,
        release:        wdt977_release,
index 2bd09930a14a2c6604aad7a29b1036b059b2610a..8e960841b51db5eb2fc598ef6011a83bdaa36670 100644 (file)
@@ -51,6 +51,7 @@
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 
 #include <linux/pci.h>
 
@@ -358,7 +359,9 @@ static int wdtpci_open(struct inode *inode, struct file *file)
                case WATCHDOG_MINOR:
                        if(wdt_is_open)
                                return -EBUSY;
+#ifdef CONFIG_WATCHDOG_NOWAYOUT        
                        MOD_INC_USE_COUNT;
+#endif
                        /*
                         *      Activate 
                         */
@@ -391,7 +394,6 @@ static int wdtpci_open(struct inode *inode, struct file *file)
                        outb_p(0, WDT_DC);      /* Enable */
                        return 0;
                case TEMP_MINOR:
-                       MOD_INC_USE_COUNT;
                        return 0;
                default:
                        return -ENODEV;
@@ -414,13 +416,14 @@ static int wdtpci_release(struct inode *inode, struct file *file)
 {
        if(MINOR(inode->i_rdev)==WATCHDOG_MINOR)
        {
+               lock_kernel();
 #ifndef CONFIG_WATCHDOG_NOWAYOUT       
                inb_p(WDT_DC);          /* Disable counters */
                wdtpci_ctr_load(2,0);   /* 0 length reset pulses now */
 #endif         
                wdt_is_open=0;
+               unlock_kernel();
        }
-       MOD_DEC_USE_COUNT;
        return 0;
 }
 
@@ -454,6 +457,7 @@ static int wdtpci_notify_sys(struct notifier_block *this, unsigned long code,
  
  
 static struct file_operations wdtpci_fops = {
+       owner:          THIS_MODULE,
        llseek:         wdtpci_llseek,
        read:           wdtpci_read,
        write:          wdtpci_write,
index e373ce2f361a6727b4aebdb8ffb485b30f958c21..47a6292d149a1d537be485ec19a58e15e5db170e 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/fs.h>
 #include <linux/malloc.h>
 #include <linux/version.h>
+#include <linux/smp_lock.h>
 
 /* If you want debugging uncomment: */
 /* #define DEBUG */
@@ -76,6 +77,7 @@ extern
 static int i2cdev_cleanup(void);
 
 static struct file_operations i2cdev_fops = {
+       owner:          THIS_MODULE,
        llseek:         i2cdev_lseek,
        read:           i2cdev_read,
        write:          i2cdev_write,
@@ -374,7 +376,6 @@ int i2cdev_open (struct inode *inode, struct file *file)
 
        if (i2cdev_adaps[minor]->inc_use)
                i2cdev_adaps[minor]->inc_use(i2cdev_adaps[minor]);
-       MOD_INC_USE_COUNT;
 
 #ifdef DEBUG
        printk("i2c-dev.o: opened i2c-%d\n",minor);
@@ -390,9 +391,10 @@ static int i2cdev_release (struct inode *inode, struct file *file)
 #ifdef DEBUG
        printk("i2c-dev.o: Closed: i2c-%d\n", minor);
 #endif
-       MOD_DEC_USE_COUNT;
+       lock_kernel();
        if (i2cdev_adaps[minor]->dec_use)
                i2cdev_adaps[minor]->dec_use(i2cdev_adaps[minor]);
+       unlock_kernel();
        return 0;
 }
 
index 7a50f64e946dd4ac274c7f1c670d2adc26b20ae5..9a9cfec6e14273185a5307b8574841d0cb6f9254 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/miscdevice.h>
 #include <linux/mm.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -848,6 +849,7 @@ static int cfg_release(struct inode *inode, struct file *file)
        struct i2o_cfg_info *p1, *p2;
        unsigned int flags;
 
+       lock_kernel();
        p1 = p2 = NULL;
 
        spin_lock_irqsave(&i2o_config_lock, flags);
@@ -870,6 +872,7 @@ static int cfg_release(struct inode *inode, struct file *file)
                p1 = p1->next;
        }
        spin_unlock_irqrestore(&i2o_config_lock, flags);
+       unlock_kernel();
 
        return 0;
 }
index 911234014e6a9ed5db00c42d22f9559c05853ce0..bd89fcc616dd7253cffe07a19bb1f400c94e6511 100644 (file)
 #include <linux/malloc.h>
 #include <linux/pci.h>
 #include <linux/ide.h>
+#include <linux/smp_lock.h>
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
@@ -5235,11 +5236,6 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp)
 
        if (test_and_set_bit (IDETAPE_BUSY, &tape->flags))
                return -EBUSY;
-       MOD_INC_USE_COUNT;
-#if ONSTREAM_DEBUG
-       if (tape->debug_level >= 6)
-               printk(KERN_INFO "ide-tape: MOD_INC_USE_COUNT in idetape_chrdev_open-1\n");
-#endif
        if (!tape->onstream) {
                idetape_read_position(drive);
                if (!test_bit (IDETAPE_ADDRESS_VALID, &tape->flags))
@@ -5255,28 +5251,13 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp)
        }
        if (idetape_wait_ready(drive, 60 * HZ)) {
                clear_bit(IDETAPE_BUSY, &tape->flags);
-               MOD_DEC_USE_COUNT;
-#if ONSTREAM_DEBUG
-       if (tape->debug_level >= 6)
-               printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_chrdev_open-1\n");
-#endif
                printk(KERN_ERR "ide-tape: %s: drive not ready\n", tape->name);
                return -EBUSY;
        }
        idetape_read_position(drive);
-       MOD_DEC_USE_COUNT;
-#if ONSTREAM_DEBUG
-       if (tape->debug_level >= 6)
-               printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_chrdev_open-2\n");
-#endif
        clear_bit (IDETAPE_PIPELINE_ERROR, &tape->flags);
 
        if (tape->chrdev_direction == idetape_direction_none) {
-               MOD_INC_USE_COUNT;
-#if ONSTREAM_DEBUG
-               if (tape->debug_level >= 6)
-                       printk(KERN_INFO "ide-tape: MOD_INC_USE_COUNT in idetape_chrdev_open-2\n");
-#endif
                idetape_create_prevent_cmd(drive, &pc, 1);
                if (!idetape_queue_pc_tail (drive,&pc)) {
                        if (tape->door_locked != DOOR_EXPLICITLY_LOCKED)
@@ -5296,10 +5277,12 @@ static int idetape_chrdev_open (struct inode *inode, struct file *filp)
 static int idetape_chrdev_release (struct inode *inode, struct file *filp)
 {
        ide_drive_t *drive = get_drive_ptr (inode->i_rdev);
-       idetape_tape_t *tape = drive->driver_data;
+       idetape_tape_t *tape;
        idetape_pc_t pc;
        unsigned int minor=MINOR (inode->i_rdev);
-                       
+
+       lock_kernel();
+       tape = drive->driver_data;
 #if IDETAPE_DEBUG_LOG
        if (tape->debug_level >= 3)
                printk (KERN_INFO "ide-tape: Reached idetape_chrdev_release\n");
@@ -5337,13 +5320,9 @@ static int idetape_chrdev_release (struct inode *inode, struct file *filp)
                        if (!idetape_queue_pc_tail (drive,&pc))
                                tape->door_locked = DOOR_UNLOCKED;
                }
-               MOD_DEC_USE_COUNT;
-#if ONSTREAM_DEBUG
-               if (tape->debug_level >= 6)
-                       printk(KERN_INFO "ide-tape: MOD_DEC_USE_COUNT in idetape_chrdev_release\n");
-#endif
        }
        clear_bit (IDETAPE_BUSY, &tape->flags);
+       unlock_kernel();
        return 0;
 }
 
@@ -5919,6 +5898,7 @@ static ide_module_t idetape_module = {
  *     Our character device supporting functions, passed to register_chrdev.
  */
 static struct file_operations idetape_fops = {
+       owner:          THIS_MODULE,
        read:           idetape_chrdev_read,
        write:          idetape_chrdev_write,
        ioctl:          idetape_chrdev_ioctl,
index 83c1169fe9a429b7fca8fae4b3b96d1b2cc6a30c..3c23c45a51c41f5fd8f3c46ca08020f680c4cdbb 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/poll.h>
 #include <linux/module.h>
 #include <linux/version.h>
+#include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,0)
@@ -869,6 +870,7 @@ static int dev_release(struct inode *inode, struct file *file)
         struct pending_request *req;
         int done = 0, i;
 
+       lock_kernel();
         for (i = 0; i < 64; i++) {
                 if (fi->listen_channels & (1ULL << i)) {
                         hpsb_unlisten_channel(hl_handle, fi->host, i);
@@ -913,6 +915,7 @@ static int dev_release(struct inode *inode, struct file *file)
         kfree(fi);
 
         V22_COMPAT_MOD_DEC_USE_COUNT;
+       unlock_kernel();
         return 0;
 }
 
index 9f00fd3f06b74b2cb9997965eb5e15095ce93064..9afbb58ec385d9b98aaec5f6e3d04a6583f3210c 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/pci.h>
 #include <linux/fs.h>
 #include <linux/poll.h>
+#include <linux/smp_lock.h>
 #include <asm/byteorder.h>
 #include <asm/atomic.h>
 #include <asm/io.h>
@@ -1043,18 +1044,20 @@ int video1394_mmap(struct file *file, struct vm_area_struct *vma)
 {
        struct video_card *video = 
                &video_cards[MINOR(file->f_dentry->d_inode->i_rdev)];
-       struct ti_ohci *ohci= video->ohci;
+       struct ti_ohci *ohci;
+       int res = -EINVAL;
 
+       lock_kernel();
+       ohci = video->ohci;
        PRINT(KERN_INFO, ohci->id, "mmap");
        if (video->current_ctx == NULL) {
                PRINT(KERN_ERR, ohci->id, "current iso context not set");
-               return -EINVAL;
-       }
-       
-       return do_iso_mmap(ohci, video->current_ctx, 
+       } else
+               res = do_iso_mmap(ohci, video->current_ctx, 
                           (char *)vma->vm_start, 
                           (unsigned long)(vma->vm_end-vma->vm_start));
-       return 0;
+       unlock_kernel();
+       return res;
 }
 
 static int video1394_open(struct inode *inode, struct file *file)
@@ -1079,6 +1082,7 @@ static int video1394_release(struct inode *inode, struct file *file)
        struct ti_ohci *ohci= video->ohci;
        int i;
 
+       lock_kernel();
        for (i=0;i<ohci->nb_iso_rcv_ctx-1;i++) 
                if (video->ir_context[i]) {
                        if (!test_and_clear_bit(
@@ -1115,6 +1119,7 @@ static int video1394_release(struct inode *inode, struct file *file)
        V22_COMPAT_MOD_DEC_USE_COUNT;
 
        PRINT(KERN_INFO, ohci->id, "release");
+       unlock_kernel();
        return 0;
 }
 
index 06ddc81992a2f4c8be8a4be00f37982e30b03734..4c7e6826661cd0eea79fff8afbb7a89bafa25e90 100644 (file)
 #include <linux/fs.h>
 #include <linux/signal.h>
 #include <linux/mm.h>
+#include <linux/smp_lock.h>
 #include <linux/timer.h>
 #include <linux/wait.h>
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
@@ -379,10 +380,8 @@ struct capiminor *capiminor_alloc(__u16 applid, __u32 ncci)
        struct capiminor *mp, **pp;
         unsigned int minor = 0;
 
-       MOD_INC_USE_COUNT;
        mp = (struct capiminor *)kmem_cache_alloc(capiminor_cachep, GFP_ATOMIC);
        if (!mp) {
-               MOD_DEC_USE_COUNT;
                printk(KERN_ERR "capi: can't alloc capiminor\n");
                return 0;
        }
@@ -434,7 +433,6 @@ void capiminor_free(struct capiminor *mp)
                                kfree_skb(skb);
                        capiminor_del_all_ack(mp);
                        kmem_cache_free(capiminor_cachep, mp);
-                       MOD_DEC_USE_COUNT;
 #ifdef _DEBUG_REFCOUNT
                        printk(KERN_DEBUG "capiminor_free %d\n", GET_USE_COUNT(THIS_MODULE));
 #endif
@@ -1212,7 +1210,6 @@ capi_open(struct inode *inode, struct file *file)
        if ((file->private_data = capidev_alloc(file)) == 0)
                return -ENOMEM;
 
-       MOD_INC_USE_COUNT;
 #ifdef _DEBUG_REFCOUNT
        printk(KERN_DEBUG "capi_open %d\n", GET_USE_COUNT(THIS_MODULE));
 #endif
@@ -1224,14 +1221,15 @@ capi_release(struct inode *inode, struct file *file)
 {
        struct capidev *cdev = (struct capidev *)file->private_data;
 
+       lock_kernel();
        capincci_free(cdev, 0xffffffff);
        capidev_free(cdev);
        file->private_data = NULL;
 
-       MOD_DEC_USE_COUNT;
 #ifdef _DEBUG_REFCOUNT
        printk(KERN_DEBUG "capi_release %d\n", GET_USE_COUNT(THIS_MODULE));
 #endif
+       unlock_kernel();
        return 0;
 }
 
@@ -1414,11 +1412,13 @@ capinc_raw_release(struct inode *inode, struct file *file)
        struct capiminor *mp = (struct capiminor *)file->private_data;
 
        if (mp) {
+               lock_kernel();
                mp->file = 0;
                if (mp->nccip == 0) {
                        capiminor_free(mp);
                        file->private_data = NULL;
                }
+               unlock_kernel();
        }
 
 #ifdef _DEBUG_REFCOUNT
@@ -2050,8 +2050,6 @@ int capi_init(void)
 {
        char *p;
 
-       MOD_INC_USE_COUNT;
-
        if ((p = strchr(revision, ':'))) {
                strcpy(rev, p + 2);
                p = strchr(rev, '$');
@@ -2061,7 +2059,6 @@ int capi_init(void)
 
        if (devfs_register_chrdev(capi_major, "capi20", &capi_fops)) {
                printk(KERN_ERR "capi20: unable to get major %d\n", capi_major);
-               MOD_DEC_USE_COUNT;
                return -EIO;
        }
 
@@ -2069,7 +2066,6 @@ int capi_init(void)
        if (devfs_register_chrdev(capi_rawmajor, "capi/r%d", &capinc_raw_fops)) {
                devfs_unregister_chrdev(capi_major, "capi20");
                printk(KERN_ERR "capi20: unable to get major %d\n", capi_rawmajor);
-               MOD_DEC_USE_COUNT;
                return -EIO;
        }
         devfs_register_series (NULL, "capi/r%u", CAPINC_NR_PORTS,
@@ -2085,7 +2081,6 @@ int capi_init(void)
 
        if ((capifuncs = attach_capi_interface(&cuser)) == 0) {
 
-               MOD_DEC_USE_COUNT;
                devfs_unregister_chrdev(capi_major, "capi20");
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
                devfs_unregister_chrdev(capi_rawmajor, "capi/r%d");
@@ -2101,7 +2096,6 @@ int capi_init(void)
                (void) detach_capi_interface(&cuser);
                devfs_unregister_chrdev(capi_major, "capi20");
                devfs_unregister_chrdev(capi_rawmajor, "capi/r%d");
-               MOD_DEC_USE_COUNT;
                return -ENOMEM;
        }
 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
@@ -2122,7 +2116,6 @@ int capi_init(void)
                devfs_unregister(devfs_find_handle(NULL, "capi20",
                                                   capi_major, 0,
                                                   DEVFS_SPECIAL_CHR, 0));
-               MOD_DEC_USE_COUNT;
                return -ENOMEM;
        }
 
@@ -2131,7 +2124,6 @@ int capi_init(void)
        printk(KERN_NOTICE "capi20: Rev%s: started up with major %d\n",
                                rev, capi_major);
 
-       MOD_DEC_USE_COUNT;
        return 0;
 }
 
index f7d7ee8d5d48399f3177602148d03af065f3e77d..bd065a48def8a557a1d9ae62afb264baa1a2b1b4 100644 (file)
@@ -199,6 +199,7 @@ isdn_divert_close(struct inode *ino, struct file *filep)
        struct divert_info *inf;
        int flags;
 
+       lock_kernel();
        save_flags(flags);
        cli();
        if_used--;
@@ -214,6 +215,7 @@ isdn_divert_close(struct inode *ino, struct file *filep)
                        divert_info_head = divert_info_head->next;
                        kfree(inf);
                }
+       unlock_kernel();
        return (0);
 }                              /* isdn_divert_close */
 
index c27c926a1358592066bd4b8b220d79e484be01e2..c28aedc1fac453702291634156fa54fdc95b56af 100644 (file)
@@ -372,6 +372,7 @@ hysdn_conf_close(struct inode *ino, struct file *filep)
        int retval = 0;
        struct proc_dir_entry *pd;
 
+       lock_kernel();
        /* search the addressed card */
        card = card_root;
        while (card) {
@@ -381,6 +382,7 @@ hysdn_conf_close(struct inode *ino, struct file *filep)
                card = card->next;      /* search next entry */
        }
        if (!card) {
+               unlock_kernel();
                return (-ENODEV);       /* device is unknown/invalid */
        }
        if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL))
@@ -403,6 +405,7 @@ hysdn_conf_close(struct inode *ino, struct file *filep)
                if (filep->private_data)
                        kfree(filep->private_data);     /* release memory */
        }
+       unlock_kernel();
        return (retval);
 }                              /* hysdn_conf_close */
 
index ae07f659794103ba01485533ab5d636640b589df..8649356258a2d4d6033a1d058de7f0519ed0be01 100644 (file)
@@ -254,7 +254,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
        hysdn_card *card;
        int flags, retval = 0;
 
-
+       lock_kernel();
        if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
                /* write only access -> write debug completely written */
                retval = 0;     /* success */
@@ -297,6 +297,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
                                }
        }                       /* read access */
 
+       unlock_kernel();
        return (retval);
 }                              /* hysdn_log_close */
 
index 1a2980f02dc3ba4ee76a50f8121718af12aac7ab..ba454b9dc83d9b7e99e3f208b35b3b9bfd6826ad 100644 (file)
@@ -345,6 +345,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
        int flags, retval = 0;
 
 
+       lock_kernel();
        if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
                /* write only access -> write debug level written */
                retval = 0;     /* success */
@@ -386,6 +387,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
                                        kfree(inf);
                                }
        }                       /* read access */
+       unlock_kernel();
 
        return (retval);
 }                              /* hysdn_log_close */
index f6c326301a17aca440bfc5e882af119d34feba65..b543d869035e7626027f1f34b6b671ed4f05845a 100644 (file)
 #include <linux/poll.h>
 #include <linux/vmalloc.h>
 #include <linux/isdn.h>
+#include <linux/smp_lock.h>
 #include "isdn_common.h"
 #include "isdn_tty.h"
 #include "isdn_net.h"
@@ -485,11 +486,10 @@ static void isdn_register_devfs(int);
 static void isdn_unregister_devfs(int);
 
 void
-isdn_MOD_INC_USE_COUNT(void)
+isdn_lock_drivers(void)
 {
        int i;
 
-       MOD_INC_USE_COUNT;
        for (i = 0; i < dev->drivers; i++) {
                isdn_ctrl cmd;
 
@@ -502,11 +502,17 @@ isdn_MOD_INC_USE_COUNT(void)
 }
 
 void
-isdn_MOD_DEC_USE_COUNT(void)
+isdn_MOD_INC_USE_COUNT(void)
+{
+       MOD_INC_USE_COUNT;
+       isdn_lock_drivers();
+}
+
+void
+isdn_unlock_drivers(void)
 {
        int i;
 
-       MOD_DEC_USE_COUNT;
        for (i = 0; i < dev->drivers; i++)
                if (dev->drv[i]->locks > 0) {
                        isdn_ctrl cmd;
@@ -519,6 +525,13 @@ isdn_MOD_DEC_USE_COUNT(void)
                }
 }
 
+void
+isdn_MOD_DEC_USE_COUNT(void)
+{
+       MOD_DEC_USE_COUNT;
+       isdn_unlock_drivers();
+}
+
 #if defined(ISDN_DEBUG_NET_DUMP) || defined(ISDN_DEBUG_MODEM_DUMP)
 void
 isdn_dumppkt(char *s, u_char * p, int len, int dumplen)
@@ -1976,8 +1989,6 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
 
 /*
  * Open the device code.
- * MOD_INC_USE_COUNT make sure that the driver memory is not freed
- * while the device is in use.
  */
 static int
 isdn_open(struct inode *ino, struct file *filep)
@@ -1990,7 +2001,6 @@ isdn_open(struct inode *ino, struct file *filep)
                infostruct *p;
 
                if ((p = (infostruct *) kmalloc(sizeof(infostruct), GFP_KERNEL))) {
-                       MOD_INC_USE_COUNT;
                        p->next = (char *) dev->infochain;
                        p->private = (char *) &(filep->private_data);
                        dev->infochain = p;
@@ -2011,21 +2021,21 @@ isdn_open(struct inode *ino, struct file *filep)
                        return -ENODEV;
                if (!(dev->drv[drvidx]->online & (1 << chidx)))
                        return -ENODEV;
-               isdn_MOD_INC_USE_COUNT();
+               isdn_lock_drivers();
                return 0;
        }
        if (minor <= ISDN_MINOR_CTRLMAX) {
                drvidx = isdn_minor2drv(minor - ISDN_MINOR_CTRL);
                if (drvidx < 0)
                        return -ENODEV;
-               isdn_MOD_INC_USE_COUNT();
+               isdn_lock_drivers();
                return 0;
        }
 #ifdef CONFIG_ISDN_PPP
        if (minor <= ISDN_MINOR_PPPMAX) {
                int ret;
                if (!(ret = isdn_ppp_open(minor - ISDN_MINOR_PPP, filep)))
-                       isdn_MOD_INC_USE_COUNT();
+                       isdn_lock_drivers();
                return ret;
        }
 #endif
@@ -2037,11 +2047,11 @@ isdn_close(struct inode *ino, struct file *filep)
 {
        uint minor = MINOR(ino->i_rdev);
 
+       lock_kernel();
        if (minor == ISDN_MINOR_STATUS) {
                infostruct *p = dev->infochain;
                infostruct *q = NULL;
 
-               MOD_DEC_USE_COUNT;
                while (p) {
                        if (p->private == (char *) &(filep->private_data)) {
                                if (q)
@@ -2049,31 +2059,38 @@ isdn_close(struct inode *ino, struct file *filep)
                                else
                                        dev->infochain = (infostruct *) (p->next);
                                kfree(p);
+                               unlock_kernel();
                                return 0;
                        }
                        q = p;
                        p = (infostruct *) (p->next);
                }
                printk(KERN_WARNING "isdn: No private data while closing isdnctrl\n");
+               unlock_kernel();
                return 0;
        }
-       isdn_MOD_DEC_USE_COUNT();
-       if (minor < ISDN_MINOR_CTRL)
+       isdn_unlock_drivers();
+       if (minor < ISDN_MINOR_CTRL) {
+               unlock_kernel();
                return 0;
+       }
        if (minor <= ISDN_MINOR_CTRLMAX) {
                if (dev->profd == current)
                        dev->profd = NULL;
+               unlock_kernel();
                return 0;
        }
 #ifdef CONFIG_ISDN_PPP
        if (minor <= ISDN_MINOR_PPPMAX)
                isdn_ppp_release(minor - ISDN_MINOR_PPP, filep);
 #endif
+       unlock_kernel();
        return 0;
 }
 
 static struct file_operations isdn_fops =
 {
+       owner:          THIS_MODULE,
        llseek:         isdn_lseek,
        read:           isdn_read,
        write:          isdn_write,
index ff6f18ee1d34e203990adaf6381a76083496e076..10421b00d3aa828b6ab3c82277a24a18d4be2b35 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/devfs_fs_kernel.h>
 #include <linux/mm.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <linux/adb.h>
 #include <linux/cuda.h>
 #include <linux/pmu.h>
@@ -516,6 +517,7 @@ static int adb_release(struct inode *inode, struct file *file)
        struct adbdev_state *state = file->private_data;
        unsigned long flags;
 
+       lock_kernel();
        if (state) {
                file->private_data = NULL;
                spin_lock_irqsave(&state->lock, flags);
@@ -528,6 +530,7 @@ static int adb_release(struct inode *inode, struct file *file)
                        spin_unlock_irqrestore(&state->lock, flags);
                }
        }
+       unlock_kernel();
        return 0;
 }
 
index 9ca4a9ae8314b7460e0fe8f415c2dc2d192f441c..efec54db0be68422e15be3bb6994ad1e3c312b42 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/adb.h>
 #include <linux/pmu.h>
 #include <linux/cuda.h>
+#include <linux/smp_lock.h>
 #include <asm/prom.h>
 #include <asm/machdep.h>
 #include <asm/io.h>
@@ -1539,6 +1540,7 @@ static int pmu_release(struct inode *inode, struct file *file)
        struct pmu_private *pp = file->private_data;
        unsigned long flags;
 
+       lock_kernel();
        if (pp != 0) {
                file->private_data = 0;
                spin_lock_irqsave(&all_pvt_lock, flags);
@@ -1546,6 +1548,7 @@ static int pmu_release(struct inode *inode, struct file *file)
                spin_unlock_irqrestore(&all_pvt_lock, flags);
                kfree(pp);
        }
+       unlock_kernel();
        return 0;
 }
 
index d0e79a4316cb74b2c691e3f5976d12c2fd379020..508244f37b5edfbb0489d42661fe1650110c5a01 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/mtd/mtd.h>
 #include <linux/malloc.h>
+#include <linux/smp_lock.h>
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
 static loff_t mtd_lseek (struct file *file, loff_t offset, int orig)
@@ -63,21 +64,16 @@ static int mtd_open(struct inode *inode, struct file *file)
        if ((file->f_mode & 2) && (minor & 1))
                return -EACCES;
 
-       MOD_INC_USE_COUNT;
-
        mtd = get_mtd_device(NULL, devnum);
                
-       if (!mtd) {
-               MOD_DEC_USE_COUNT;
+       if (!mtd)
                return -ENODEV;
-       }
        
        file->private_data = mtd;
                
        /* You can't open it RW if it's not a writeable device */
        if ((file->f_mode & 2) && !(mtd->flags & MTD_WRITEABLE)) {
                put_mtd_device(mtd);
-               MOD_DEC_USE_COUNT;
                return -EACCES;
        }
                
@@ -95,12 +91,13 @@ static release_t mtd_close(struct inode *inode,
 
        mtd = (struct mtd_info *)file->private_data;
        
+       lock_kernel();
        if (mtd->sync)
                mtd->sync(mtd);
        
        put_mtd_device(mtd);
+       unlock_kernel();
 
-       MOD_DEC_USE_COUNT;
        release_return(0);
 } /* mtd_close */
 
@@ -362,7 +359,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
 } /* memory_ioctl */
 
 static struct file_operations mtd_fops = {
-
+       owner:          THIS_MODULE,
        llseek:         mtd_lseek,      /* lseek */
        read:           mtd_read,       /* read */
        write:          mtd_write,      /* write */
index e43e3b394ac52531f9f7dc78a329b457d0876a22..f59653eefa39b92cd64780daf2865fe143221f21 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/ip.h>
 #include <linux/tcp.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 #include <net/slhc_vj.h>
 #include <asm/atomic.h>
 
@@ -319,6 +320,7 @@ static int ppp_release(struct inode *inode, struct file *file)
 {
        struct ppp_file *pf = (struct ppp_file *) file->private_data;
 
+       lock_kernel();
        if (pf != 0) {
                file->private_data = 0;
                if (atomic_dec_and_test(&pf->refcnt)) {
@@ -332,6 +334,7 @@ static int ppp_release(struct inode *inode, struct file *file)
                        }
                }
        }
+       unlock_kernel();
        return 0;
 }
 
index dc0b212f5a72403450357ed79f98740f845683ff..be015f1957c786a51dfc9511c009bb995a0097d9 100644 (file)
@@ -93,6 +93,7 @@
 #include <linux/ioport.h>
 #include <linux/netdevice.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 
 #undef COSA_SLOW_IO    /* for testing purposes only */
 #undef REALLY_SLOW_IO
@@ -977,13 +978,16 @@ static int cosa_open(struct inode *inode, struct file *file)
 static int cosa_release(struct inode *inode, struct file *file)
 {
        struct channel_data *channel = (struct channel_data *)file->private_data;
-       struct cosa_data *cosa = channel->cosa;
+       struct cosa_data *cosa;
        unsigned long flags;
 
+       lock_kernel();
+       cosa = channel->cosa;
        spin_lock_irqsave(&cosa->lock, flags);
        cosa->usage--;
        channel->usage--;
        spin_unlock_irqrestore(&cosa->lock, flags);
+       unlock_kernel();
        return 0;
 }
 
index 11e4330c512bc33ffa51ecbad0cffc3b79f81a32..f536e42cb7121fbcec21c6143322d0524d3149c8 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/mm.h>
 #include <linux/fcntl.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <linux/timer.h>
 #include <linux/ioctl.h>
 #include <linux/proc_fs.h>
@@ -561,7 +562,6 @@ static int ds_open(struct inode *inode, struct file *file)
     
     user = kmalloc(sizeof(user_info_t), GFP_KERNEL);
     if (!user) return -ENOMEM;
-    MOD_INC_USE_COUNT;
     user->event_tail = user->event_head = 0;
     user->next = s->user;
     user->user_magic = USER_MAGIC;
@@ -584,10 +584,11 @@ static int ds_release(struct inode *inode, struct file *file)
     DEBUG(0, "ds_release(socket %d)\n", i);
     if ((i >= sockets) || (sockets == 0))
        return 0;
+    lock_kernel();
     s = &socket_table[i];
     user = file->private_data;
     if (CHECK_USER(user))
-       return 0;
+       goto out;
 
     /* Unlink user data structure */
     if ((file->f_flags & O_ACCMODE) != O_RDONLY)
@@ -596,12 +597,12 @@ static int ds_release(struct inode *inode, struct file *file)
     for (link = &s->user; *link; link = &(*link)->next)
        if (*link == user) break;
     if (link == NULL)
-       return 0;
+       goto out;
     *link = user->next;
     user->user_magic = 0;
     kfree(user);
-    
-    MOD_DEC_USE_COUNT;
+out:
+    unlock_kernel();
     return 0;
 } /* ds_release */
 
@@ -854,12 +855,13 @@ static int ds_ioctl(struct inode * inode, struct file * file,
 /*====================================================================*/
 
 static struct file_operations ds_fops = {
-        open:          ds_open,
-        release:       ds_release,
-        ioctl:         ds_ioctl,
-        read:          ds_read,
-        write:         ds_write,
-        poll:          ds_poll,
+       owner:          THIS_MODULE,
+       open:           ds_open,
+       release:        ds_release,
+       ioctl:          ds_ioctl,
+       read:           ds_read,
+       write:          ds_write,
+       poll:           ds_poll,
 };
 
 EXPORT_SYMBOL(register_pccard_driver);
index 3472225b872155eab8fb81486d8d9ea2dc839c8d..ee4c2aee397c22841f1cd91c981637967002c45b 100644 (file)
@@ -187,10 +187,12 @@ static int isapnp_info_entry_release(struct inode *inode, struct file *file)
        if ((buffer = (isapnp_info_buffer_t *) file->private_data) == NULL)
                return -EINVAL;
        mode = file->f_flags & O_ACCMODE;
+       lock_kernel();
        if (mode == O_WRONLY)
                isapnp_info_write(buffer);
        vfree(buffer->buffer);
        kfree(buffer);
+       unlock_kernel();
        return 0;
 }
 
index be7e9de06f093f5203ead194b4769a2dbfade187..6ee5c6d3ccb82d330387e05b3aaf24a63a606bc3 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/fs.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <linux/mm.h>
 #include <linux/tqueue.h>
 #include <linux/major.h>
@@ -1910,6 +1911,7 @@ static int sparcaudio_release(struct inode * inode, struct file * file)
         struct sparcaudio_driver *drv = drivers[(MINOR(inode->i_rdev) >>
                                                  SPARCAUDIO_DEVICE_SHIFT)];
 
+       lock_kernel();
         if (file->f_mode & FMODE_READ) {
                 /* Stop input */
                 drv->ops->stop_input(drv);
@@ -1951,11 +1953,13 @@ static int sparcaudio_release(struct inode * inode, struct file * file)
         kill_procs(drv->sd_siglist,SIGPOLL,S_MSG);
 
         wake_up_interruptible(&drv->open_wait);
+       unlock_kernel();
 
         return 0;
 }
 
 static struct file_operations sparcaudio_fops = {
+       owner:          THIS_MODULE,
        llseek:         sparcaudio_lseek,
        read:           sparcaudio_read,
        write:          sparcaudio_write,
index ebe9928c276e1d8495c1e8c22a75cb8bc09aa241..56f9d38afed3d97e00fccbbda32b5d8efb2380dc 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/fs.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <linux/timer.h>
 #include <linux/ioport.h>
 #include <linux/major.h>
@@ -456,10 +457,13 @@ static int bpp_open(struct inode *inode, struct file *f)
 static int bpp_release(struct inode *inode, struct file *f)
 {
       unsigned minor = MINOR(inode->i_rdev);
+
+      lock_kernel();
       instances[minor].opened = 0;
 
       if (instances[minor].mode != COMPATIBILITY)
       terminate(minor);
+      unlock_kernel();
       return 0;
 }
 
index 8bdee5e0418548f2dccaf483ad3faa2304e3a55c..7a03036b6c27e7ba2135cd6f1e99ba7a5520ebcd 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/fcntl.h>
 #include <linux/poll.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -37,23 +38,28 @@ flash_mmap(struct file *file, struct vm_area_struct *vma)
        unsigned long addr;
        unsigned long size;
 
+       lock_kernel();
        if (flash.read_base == flash.write_base) {
                addr = flash.read_base;
                size = flash.read_size;
        } else {
                if ((vma->vm_flags & VM_READ) &&
-                   (vma->vm_flags & VM_WRITE))
+                   (vma->vm_flags & VM_WRITE)) {
+                       unlock_kernel();
                        return -EINVAL;
-
+               }
                if (vma->vm_flags & VM_READ) {
                        addr = flash.read_base;
                        size = flash.read_size;
                } else if (vma->vm_flags & VM_WRITE) {
                        addr = flash.write_base;
                        size = flash.write_size;
-               } else
+               } else {
+                       unlock_kernel();
                        return -ENXIO;
+               }
        }
+       unlock_kernel();
 
        if ((vma->vm_pgoff << PAGE_SHIFT) > size)
                return -ENXIO;
@@ -121,7 +127,9 @@ flash_open(struct inode *inode, struct file *file)
 static int
 flash_release(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        flash.busy = 0;
+       unlock_kernel();
        return 0;
 }
 
index b01f26969fb5b51e44672a03163643aa96e1341a..f87850b2cf7d9ff313d88c0d47761d7dad528741 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/poll.h>
 #include <linux/init.h>
 #include <linux/string.h>
+#include <linux/smp_lock.h>
 
 /*
  * <linux/blk.h> is controlled from the outside with these definitions.
@@ -504,7 +505,9 @@ static int jsfd_open(struct inode *inode, struct file *file)
 
 static int jsf_release(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        jsf0.busy = 0;
+       unlock_kernel();
        return 0;
 }
 
index 93673e3b8a741a47bee8b47e0517a829e8fc947b..ecce4db4b658259622c83a2a1f1e9269fbd026d8 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/kbd_kern.h>
 #include <linux/delay.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 #include <linux/init.h>
 
 #include <asm/ebus.h>
@@ -745,9 +746,10 @@ static int aux_release(struct inode * inode, struct file * file)
 {
        unsigned long flags;
 
+       lock_kernel();
        aux_fasync(-1, file, 0);
        if (--aux_count)
-               return 0;
+               goto out;
 
        spin_lock_irqsave(&pcikbd_lock, flags);
 
@@ -760,6 +762,8 @@ static int aux_release(struct inode * inode, struct file * file)
        poll_aux_status();
 
        spin_unlock_irqrestore(&pcikbd_lock, flags);
+out:
+       unlock_kernel();
 
        return 0;
 }
index bda9e3a264427eca0e20a73c5106eb83f27bc770..7a02f543fd7a79a01b6e26b31dcf0267d840b5ca 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/fcntl.h>
 #include <linux/poll.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 #include <asm/mostek.h>
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -129,7 +130,9 @@ static int rtc_open(struct inode *inode, struct file *file)
 
 static int rtc_release(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        rtc_busy = 0;
+       unlock_kernel();
        return 0;
 }
 
index 8004569ab3a035904f07a350fa8e530295421e11..1911942879e04f86bd7b7f011db2760b263caa89 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/init.h>
 #include <linux/sysrq.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 #include <linux/devfs_fs_kernel.h>
 
 #include <asm/kbio.h>
@@ -1527,16 +1528,15 @@ kbd_open (struct inode *i, struct file *f)
 static int
 kbd_close (struct inode *i, struct file *f)
 {
-       if (--kbd_active)
-               return 0;
-
-       if (kbd_redirected)
-               kbd_table [kbd_redirected-1].kbdmode = VC_XLATE;
-
-       kbd_redirected = 0;
-       kbd_opened = 0;
-
-       kbd_fasync (-1, f, 0);
+       lock_kernel();
+       if (!--kbd_active) {
+               if (kbd_redirected)
+                       kbd_table [kbd_redirected-1].kbdmode = VC_XLATE;
+               kbd_redirected = 0;
+               kbd_opened = 0;
+               kbd_fasync (-1, f, 0);
+       }
+       unlock_kernel();
        return 0;
 }
 
index 46d335c2a3591bd2f4775bcf25dbae99bfda0563..b9dd25653c7bd720857f0fad9eafbfb8d584eaa0 100644 (file)
@@ -49,6 +49,7 @@
 #include <linux/mm.h>
 #include <linux/poll.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 #include <linux/init.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -411,8 +412,10 @@ static int sun_mouse_fasync (int fd, struct file *filp, int on)
 static int
 sun_mouse_close(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        sun_mouse_fasync (-1, file, 0);
        sunmouse.active--;
+       unlock_kernel();
        return 0;
 }
 
index eed298c6ea69880a96545f39c521521563306d3a..7b7a59ea2e81f25d70e225e81fc43341c2d5532c 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/fs.h>
+#include <linux/smp_lock.h>
 
 #include <asm/openprom.h>
 #include <asm/oplib.h>
@@ -203,16 +204,19 @@ static int vfc_open(struct inode *inode, struct file *file)
        return 0;
 }
 
-static void vfc_release(struct inode *inode,struct file *file) 
+static int vfc_release(struct inode *inode,struct file *file) 
 {
        struct vfc_dev *dev;
 
+       lock_kernel();
        dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
-       if (dev == NULL)
-               return;
-       if (!dev->busy)
-               return;
+       if (!dev || !dev->busy) {
+               unlock_kernel();
+               return -EINVAL;
+       }
        dev->busy = 0;
+       unlock_kernel();
+       return 0;
 }
 
 static int vfc_debug(struct vfc_dev *dev, int cmd, unsigned long arg) 
@@ -606,10 +610,12 @@ static int vfc_mmap(struct inode *inode, struct file *file,
        unsigned int map_size, ret, map_offset;
        struct vfc_dev *dev;
        
+       lock_kernel();
        dev = vfc_get_dev_ptr(MINOR(inode->i_rdev));
-       if(dev == NULL)
+       if(dev == NULL) {
+               unlock_kernel();
                return -ENODEV;
-       
+       }
        map_size = vma->vm_end - vma->vm_start;
        if(map_size > sizeof(struct vfc_regs)) 
                map_size = sizeof(struct vfc_regs);
@@ -619,6 +625,7 @@ static int vfc_mmap(struct inode *inode, struct file *file,
        map_offset = (unsigned int) (long)dev->phys_regs;
        ret = io_remap_page_range(vma->vm_start, map_offset, map_size, 
                                  vma->vm_page_prot, dev->which_io);
+       unlock_kernel();
        if(ret)
                return -EAGAIN;
 
index 4bfdc59f4f0cb9cae454c66ff7c57b6911d3b330..4ac3dbcfb473134bc74a5259bd8b88132fbb9689 100644 (file)
@@ -52,6 +52,7 @@
 #include <linux/fcntl.h>
 #include <linux/init.h>
 #include <linux/poll.h>
+#include <linux/smp_lock.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -304,8 +305,6 @@ static int sg_open(struct inode * inode, struct file * filp)
 
     if (sdp->device->host->hostt->module)
         __MOD_INC_USE_COUNT(sdp->device->host->hostt->module);
-    if (sg_template.module)
-        __MOD_INC_USE_COUNT(sg_template.module);
     return 0;
 }
 
@@ -315,8 +314,11 @@ static int sg_release(struct inode * inode, struct file * filp)
     Sg_device * sdp;
     Sg_fd * sfp;
 
-    if ((! (sfp = (Sg_fd *)filp->private_data)) || (! (sdp = sfp->parentdp)))
+    lock_kernel();
+    if ((! (sfp = (Sg_fd *)filp->private_data)) || (! (sdp = sfp->parentdp))) {
+       unlock_kernel();
         return -ENXIO;
+    }
     SCSI_LOG_TIMEOUT(3, printk("sg_release: dev=%d\n", MINOR(sdp->i_rdev)));
     sg_fasync(-1, filp, 0);   /* remove filp from async notification list */
     sg_remove_sfp(sdp, sfp);
@@ -325,10 +327,9 @@ static int sg_release(struct inode * inode, struct file * filp)
 
     if (sdp->device->host->hostt->module)
         __MOD_DEC_USE_COUNT(sdp->device->host->hostt->module);
-    if(sg_template.module)
-        __MOD_DEC_USE_COUNT(sg_template.module);
     sdp->exclude = 0;
     wake_up_interruptible(&sdp->o_excl_wait);
+    unlock_kernel();
     return 0;
 }
 
@@ -1094,13 +1095,14 @@ static void sg_cmd_done_bh(Scsi_Cmnd * SCpnt)
 }
 
 static struct file_operations sg_fops = {
-        read:          sg_read,
-        write:         sg_write,
-        poll:          sg_poll,
-        ioctl:         sg_ioctl,
-        open:          sg_open,
-        release:       sg_release,
-        fasync:        sg_fasync,
+       owner:          THIS_MODULE,
+       read:           sg_read,
+       write:          sg_write,
+       poll:           sg_poll,
+       ioctl:          sg_ioctl,
+       open:           sg_open,
+       release:        sg_release,
+       fasync:         sg_fasync,
 };
 
 
index a605233c0ccad0e2c059aa406f74ce8fe181822b..2ac10c83246f9b92ad2e86ae10e4b6abaaffae00 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/ioctl.h>
 #include <linux/fcntl.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 #include <asm/dma.h>
 #include <asm/system.h>
@@ -620,8 +621,6 @@ static int scsi_tape_open(struct inode *inode, struct file *filp)
 
        if (STp->device->host->hostt->module)
                __MOD_INC_USE_COUNT(STp->device->host->hostt->module);
-       if (st_template.module)
-               __MOD_INC_USE_COUNT(st_template.module);
 
        if (mode != STp->current_mode) {
                 DEBC(printk(ST_DEB_MSG "st%d: Mode change from %d to %d.\n",
@@ -859,8 +858,6 @@ static int scsi_tape_open(struct inode *inode, struct file *filp)
        STp->in_use = 0;
        if (STp->device->host->hostt->module)
            __MOD_DEC_USE_COUNT(STp->device->host->hostt->module);
-       if (st_template.module)
-           __MOD_DEC_USE_COUNT(st_template.module);
        return retval;
 
 }
@@ -995,6 +992,7 @@ static int scsi_tape_close(struct inode *inode, struct file *filp)
        int dev;
 
        dev = TAPE_NR(devt);
+       lock_kernel();
        read_lock(&st_dev_arr_lock);
        STp = scsi_tapes[dev];
        read_unlock(&st_dev_arr_lock);
@@ -1010,8 +1008,7 @@ static int scsi_tape_close(struct inode *inode, struct file *filp)
        STp->in_use = 0;
        if (STp->device->host->hostt->module)
                __MOD_DEC_USE_COUNT(STp->device->host->hostt->module);
-       if (st_template.module)
-               __MOD_DEC_USE_COUNT(st_template.module);
+       unlock_kernel();
 
        return result;
 }
@@ -3428,6 +3425,7 @@ __setup("st=", st_setup);
 
 static struct file_operations st_fops =
 {
+       owner:          THIS_MODULE,
        read:           st_read,
        write:          st_write,
        ioctl:          st_ioctl,
index 415fec386b3274ddcf63558fc98f27e52a37e4db..df82bfb513993c2bc80132dd2a0607fe84b88fd0 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/poll.h>
 #include <linux/rtc.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 
 #include <asm/ds1286.h>
 #include <asm/io.h>
@@ -354,7 +355,9 @@ static int ds1286_open(struct inode *inode, struct file *file)
 
 static int ds1286_release(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        ds1286_status &= ~RTC_IS_OPEN;
+       unlock_kernel();
        return 0;
 }
 
index a060e989553b4d1df078109271541567bcf6ab12..62ca3c5e60d2523bd128ce52558da7abbfe9e2bf 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/mman.h>
 #include <linux/malloc.h>
 #include <linux/module.h>
+#include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 #include "gconsole.h"
 #include "graphics.h"
@@ -194,6 +195,7 @@ sgi_graphics_close (struct inode *inode, struct file *file)
        int board = GRAPHICS_CARD (inode->i_rdev);
 
        /* Tell the rendering manager that one client is going away */
+       lock_kernel();
        rrm_close (inode, file);
 
        /* Was this file handle from the board owner?, clear it */
@@ -203,6 +205,7 @@ sgi_graphics_close (struct inode *inode, struct file *file)
                        (*cards [board].g_reset_console)();
                enable_gconsole ();
        }
+       unlock_kernel();
        return 0;
 }
 
index 03eab91e2347b107b6a5dfdd97050568f26c710c..1438030b3932d45ff703d39b72595ef8a0829922 100644 (file)
@@ -329,9 +329,12 @@ shmiq_qcntl_mmap (struct file *file, struct vm_area_struct *vma)
 
        size  = vma->vm_end - vma->vm_start;
        start = vma->vm_start; 
+       lock_kernel();
        mem = (unsigned long) shmiqs [minor].shmiq_vaddr =  vmalloc_uncached (size);
-       if (!mem)
+       if (!mem) {
+               unlock_kernel();
                return -EINVAL;
+       }
 
        /* Prevent the swapper from considering these pages for swap and touching them */
        vma->vm_flags    |= (VM_SHM  | VM_LOCKED | VM_IO);
@@ -345,6 +348,7 @@ shmiq_qcntl_mmap (struct file *file, struct vm_area_struct *vma)
        shmiqs [minor].tail = 0;
        /* Init the shared memory input queue */
        memset (shmiqs [minor].shmiq_vaddr, 0, size);
+       unlock_kernel();
        
        return error;
 }
index 1f354d80f4c90abff63560e8fc0a896e2b17b27e..1d2a65c2a2923baa55e8acdbd8d7a44612a05a60 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/sched.h>
 #include <linux/kbd_kern.h>
 #include <linux/vt_kern.h>
+#include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 #include <asm/shmiq.h>
 #include <asm/keyboard.h>
@@ -49,20 +50,6 @@ get_sioc (struct strioctl *sioc, unsigned long arg)
 }
 
 /* /dev/gfx device */
-static int
-sgi_gfx_open (struct inode *inode, struct file *file)
-{
-       printk ("GFX: Opened by %d\n", current->pid);
-       return 0;
-}
-
-static int
-sgi_gfx_close (struct inode *inode, struct file *file)
-{
-       printk ("GFX: Closed by %d\n", current->pid);
-       return 0;
-}
-
 static int
 sgi_gfx_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
 {
@@ -73,8 +60,6 @@ sgi_gfx_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigne
 
 struct file_operations sgi_gfx_fops = {
        ioctl:          sgi_gfx_ioctl,
-       open:           sgi_gfx_open,
-       release:        sgi_gfx_close,
 };
  
 static struct miscdevice dev_gfx = {
@@ -236,7 +221,9 @@ sgi_mouse_open (struct inode *inode, struct file *file)
 static int
 sgi_mouse_close (struct inode *inode, struct file *filp)
 {
+       lock_kernel();
        mouse_opened = 0;
+       unlock_kernel();
        return 0;
 }
 
index c9fbe87d49ae5337a1c96480e393614e6288b594..4ae9d2e2b2511a9a23922837ffc4ac5725b2fdbb 100644 (file)
@@ -163,17 +163,10 @@ sgi_usemaclone_open(struct inode *inode, struct file *filp)
        return 0;
 }
 
-static int
-sgi_usemaclone_release(struct inode *inode, struct file *filp)
-{
-       return 0;
-}
-
 struct file_operations sgi_usemaclone_fops = {
        poll:           sgi_usemaclone_poll,
        ioctl:          sgi_usemaclone_ioctl,
        open:           sgi_usemaclone_open,
-       release:        sgi_usemaclone_release,
 };
 
 static struct miscdevice dev_usemaclone = {
index 3b563905497f3b92a9c1e0078c9898527a2338b6..cc55d508ea25fb628c612b5b974f08ee471fb025 100644 (file)
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 #include <asm/hardirq.h>
 
@@ -1397,29 +1398,35 @@ static int cm_mmap(struct file *file, struct vm_area_struct *vma)
 {
        struct cm_state *s = (struct cm_state *)file->private_data;
        struct dmabuf *db;
-       int ret;
+       int ret = -EINVAL;
        unsigned long size;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (vma->vm_flags & VM_WRITE) {
                if ((ret = prog_dmabuf(s, 1)) != 0)
-                       return ret;
+                       goto out;
                db = &s->dma_dac;
        } else if (vma->vm_flags & VM_READ) {
                if ((ret = prog_dmabuf(s, 0)) != 0)
-                       return ret;
+                       goto out;
                db = &s->dma_adc;
        } else 
-               return -EINVAL;
+               goto out;
+       ret = -EINVAL;
        if (vma->vm_pgoff != 0)
-               return -EINVAL;
+               goto out;
        size = vma->vm_end - vma->vm_start;
        if (size > (PAGE_SIZE << db->buforder))
-               return -EINVAL;
+               goto out;
+       ret = -EAGAIN;
        if (remap_page_range(vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot))
-               return -EAGAIN;
+               goto out;
        db->mapped = 1;
-       return 0;
+       ret = 0;
+out:
+       unlock_kernel();
+       return ret;
 }
 
 static int cm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
@@ -1771,6 +1778,7 @@ static int cm_release(struct inode *inode, struct file *file)
        struct cm_state *s = (struct cm_state *)file->private_data;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (file->f_mode & FMODE_WRITE)
                drain_dac(s, file->f_flags & O_NONBLOCK);
        down(&s->open_sem);
@@ -1785,6 +1793,7 @@ static int cm_release(struct inode *inode, struct file *file)
        s->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE);
        up(&s->open_sem);
        wake_up(&s->open_wait);
+       unlock_kernel();
        return 0;
 }
 
@@ -2021,6 +2030,7 @@ static int cm_midi_release(struct inode *inode, struct file *file)
 
        VALIDATE_STATE(s);
 
+       lock_kernel();
        if (file->f_mode & FMODE_WRITE) {
                __set_current_state(TASK_INTERRUPTIBLE);
                add_wait_queue(&s->midi.owait, &wait);
@@ -2058,6 +2068,7 @@ static int cm_midi_release(struct inode *inode, struct file *file)
        spin_unlock_irqrestore(&s->lock, flags);
        up(&s->open_sem);
        wake_up(&s->open_wait);
+       unlock_kernel();
        return 0;
 }
 
@@ -2212,6 +2223,7 @@ static int cm_dmfm_release(struct inode *inode, struct file *file)
        unsigned int regb;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        down(&s->open_sem);
        s->open_mode &= ~FMODE_DMFM;
        for (regb = 0xb0; regb < 0xb9; regb++) {
@@ -2222,6 +2234,7 @@ static int cm_dmfm_release(struct inode *inode, struct file *file)
        }
        up(&s->open_sem);
        wake_up(&s->open_wait);
+       unlock_kernel();
        return 0;
 }
 
index da60c783b70b69395183cd72ec4d9db79b52cc21..1d8804b368ea4f6a457a5e79ea5762ca7017093c 100644 (file)
 #include <linux/sound.h>
 #include <linux/init.h>
 #include <linux/soundcard.h>
+#include <linux/smp_lock.h>
 
 #include <asm/uaccess.h>
 
@@ -501,8 +502,10 @@ static int mixer_open(struct inode *inode, struct file *file)
 
 static int mixer_release(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        mixer.busy = 0;
        dmasound.mach.release();
+       unlock_kernel();
        return 0;
 }
 static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd,
@@ -905,6 +908,7 @@ static int sq_release(struct inode *inode, struct file *file)
 {
        int rc = 0;
 
+       lock_kernel();
        if (write_sq.busy)
                rc = sq_fsync(file, file->f_dentry);
        dmasound.soft = dmasound.dsp;
@@ -923,6 +927,7 @@ static int sq_release(struct inode *inode, struct file *file)
        /* Wake up a process waiting for the queue being released.
         * Note: There may be several processes waiting for a call
         * to open() returning. */
+       unlock_kernel();
 
        return rc;
 }
@@ -1141,8 +1146,10 @@ static int state_open(struct inode *inode, struct file *file)
 
 static int state_release(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        state.busy = 0;
        dmasound.mach.release();
+       unlock_kernel();
        return 0;
 }
 
index 06f84dfc3ee621d4d5051aea4d0259be33269e89..9e2ee24d1556187b8f01462922cabd1ca2d95c74 100644 (file)
@@ -36,6 +36,8 @@
 #include "cardwi.h"
 #include "recmgr.h"
 #include "audio.h"
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
 
 static void calculate_ofrag(struct woinst *);
 static void calculate_ifrag(struct wiinst *);
@@ -890,6 +892,7 @@ static int emu10k1_audio_mmap(struct file *file, struct vm_area_struct *vma)
        if (vma_get_pgoff(vma) != 0)
                return -ENXIO;
 
+       lock_kernel();
        if (vma->vm_flags & VM_WRITE) {
                struct woinst *woinst = wave_dev->woinst;
                struct wave_out *wave_out;
@@ -907,6 +910,7 @@ static int emu10k1_audio_mmap(struct file *file, struct vm_area_struct *vma)
                        if (emu10k1_waveout_open(wave_dev) != CTSTATUS_SUCCESS) {
                                spin_unlock_irqrestore(&woinst->lock, flags);
                                ERROR();
+                               unlock_kernel();
                                return -EINVAL;
                        }
 
@@ -921,12 +925,14 @@ static int emu10k1_audio_mmap(struct file *file, struct vm_area_struct *vma)
 
                if (size > (PAGE_SIZE * wave_out->wavexferbuf->numpages)) {
                        spin_unlock_irqrestore(&woinst->lock, flags);
+                       unlock_kernel();
                        return -EINVAL;
                }
 
                for (i = 0; i < wave_out->wavexferbuf->numpages; i++) {
                        if (remap_page_range(vma->vm_start + (i * PAGE_SIZE), virt_to_phys(wave_out->pagetable[i]), PAGE_SIZE, vma->vm_page_prot)) {
                                spin_unlock_irqrestore(&woinst->lock, flags);
+                               unlock_kernel();
                                return -EAGAIN;
                        }
                }
@@ -944,6 +950,7 @@ static int emu10k1_audio_mmap(struct file *file, struct vm_area_struct *vma)
                wiinst->mapped = 1;
                spin_unlock_irqrestore(&wiinst->lock, flags);
        }
+       unlock_kernel();
 
        return 0;
 }
@@ -1098,9 +1105,11 @@ static int emu10k1_audio_open(struct inode *inode, struct file *file)
 static int emu10k1_audio_release(struct inode *inode, struct file *file)
 {
        struct emu10k1_wavedevice *wave_dev = (struct emu10k1_wavedevice *) file->private_data;
-       struct emu10k1_card *card = wave_dev->card;
+       struct emu10k1_card *card;
        unsigned long flags;
 
+       lock_kernel();
+       card = wave_dev->card;
        DPF(2, "emu10k1_audio_release()\n");
 
        if (file->f_mode & FMODE_WRITE) {
@@ -1171,6 +1180,7 @@ static int emu10k1_audio_release(struct inode *inode, struct file *file)
        kfree(wave_dev);
 
        wake_up_interruptible(&card->open_wait);
+       unlock_kernel();
 
        return 0;
 }
index 04b1424a8a15e240601b9b13621a43793f88bddf..d7e0a4a8771a942ac481589d7b92f50a17a498c2 100644 (file)
@@ -32,6 +32,8 @@
 
 #define __NO_VERSION__
 #include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 
 #include "hwaccess.h"
@@ -183,8 +185,10 @@ static int emu10k1_midi_open(struct inode *inode, struct file *file)
 static int emu10k1_midi_release(struct inode *inode, struct file *file)
 {
        struct emu10k1_mididevice *midi_dev = (struct emu10k1_mididevice *) file->private_data;
-       struct emu10k1_card *card = midi_dev->card;
+       struct emu10k1_card *card;
 
+       lock_kernel();
+       card = midi_dev->card;
        DPF(2, "emu10k1_midi_release()\n");
 
        if (file->f_mode & FMODE_WRITE) {
@@ -227,6 +231,7 @@ static int emu10k1_midi_release(struct inode *inode, struct file *file)
        card->open_mode &= ~((file->f_mode << FMODE_MIDI_SHIFT) & (FMODE_MIDI_READ | FMODE_MIDI_WRITE));
        up(&card->open_sem);
        wake_up_interruptible(&card->open_wait);
+       unlock_kernel();
 
        return 0;
 }
index 47d1d875f5321d2a9c41224441193e27404c86ad..ae004f10f653818041685cef8351c669163e1d2d 100644 (file)
 #include <linux/malloc.h>
 #include <linux/soundcard.h>
 #include <linux/pci.h>
+#include <linux/smp_lock.h>
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <linux/init.h>
@@ -1306,24 +1307,38 @@ static int es1370_mmap(struct file *file, struct vm_area_struct *vma)
        unsigned long size;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (vma->vm_flags & VM_WRITE) {
-               if ((ret = prog_dmabuf_dac2(s)) != 0)
+               if ((ret = prog_dmabuf_dac2(s)) != 0) {
+                       unlock_kernel();
                        return ret;
+               }
                db = &s->dma_dac2;
        } else if (vma->vm_flags & VM_READ) {
-               if ((ret = prog_dmabuf_adc(s)) != 0)
+               if ((ret = prog_dmabuf_adc(s)) != 0) {
+                       unlock_kernel();
                        return ret;
+               }
                db = &s->dma_adc;
-       } else 
+       } else  {
+               unlock_kernel();
                return -EINVAL;
-       if (vma->vm_pgoff != 0)
+       }
+       if (vma->vm_pgoff != 0) {
+               unlock_kernel();
                return -EINVAL;
+       }
        size = vma->vm_end - vma->vm_start;
-       if (size > (PAGE_SIZE << db->buforder))
+       if (size > (PAGE_SIZE << db->buforder)) {
+               unlock_kernel();
                return -EINVAL;
-       if (remap_page_range(vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot))
+       }
+       if (remap_page_range(vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot)) {
+               unlock_kernel();
                return -EAGAIN;
+       }
        db->mapped = 1;
+       unlock_kernel();
        return 0;
 }
 
@@ -1717,6 +1732,7 @@ static int es1370_release(struct inode *inode, struct file *file)
        struct es1370_state *s = (struct es1370_state *)file->private_data;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (file->f_mode & FMODE_WRITE)
                drain_dac2(s, file->f_flags & O_NONBLOCK);
        down(&s->open_sem);
@@ -1733,6 +1749,7 @@ static int es1370_release(struct inode *inode, struct file *file)
        wake_up(&s->open_wait);
        up(&s->open_sem);
        return 0;
+       unlock_kernel();
 }
 
 static /*const*/ struct file_operations es1370_audio_fops = {
@@ -1850,17 +1867,23 @@ static int es1370_mmap_dac(struct file *file, struct vm_area_struct *vma)
        VALIDATE_STATE(s);
        if (!(vma->vm_flags & VM_WRITE))
                return -EINVAL;
+       lock_kernel();
        if ((ret = prog_dmabuf_dac1(s)) != 0)
-               return ret;
+               goto out;
+       ret = -EINVAL;
        if (vma->vm_pgoff != 0)
-               return -EINVAL;
+               goto out;
        size = vma->vm_end - vma->vm_start;
        if (size > (PAGE_SIZE << s->dma_dac1.buforder))
-               return -EINVAL;
+               goto out;
+       ret = -EAGAIN;
        if (remap_page_range(vma->vm_start, virt_to_phys(s->dma_dac1.rawbuf), size, vma->vm_page_prot))
-               return -EAGAIN;
+               goto out;
        s->dma_dac1.mapped = 1;
-       return 0;
+       ret = 0;
+out:
+       unlock_kernel();
+       return ret;
 }
 
 static int es1370_ioctl_dac(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
@@ -2122,6 +2145,7 @@ static int es1370_release_dac(struct inode *inode, struct file *file)
        struct es1370_state *s = (struct es1370_state *)file->private_data;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        drain_dac1(s, file->f_flags & O_NONBLOCK);
        down(&s->open_sem);
        stop_dac1(s);
@@ -2129,6 +2153,7 @@ static int es1370_release_dac(struct inode *inode, struct file *file)
        s->open_mode &= ~FMODE_DAC;
        wake_up(&s->open_wait);
        up(&s->open_sem);
+       unlock_kernel();
        return 0;
 }
 
@@ -2366,6 +2391,7 @@ static int es1370_midi_release(struct inode *inode, struct file *file)
 
        VALIDATE_STATE(s);
 
+       lock_kernel();
        if (file->f_mode & FMODE_WRITE) {
                add_wait_queue(&s->midi.owait, &wait);
                for (;;) {
@@ -2399,6 +2425,7 @@ static int es1370_midi_release(struct inode *inode, struct file *file)
        spin_unlock_irqrestore(&s->lock, flags);
        wake_up(&s->open_wait);
        up(&s->open_sem);
+       unlock_kernel();
        return 0;
 }
 
index 109ac71c0224207e668cfbefeeaec9e93783089e..58d7923aba7bbc5574d17082e946cd59eb0cb7a1 100644 (file)
 #include <linux/bitops.h>
 #include <linux/proc_fs.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 #include <linux/ac97_codec.h>
 #include <asm/io.h>
 #include <asm/dma.h>
@@ -1494,24 +1495,38 @@ static int es1371_mmap(struct file *file, struct vm_area_struct *vma)
        unsigned long size;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (vma->vm_flags & VM_WRITE) {
-               if ((ret = prog_dmabuf_dac2(s)) != 0)
+               if ((ret = prog_dmabuf_dac2(s)) != 0) {
+                       unlock_kernel();
                        return ret;
+               }
                db = &s->dma_dac2;
        } else if (vma->vm_flags & VM_READ) {
-               if ((ret = prog_dmabuf_adc(s)) != 0)
+               if ((ret = prog_dmabuf_adc(s)) != 0) {
+                       unlock_kernel();
                        return ret;
+               }
                db = &s->dma_adc;
-       } else 
+       } else {
+               unlock_kernel();
                return -EINVAL;
-       if (vma->vm_pgoff != 0)
+       }
+       if (vma->vm_pgoff != 0) {
+               unlock_kernel();
                return -EINVAL;
+       }
        size = vma->vm_end - vma->vm_start;
-       if (size > (PAGE_SIZE << db->buforder))
+       if (size > (PAGE_SIZE << db->buforder)) {
+               unlock_kernel();
                return -EINVAL;
-       if (remap_page_range(vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot))
+       }
+       if (remap_page_range(vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot)) {
+               unlock_kernel();
                return -EAGAIN;
+       }
        db->mapped = 1;
+       unlock_kernel();
        return 0;
 }
 
@@ -1903,6 +1918,7 @@ static int es1371_release(struct inode *inode, struct file *file)
        struct es1371_state *s = (struct es1371_state *)file->private_data;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (file->f_mode & FMODE_WRITE)
                drain_dac2(s, file->f_flags & O_NONBLOCK);
        down(&s->open_sem);
@@ -1917,6 +1933,7 @@ static int es1371_release(struct inode *inode, struct file *file)
        s->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE);
        up(&s->open_sem);
        wake_up(&s->open_wait);
+       unlock_kernel();
        return 0;
 }
 
@@ -2035,17 +2052,23 @@ static int es1371_mmap_dac(struct file *file, struct vm_area_struct *vma)
        VALIDATE_STATE(s);
        if (!(vma->vm_flags & VM_WRITE))
                return -EINVAL;
+       lock_kernel();
        if ((ret = prog_dmabuf_dac1(s)) != 0)
-               return ret;
+               goto out;
+       ret = -EINVAL;
        if (vma->vm_pgoff != 0)
-               return -EINVAL;
+               goto out;
        size = vma->vm_end - vma->vm_start;
        if (size > (PAGE_SIZE << s->dma_dac1.buforder))
-               return -EINVAL;
+               goto out;
+       ret = -EAGAIN;
        if (remap_page_range(vma->vm_start, virt_to_phys(s->dma_dac1.rawbuf), size, vma->vm_page_prot))
-               return -EAGAIN;
+               goto out;
        s->dma_dac1.mapped = 1;
-       return 0;
+       ret = 0;
+out:
+       unlock_kernel();
+       return ret;
 }
 
 static int es1371_ioctl_dac(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
@@ -2297,6 +2320,7 @@ static int es1371_release_dac(struct inode *inode, struct file *file)
        struct es1371_state *s = (struct es1371_state *)file->private_data;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        drain_dac1(s, file->f_flags & O_NONBLOCK);
        down(&s->open_sem);
        stop_dac1(s);
@@ -2304,6 +2328,7 @@ static int es1371_release_dac(struct inode *inode, struct file *file)
        s->open_mode &= ~FMODE_DAC;
        up(&s->open_sem);
        wake_up(&s->open_wait);
+       unlock_kernel();
        return 0;
 }
 
@@ -2540,6 +2565,7 @@ static int es1371_midi_release(struct inode *inode, struct file *file)
        unsigned count, tmo;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (file->f_mode & FMODE_WRITE) {
                add_wait_queue(&s->midi.owait, &wait);
                for (;;) {
@@ -2573,6 +2599,7 @@ static int es1371_midi_release(struct inode *inode, struct file *file)
        spin_unlock_irqrestore(&s->lock, flags);
        up(&s->open_sem);
        wake_up(&s->open_wait);
+       unlock_kernel();
        return 0;
 }
 
index cfc89d3ee32269496a91b19b63565890629f2ca5..e2e0c3b123d3f9a17599127eb857649aa6da7981 100644 (file)
@@ -90,6 +90,7 @@
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 #include <asm/hardirq.h>
 
@@ -1192,29 +1193,35 @@ static int solo1_mmap(struct file *file, struct vm_area_struct *vma)
 {
        struct solo1_state *s = (struct solo1_state *)file->private_data;
        struct dmabuf *db;
-       int ret;
+       int ret = -EINVAL;
        unsigned long size;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (vma->vm_flags & VM_WRITE) {
                if ((ret = prog_dmabuf_dac(s)) != 0)
-                       return ret;
+                       goto out;
                db = &s->dma_dac;
        } else if (vma->vm_flags & VM_READ) {
                if ((ret = prog_dmabuf_adc(s)) != 0)
-                       return ret;
+                       goto out;
                db = &s->dma_adc;
        } else 
-               return -EINVAL;
+               goto out;
+       ret = -EINVAL;
        if (vma->vm_pgoff != 0)
-               return -EINVAL;
+               goto out;
        size = vma->vm_end - vma->vm_start;
        if (size > (PAGE_SIZE << db->buforder))
-               return -EINVAL;
+               goto out;
+       ret = -EAGAIN;
        if (remap_page_range(vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot))
-               return -EAGAIN;
+               goto out;
        db->mapped = 1;
-       return 0;
+       ret = 0;
+out:
+       unlock_kernel();
+       return ret;
 }
 
 static int solo1_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
@@ -1510,6 +1517,7 @@ static int solo1_release(struct inode *inode, struct file *file)
        struct solo1_state *s = (struct solo1_state *)file->private_data;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (file->f_mode & FMODE_WRITE)
                drain_dac(s, file->f_flags & O_NONBLOCK);
        down(&s->open_sem);
@@ -1527,6 +1535,7 @@ static int solo1_release(struct inode *inode, struct file *file)
        s->open_mode &= ~(FMODE_READ | FMODE_WRITE);
        wake_up(&s->open_wait);
        up(&s->open_sem);
+       unlock_kernel();
        return 0;
 }
 
@@ -1881,6 +1890,7 @@ static int solo1_midi_release(struct inode *inode, struct file *file)
 
        VALIDATE_STATE(s);
 
+       lock_kernel();
        if (file->f_mode & FMODE_WRITE) {
                add_wait_queue(&s->midi.owait, &wait);
                for (;;) {
@@ -1914,6 +1924,7 @@ static int solo1_midi_release(struct inode *inode, struct file *file)
        spin_unlock_irqrestore(&s->lock, flags);
        wake_up(&s->open_wait);
        up(&s->open_sem);
+       unlock_kernel();
        return 0;
 }
 
@@ -2083,6 +2094,7 @@ static int solo1_dmfm_release(struct inode *inode, struct file *file)
        unsigned int regb;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        down(&s->open_sem);
        s->open_mode &= ~FMODE_DMFM;
        for (regb = 0xb0; regb < 0xb9; regb++) {
@@ -2094,6 +2106,7 @@ static int solo1_dmfm_release(struct inode *inode, struct file *file)
        release_region(s->sbbase, FMSYNTH_EXTENT);
        wake_up(&s->open_wait);
        up(&s->open_sem);
+       unlock_kernel();
        return 0;
 }
 
index f04636a65bfb17e475aa1794197253196539d082..792f670af2b68f66b58875376abbfbabc57d8dc9 100644 (file)
@@ -76,6 +76,7 @@
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 #include <linux/ac97_codec.h>
 #include <asm/uaccess.h>
 #include <asm/hardirq.h>
@@ -1227,29 +1228,34 @@ static int i810_mmap(struct file *file, struct vm_area_struct *vma)
 {
        struct i810_state *state = (struct i810_state *)file->private_data;
        struct dmabuf *dmabuf = &state->dmabuf;
-       int ret;
+       int ret = -EINVAL;
        unsigned long size;
 
+       lock_kernel();
        if (vma->vm_flags & VM_WRITE) {
                if ((ret = prog_dmabuf(state, 0)) != 0)
-                       return ret;
+                       goto out;
        } else if (vma->vm_flags & VM_READ) {
                if ((ret = prog_dmabuf(state, 1)) != 0)
-                       return ret;
+                       goto out;
        } else 
-               return -EINVAL;
+               goto out;
 
+       ret = -EINVAL;
        if (vma->vm_pgoff != 0)
-               return -EINVAL;
+               goto out;
        size = vma->vm_end - vma->vm_start;
        if (size > (PAGE_SIZE << dmabuf->buforder))
-               return -EINVAL;
+               goto out;
+       ret = -EAGAIN;
        if (remap_page_range(vma->vm_start, virt_to_phys(dmabuf->rawbuf),
                             size, vma->vm_page_prot))
-               return -EAGAIN;
+               goto out;
        dmabuf->mapped = 1;
-
-       return 0;
+       ret = 0;
+out:
+       unlock_kernel();
+       return ret;
 }
 
 static int i810_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
@@ -1608,6 +1614,7 @@ static int i810_release(struct inode *inode, struct file *file)
        struct i810_state *state = (struct i810_state *)file->private_data;
        struct dmabuf *dmabuf = &state->dmabuf;
 
+       lock_kernel();
        if (file->f_mode & FMODE_WRITE) {
                i810_clear_tail(state);
                drain_dac(state, file->f_flags & O_NONBLOCK);
@@ -1632,6 +1639,7 @@ static int i810_release(struct inode *inode, struct file *file)
        
        kfree(state->card->states[state->virt]);
        state->card->states[state->virt] = NULL;
+       unlock_kernel();
 
        return 0;
 }
index cd5a2bc2719e577368251a7afe66367b9b7272e1..cc54f784ceb21d7d19866779010802d09263c461 100644 (file)
 
 #include <linux/version.h>
 #include <linux/module.h>
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
 
@@ -2422,13 +2424,14 @@ static int ess_mmap(struct file *file, struct vm_area_struct *vma)
 {
        struct ess_state *s = (struct ess_state *)file->private_data;
        struct dmabuf *db;
-       int ret;
+       int ret = -EINVAL;
        unsigned long size;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (vma->vm_flags & VM_WRITE) {
                if ((ret = prog_dmabuf(s, 1)) != 0)
-                       return ret;
+                       goto out;
                db = &s->dma_dac;
        } else 
 #if 0
@@ -2436,20 +2439,25 @@ static int ess_mmap(struct file *file, struct vm_area_struct *vma)
                we can turn this back on.  */
              if (vma->vm_flags & VM_READ) {
                if ((ret = prog_dmabuf(s, 0)) != 0)
-                       return ret;
+                       goto out;
                db = &s->dma_adc;
        } else  
 #endif
-               return -EINVAL;
+               goto out;
+       ret = -EINVAL;
        if (SILLY_OFFSET(vma) != 0)
-               return -EINVAL;
+               goto out;
        size = vma->vm_end - vma->vm_start;
        if (size > (PAGE_SIZE << db->buforder))
-               return -EINVAL;
+               goto out;
+       ret = -EAGAIN;
        if (remap_page_range(vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot))
-               return -EAGAIN;
+               goto out;
        db->mapped = 1;
-       return 0;
+       ret = 0;
+out:
+       unlock_kernel();
+       return ret;
 }
 
 static int ess_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
@@ -2985,6 +2993,7 @@ ess_release(struct inode *inode, struct file *file)
        struct ess_state *s = (struct ess_state *)file->private_data;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (file->f_mode & FMODE_WRITE)
                drain_dac(s, file->f_flags & O_NONBLOCK);
        down(&s->open_sem);
@@ -3006,6 +3015,7 @@ ess_release(struct inode *inode, struct file *file)
        }
        up(&s->open_sem);
        wake_up(&s->open_wait);
+       unlock_kernel();
        return 0;
 }
 
index 219a6bfe01f35edf1b2f375f6bd8ededd760f02d..7b361921e6d08f66d325be592a53728d2e726d11 100644 (file)
 #  define inb                  inb_p
 #endif
 
-#ifdef LINUX20
-#  define __initfunc(f)                                f
-#  define __initdata                           /* nothing */
-#  define spin_lock_irqsave(junk,flags)                do { save_flags(flags); cli(); } while (0)
-#  define spin_unlock_irqrestore(junk,flags)   do { restore_flags(flags); } while (0)
-#endif
-
 /* JobQueueStruct */
 #define JQS_wStart             0x00
 #define JQS_wSize              0x02
@@ -236,9 +229,7 @@ typedef struct multisound_dev {
        wait_queue_head_t writeblock;
        wait_queue_head_t readblock;
        wait_queue_head_t writeflush;
-#ifndef LINUX20
        spinlock_t lock;
-#endif
        int nresets;
        unsigned long recsrc;
        int left_levels[16];
@@ -250,8 +241,6 @@ typedef struct multisound_dev {
        int rec_sample_size, rec_sample_rate, rec_channels;
        int rec_ndelay;
        BYTE bCurrentMidiPatch;
-       void (*inc_ref)(void);
-       void (*dec_ref)(void);
 
        /* Digital audio FIFOs */
        msnd_fifo DAPF, DARF;
index b220433ce8041105d503ad21f5ccae9ac2b9a895..91c7d23066f1915813267b8033f1e03091ba9686 100644 (file)
 
 #include <linux/config.h>
 #include <linux/version.h>
-#if LINUX_VERSION_CODE < 0x020101
-#  define LINUX20
-#endif
 #include <linux/module.h>
 #include <linux/malloc.h>
 #include <linux/types.h>
 #include <linux/delay.h>
-#ifndef LINUX20
-#  include <linux/init.h>
-#endif
+#include <linux/init.h>
+#include <linux/smp_lock.h>
 #include <asm/irq.h>
 #include <asm/io.h>
 #include "sound_config.h"
@@ -747,16 +743,6 @@ static void set_default_audio_parameters(void)
        set_default_rec_audio_parameters();
 }
 
-static void mod_inc_ref(void)
-{
-       MOD_INC_USE_COUNT;
-}
-
-static void mod_dec_ref(void)
-{
-       MOD_DEC_USE_COUNT;
-}
-
 static int dev_open(struct inode *inode, struct file *file)
 {
        int minor = MINOR(inode->i_rdev);
@@ -789,43 +775,23 @@ static int dev_open(struct inode *inode, struct file *file)
        } else
                err = -EINVAL;
 
-       if (err >= 0)
-               mod_inc_ref();
-
        return err;
 }
 
-#ifdef LINUX20
-static void dev_release(struct inode *inode, struct file *file)
-#else
 static int dev_release(struct inode *inode, struct file *file)
-#endif
 {
        int minor = MINOR(inode->i_rdev);
-#ifndef LINUX20
        int err = 0;
-#endif
 
-       if (minor == dev.dsp_minor) {
-#ifndef LINUX20
-               err = 
-#endif
-                       dsp_release(file);
-       }
+       lock_kernel();
+       if (minor == dev.dsp_minor)
+               err = dsp_release(file);
        else if (minor == dev.mixer_minor) {
                /* nothing */
-       }
-#ifndef LINUX20
-       else
+       } else
                err = -EINVAL;
-
-       if (err >= 0)
-#endif
-               mod_dec_ref();
-
-#ifndef LINUX20        
+       unlock_kernel();
        return err;
-#endif
 }
 
 static __inline__ int pack_DARQ_to_DARF(register int bank)
@@ -1002,30 +968,18 @@ static int dsp_write(const char *buf, size_t len)
        return len - count;
 }
 
-#ifdef LINUX20
-static int dev_read(struct inode *inode, struct file *file, char *buf, int count)
-{
-       int minor = MINOR(inode->i_rdev);
-#else
 static ssize_t dev_read(struct file *file, char *buf, size_t count, loff_t *off)
 {
        int minor = MINOR(file->f_dentry->d_inode->i_rdev);
-#endif
        if (minor == dev.dsp_minor)
                return dsp_read(buf, count);
        else
                return -EINVAL;
 }
 
-#ifdef LINUX20
-static int dev_write(struct inode *inode, struct file *file, const char *buf, int count)
-{
-       int minor = MINOR(inode->i_rdev);
-#else
 static ssize_t dev_write(struct file *file, const char *buf, size_t count, loff_t *off)
 {
        int minor = MINOR(file->f_dentry->d_inode->i_rdev);
-#endif
        if (minor == dev.dsp_minor)
                return dsp_write(buf, count);
        else
@@ -1042,15 +996,8 @@ static __inline__ void eval_dsp_msg(register WORD wMessage)
 
                if (pack_DAPF_to_DAPQ(0) <= 0) {
                        if (!test_bit(F_WRITEBLOCK, &dev.flags)) {
-#ifdef LINUX20
-                               if (test_bit(F_WRITEFLUSH, &dev.flags)) {
-                                       clear_bit(F_WRITEFLUSH, &dev.flags);
-                                       wake_up_interruptible(&dev.writeflush);
-                               }
-#else
                                if (test_and_clear_bit(F_WRITEFLUSH, &dev.flags))
                                        wake_up_interruptible(&dev.writeflush);
-#endif
                        }
                        clear_bit(F_WRITING, &dev.flags);
                }
@@ -1122,6 +1069,7 @@ static void intr(int irq, void *dev_id, struct pt_regs *regs)
 }
 
 static struct file_operations dev_fileops = {
+       owner:          THIS_MODULE,
        read:           dev_read,
        write:          dev_write,
        ioctl:          dev_ioctl,
@@ -1881,8 +1829,6 @@ int __init msnd_pinnacle_init(void)
        dev.recsrc = 0;
        dev.dspq_data_buff = DSPQ_DATA_BUFF;
        dev.dspq_buff_size = DSPQ_BUFF_SIZE;
-       dev.inc_ref = mod_inc_ref;
-       dev.dec_ref = mod_dec_ref;
        if (write_ndelay == -1)
                write_ndelay = CONFIG_MSND_WRITE_NDELAY;
        if (write_ndelay)
@@ -1898,9 +1844,7 @@ int __init msnd_pinnacle_init(void)
        init_waitqueue_head(&dev.writeflush);
        msnd_fifo_init(&dev.DAPF);
        msnd_fifo_init(&dev.DARF);
-#ifndef LINUX20
        spin_lock_init(&dev.lock);
-#endif
        printk(KERN_INFO LOGNAME ": %u byte audio FIFOs (x2)\n", dev.fifosize);
        if ((err = msnd_fifo_alloc(&dev.DAPF, dev.fifosize)) < 0) {
                printk(KERN_ERR LOGNAME ": Couldn't allocate write FIFO\n");
index c9c66a73f0ec7be9599d90b39d46c5ca393dfae7..8a082552a922ee8730b823cab86810679f7b235f 100644 (file)
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 #include <asm/uaccess.h>
 #include <asm/hardirq.h>
 
@@ -1509,29 +1510,35 @@ static int sv_mmap(struct file *file, struct vm_area_struct *vma)
 {
        struct sv_state *s = (struct sv_state *)file->private_data;
        struct dmabuf *db;
-       int ret;
+       int ret = -EINVAL;
        unsigned long size;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (vma->vm_flags & VM_WRITE) {
                if ((ret = prog_dmabuf(s, 1)) != 0)
-                       return ret;
+                       goto out;
                db = &s->dma_dac;
        } else if (vma->vm_flags & VM_READ) {
                if ((ret = prog_dmabuf(s, 0)) != 0)
-                       return ret;
+                       goto out;
                db = &s->dma_adc;
        } else 
-               return -EINVAL;
+               goto out;
+       ret = -EINVAL;
        if (vma->vm_pgoff != 0)
-               return -EINVAL;
+               goto out;
        size = vma->vm_end - vma->vm_start;
        if (size > (PAGE_SIZE << db->buforder))
-               return -EINVAL;
+               goto out;
+       ret = -EAGAIN;
        if (remap_page_range(vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot))
-               return -EAGAIN;
+               goto out;
        db->mapped = 1;
-       return 0;
+       ret = 0;
+out:
+       unlock_kernel();
+       return ret;
 }
 
 static int sv_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
@@ -1907,6 +1914,7 @@ static int sv_release(struct inode *inode, struct file *file)
        struct sv_state *s = (struct sv_state *)file->private_data;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        if (file->f_mode & FMODE_WRITE)
                drain_dac(s, file->f_flags & O_NONBLOCK);
        down(&s->open_sem);
@@ -1921,6 +1929,7 @@ static int sv_release(struct inode *inode, struct file *file)
        s->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE);
        wake_up(&s->open_wait);
        up(&s->open_sem);
+       unlock_kernel();
        return 0;
 }
 
@@ -2167,6 +2176,7 @@ static int sv_midi_release(struct inode *inode, struct file *file)
 
        VALIDATE_STATE(s);
 
+       lock_kernel();
        if (file->f_mode & FMODE_WRITE) {
                add_wait_queue(&s->midi.owait, &wait);
                for (;;) {
@@ -2200,6 +2210,7 @@ static int sv_midi_release(struct inode *inode, struct file *file)
        spin_unlock_irqrestore(&s->lock, flags);
        wake_up(&s->open_wait);
        up(&s->open_sem);
+       unlock_kernel();
        return 0;
 }
 
@@ -2363,6 +2374,7 @@ static int sv_dmfm_release(struct inode *inode, struct file *file)
        unsigned int regb;
 
        VALIDATE_STATE(s);
+       lock_kernel();
        down(&s->open_sem);
        s->open_mode &= ~FMODE_DMFM;
        for (regb = 0xb0; regb < 0xb9; regb++) {
@@ -2373,6 +2385,7 @@ static int sv_dmfm_release(struct inode *inode, struct file *file)
        }
        wake_up(&s->open_wait);
        up(&s->open_sem);
+       unlock_kernel();
        return 0;
 }
 
index 0351fe7ce0d665375abd8d70f6682bbf35520a71..d56b8f77f6939d557b9ec511d501835e2df8b56e 100644 (file)
@@ -270,6 +270,7 @@ static int sound_release(struct inode *inode, struct file *file)
 {
        int dev = MINOR(inode->i_rdev);
 
+       lock_kernel();
        DEB(printk("sound_release(dev=%d)\n", dev));
        switch (dev & 0x0f) {
        case SND_DEV_CTL:
@@ -297,6 +298,7 @@ static int sound_release(struct inode *inode, struct file *file)
 
        notifier_call_chain(&sound_locker, 0, 0);
        lock_depth--;
+       unlock_kernel();
 
        return 0;
 }
@@ -449,29 +451,35 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma)
                printk(KERN_ERR "Sound: mmap() not supported for other than audio devices\n");
                return -EINVAL;
        }
+       lock_kernel();
        if (vma->vm_flags & VM_WRITE)   /* Map write and read/write to the output buf */
                dmap = audio_devs[dev]->dmap_out;
        else if (vma->vm_flags & VM_READ)
                dmap = audio_devs[dev]->dmap_in;
        else {
                printk(KERN_ERR "Sound: Undefined mmap() access\n");
+               unlock_kernel();
                return -EINVAL;
        }
 
        if (dmap == NULL) {
                printk(KERN_ERR "Sound: mmap() error. dmap == NULL\n");
+               unlock_kernel();
                return -EIO;
        }
        if (dmap->raw_buf == NULL) {
                printk(KERN_ERR "Sound: mmap() called when raw_buf == NULL\n");
+               unlock_kernel();
                return -EIO;
        }
        if (dmap->mapping_flags) {
                printk(KERN_ERR "Sound: mmap() called twice for the same DMA buffer\n");
+               unlock_kernel();
                return -EIO;
        }
        if (vma->vm_pgoff != 0) {
                printk(KERN_ERR "Sound: mmap() offset must be 0.\n");
+               unlock_kernel();
                return -EINVAL;
        }
        size = vma->vm_end - vma->vm_start;
@@ -481,8 +489,10 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma)
        }
        if (remap_page_range(vma->vm_start, virt_to_phys(dmap->raw_buf),
                vma->vm_end - vma->vm_start,
-               vma->vm_page_prot))
+               vma->vm_page_prot)) {
+               unlock_kernel();
                return -EAGAIN;
+       }
 
        dmap->mapping_flags |= DMA_MAP_MAPPED;
 
@@ -492,6 +502,7 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma)
        memset(dmap->raw_buf,
               dmap->neutral_byte,
               dmap->bytes_in_use);
+       unlock_kernel();
        return 0;
 }
 
index 6e2b70791525daad498ffb1411c3818ce0a694c6..386309d0756985d8cf6ddd0cb64455e46ed4ae36 100644 (file)
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 #include <linux/ac97_codec.h>
 #include <asm/uaccess.h>
 #include <asm/hardirq.h>
@@ -1560,30 +1561,35 @@ static int trident_mmap(struct file *file, struct vm_area_struct *vma)
 {
        struct trident_state *state = (struct trident_state *)file->private_data;
        struct dmabuf *dmabuf = &state->dmabuf;
-       int ret;
+       int ret = -EINVAL;
        unsigned long size;
 
        VALIDATE_STATE(state);
+       lock_kernel();
        if (vma->vm_flags & VM_WRITE) {
                if ((ret = prog_dmabuf(state, 0)) != 0)
-                       return ret;
+                       goto out;
        } else if (vma->vm_flags & VM_READ) {
                if ((ret = prog_dmabuf(state, 1)) != 0)
-                       return ret;
-       } else 
-               return -EINVAL;
+                       goto out;
+       } else
+               goto out;
 
+       ret = -EINVAL;
        if (vma->vm_pgoff != 0)
-               return -EINVAL;
+               goto out;
        size = vma->vm_end - vma->vm_start;
        if (size > (PAGE_SIZE << dmabuf->buforder))
-               return -EINVAL;
+               goto out;
+       ret = -EAGAIN;
        if (remap_page_range(vma->vm_start, virt_to_phys(dmabuf->rawbuf),
                             size, vma->vm_page_prot))
-               return -EAGAIN;
+               goto out;
        dmabuf->mapped = 1;
-
-       return 0;
+       ret = 0;
+out;
+       unlock_kernel();
+       return ret;
 }
 
 static int trident_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
@@ -2009,9 +2015,12 @@ static int trident_open(struct inode *inode, struct file *file)
 static int trident_release(struct inode *inode, struct file *file)
 {
        struct trident_state *state = (struct trident_state *)file->private_data;
-       struct trident_card *card = state->card;
-       struct dmabuf *dmabuf = &state->dmabuf;
+       struct trident_card *card;
+       struct dmabuf *dmabuf;
 
+       lock_kernel();
+       card = state->card;
+       dmabuf = &state->dmabuf;
        VALIDATE_STATE(state);
 
        if (file->f_mode & FMODE_WRITE) {
@@ -2038,6 +2047,7 @@ static int trident_release(struct inode *inode, struct file *file)
 
        /* we're covered by the open_sem */
        up(&card->open_sem);
+       unlock_kernel();
 
        return 0;
 }
index ab14427d637533e9f79d8459f0f178de7b8698ba..be3b1c9ca9d1e32d6ebc98a1e67079a2db6b3194 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/poll.h>
 #include <linux/soundcard.h>
 #include <linux/ac97_codec.h>
+#include <linux/smp_lock.h>
 #include <asm/io.h>
 #include <asm/delay.h>
 #include <asm/uaccess.h>
@@ -2207,6 +2208,7 @@ static int via_dsp_release(struct inode *inode, struct file *file)
        card = file->private_data;
        assert (card != NULL);
        
+       lock_kernel();
        if (file->f_mode & FMODE_READ)
                via_chan_free (card, &card->ch_in);
 
@@ -2220,6 +2222,7 @@ static int via_dsp_release(struct inode *inode, struct file *file)
        spin_unlock_irqrestore (&card->lock, flags);
 
        wake_up (&card->open_wait);
+       unlock_kernel();
 
        DPRINTK("EXIT, returning 0\n");
        return 0;
index 19cca5ee0da3d1558a927d144cc9d4e6160260ad..d46abd5699a3d589ef9357f32ecc1ba8d0aa4004 100644 (file)
  * Locking Notes
  *
  *     INC_USE_COUNT and DEC_USE_COUNT keep track of the number of
- *     open descriptors to this driver.  When the driver is compiled
- *     as a module, they call MOD_{INC,DEC}_USE_COUNT; otherwise they
- *     bump vwsnd_use_count.  The global device list, vwsnd_dev_list,
- *     is immutable when the IN_USE is true.
+ *     open descriptors to this driver. They store it in vwsnd_use_count.
+ *     The global device list, vwsnd_dev_list, is immutable when the IN_USE
+ *     is true.
  *
  *     devc->open_lock is a semaphore that is used to enforce the
  *     single reader/single writer rule for /dev/audio.  The rule is
 #include <linux/module.h>
 #include <linux/stddef.h>
 #include <linux/spinlock.h>
+#include <linux/smp_lock.h>
 #include <asm/fixmap.h>
 #include <asm/cobalt.h>
 #include <asm/semaphore.h>
@@ -1517,22 +1517,12 @@ typedef struct vwsnd_dev {
 
 static vwsnd_dev_t *vwsnd_dev_list;    /* linked list of all devices */
 
-#ifdef MODULE
-
-# define INC_USE_COUNT MOD_INC_USE_COUNT
-# define DEC_USE_COUNT MOD_DEC_USE_COUNT
-# define IN_USE        MOD_IN_USE
-
-#else
-
 static atomic_t vwsnd_use_count = ATOMIC_INIT(0);
 
 # define INC_USE_COUNT (atomic_inc(&vwsnd_use_count))
 # define DEC_USE_COUNT (atomic_dec(&vwsnd_use_count))
 # define IN_USE        (atomic_read(&vwsnd_use_count) != 0)
 
-#endif
-
 /*
  * Lithium can only DMA multiples of 32 bytes.  Its DMA buffer may
  * be up to 8 Kb.  This driver always uses 8 Kb.
@@ -2998,6 +2988,7 @@ static int vwsnd_audio_release(struct inode *inode, struct file *file)
        vwsnd_port_t *wport = NULL, *rport = NULL;
        int err = 0;
 
+       lock_kernel();
        down(&devc->io_sema);
        {
                DBGEV("(inode=0x%p, file=0x%p)\n", inode, file);
@@ -3023,13 +3014,14 @@ static int vwsnd_audio_release(struct inode *inode, struct file *file)
        }
        up(&devc->open_sema);
        wake_up(&devc->open_wait);
-       DBGDO(if (IN_USE))              /* see hack in vwsnd_mixer_release() */
-               DEC_USE_COUNT;
+       DEC_USE_COUNT;
        DBGR();
+       unlock_kernel();
        return err;
 }
 
 static struct file_operations vwsnd_audio_fops = {
+       owner:          THIS_MODULE,
        llseek:         vwsnd_audio_llseek,
        read:           vwsnd_audio_read,
        write:          vwsnd_audio_write,
@@ -3069,15 +3061,7 @@ static int vwsnd_mixer_open(struct inode *inode, struct file *file)
 static int vwsnd_mixer_release(struct inode *inode, struct file *file)
 {
        DBGEV("(inode=0x%p, file=0x%p)\n", inode, file);
-
-       /*
-        * hack -- opening/closing the mixer device zeroes use count
-        * so driver can be unloaded.
-        * Use only while debugging module, and then use it carefully.
-        */
-
-       DBGDO(while (IN_USE))
-               DEC_USE_COUNT;
+       DEC_USE_COUNT;
        return 0;
 }
 
@@ -3234,6 +3218,7 @@ static int vwsnd_mixer_ioctl(struct inode *ioctl,
 }
 
 static struct file_operations vwsnd_mixer_fops = {
+       owner:          THIS_MODULE,
        llseek:         vwsnd_mixer_llseek,
        ioctl:          vwsnd_mixer_ioctl,
        open:           vwsnd_mixer_open,
@@ -3429,8 +3414,6 @@ static int unload_vwsnd(struct address_info *hw_config)
 
        DBGE("()\n");
 
-       if (IN_USE)
-               return -EBUSY;
        devcp = &vwsnd_dev_list;
        while ((devc = *devcp)) {
                if (devc->audio_minor == hw_config->slots[0]) {
index a8f826031b71f91bda7052c1905bde720a13b908..3fb7cce2eb7072493e87a7f2e9c50ea443403d94 100644 (file)
@@ -67,6 +67,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <linux/ptrace.h>
 #include <linux/fcntl.h>
 #include <linux/ioport.h>    
@@ -1959,8 +1960,10 @@ wavefront_open (struct inode *inode, struct file *file)
 static int
 wavefront_release(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        dev.opened = 0;
        dev.debug = 0;
+       unlock_kernel();
        return 0;
 }
 
index 043d57bbc8978d3a6d113396d97f39633dc96264..47485dbde8ba13af6a0b0d47972f11f5537835a1 100644 (file)
@@ -50,6 +50,7 @@ static char ixj_c_rcsid[] = "$Id: ixj.c,v 3.4 1999/12/16 22:18:36 root Exp root
 #include <linux/timer.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
+#include <linux/smp_lock.h>
 
 #include <asm/io.h>
 #include <asm/segment.h>
@@ -1056,6 +1057,7 @@ int ixj_release(struct inode *inode, struct file *file_p)
        if (ixjdebug > 0)
                printk(KERN_INFO "Closing board %d\n", NUM(inode->i_rdev));
 
+       lock_kernel();
        daa_set_mode(board, SOP_PU_SLEEP);
        ixj_set_port(board, PORT_POTS);
        aec_stop(board);
@@ -1189,6 +1191,7 @@ int ixj_release(struct inode *inode, struct file *file_p)
        j->rec_frame_size = j->play_frame_size = 0;
        ixj_fasync(-1, file_p, 0);      // remove from list of async notification
 
+       unlock_kernel();
        return 0;
 }
 
index 55b8b1df516167b3258ab2295acc4fe5ff9307c1..7e29c7807325011e1bf62f7fe404b418d82636c4 100644 (file)
@@ -28,6 +28,9 @@ comment 'USB Controllers'
 comment 'USB Devices'
    dep_tristate '  USB Printer support' CONFIG_USB_PRINTER $CONFIG_USB
    dep_tristate '  USB Scanner support' CONFIG_USB_SCANNER $CONFIG_USB
+   if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+      dep_tristate '  Microtek X6USB scanner support (EXPERIMENTAL)' CONFIG_USB_MICROTEK $CONFIG_USB $CONFIG_SCSI
+   fi
    dep_tristate '  USB Audio support' CONFIG_USB_AUDIO $CONFIG_USB $CONFIG_SOUND
    dep_tristate '  USB Modem (CDC ACM) support' CONFIG_USB_ACM $CONFIG_USB
    dep_tristate '  USB Serial Converter support' CONFIG_USB_SERIAL $CONFIG_USB
@@ -68,7 +71,6 @@ comment 'USB Devices'
       dep_tristate '  USB ADMtek Pegasus-based device support (EXPERIMENTAL)' CONFIG_USB_PEGASUS $CONFIG_USB $CONFIG_NET
       dep_tristate '  USB Diamond Rio500 support (EXPERIMENTAL)' CONFIG_USB_RIO500 $CONFIG_USB
       dep_tristate '  D-Link USB FM radio support (EXPERIMENTAL)' CONFIG_USB_DSBR $CONFIG_USB $CONFIG_VIDEO_DEV
-      dep_tristate '  Microtek X6USB scanner support (EXPERIMENTAL)' CONFIG_USB_MICROTEK $CONFIG_USB $CONFIG_SCSI
       dep_tristate '  USB Bluetooth support (EXPERIMENTAL)' CONFIG_USB_BLUETOOTH $CONFIG_USB
    fi
 
index 67f1635a672cbcb5ead56a6edbf183c2b59bdd33..4560ad60210a9f498ce1df0b774bb72c41963d36 100644 (file)
 #include <linux/string.h>
 #include <linux/timer.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <linux/module.h>
 #include <linux/sound.h>
 #include <linux/soundcard.h>
@@ -1944,10 +1945,13 @@ static int usb_audio_open_mixdev(struct inode *inode, struct file *file)
 static int usb_audio_release_mixdev(struct inode *inode, struct file *file)
 {
        struct usb_mixerdev *ms = (struct usb_mixerdev *)file->private_data;
-       struct usb_audio_state *s = ms->state;
+       struct usb_audio_state *s;
 
+       lock_kernel();
+       s = ms->state;
        down(&open_sem);
        release(s);
+       unlock_kernel();
        return 0;
 }
 
@@ -2283,23 +2287,28 @@ static int usb_audio_mmap(struct file *file, struct vm_area_struct *vma)
 {
        struct usb_audiodev *as = (struct usb_audiodev *)file->private_data;
        struct dmabuf *db;
-       int ret;
+       int ret = -EINVAL;
 
+       lock_kernel();
        if (vma->vm_flags & VM_WRITE) {
                if ((ret = prog_dmabuf_out(as)) != 0)
-                       return ret;
+                       goto out;
                db = &as->usbout.dma;
        } else if (vma->vm_flags & VM_READ) {
                if ((ret = prog_dmabuf_in(as)) != 0)
-                       return ret;
+                       goto out;
                db = &as->usbin.dma;
        } else
-               return -EINVAL;
+               goto out;
 
+       ret = -EINVAL;
        if (vma->vm_pgoff != 0)
-               return -EINVAL;
+               goto out;
 
-       return dmabuf_mmap(db,  vma->vm_start, vma->vm_end - vma->vm_start, vma->vm_page_prot);
+       ret = dmabuf_mmap(db,  vma->vm_start, vma->vm_end - vma->vm_start, vma->vm_page_prot);
+out:
+       unlock_kernel();
+       return ret;
 }
 
 static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
@@ -2615,10 +2624,13 @@ static int usb_audio_open(struct inode *inode, struct file *file)
 static int usb_audio_release(struct inode *inode, struct file *file)
 {
        struct usb_audiodev *as = (struct usb_audiodev *)file->private_data;
-       struct usb_audio_state *s = as->state;
-       struct usb_device *dev = s->usbdev;
+       struct usb_audio_state *s;
+       struct usb_device *dev;
        struct usb_interface *iface;
 
+       lock_kernel();
+       s = as->state;
+       dev = s->usbdev;
        if (file->f_mode & FMODE_WRITE)
                drain_out(as, file->f_flags & O_NONBLOCK);
        down(&open_sem);
@@ -2643,6 +2655,7 @@ static int usb_audio_release(struct inode *inode, struct file *file)
        as->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE);
        release(s);
        wake_up(&open_wait);
+       unlock_kernel();
        return 0;
 }
 
index 8b1df4edfba68359fbd8b37e8837cb7957433af6..9b3bc24faad348c6b2e30117da5b44897cc9bbc7 100644 (file)
@@ -38,6 +38,7 @@
 #include <asm/atomic.h>
 #include <linux/delay.h>
 #include <linux/usb.h>
+#include <linux/smp_lock.h>
 
 #include "dabusb.h"
 #include "dabfirmware.h"
@@ -613,6 +614,7 @@ static int dabusb_release (struct inode *inode, struct file *file)
 
        dbg("dabusb_release");
 
+       lock_kernel();
        down (&s->mutex);
        dabusb_stop (s);
        dabusb_free_buffers (s);
@@ -626,6 +628,7 @@ static int dabusb_release (struct inode *inode, struct file *file)
                wake_up (&s->remove_ok);
 
        s->opened = 0;
+       unlock_kernel();
        return 0;
 }
 
index 4fcfa640c164874ea930d812ff7f671cc48a6f58..bb960a4af737f8870c58f6d92606cc8bccb0be06 100644 (file)
@@ -60,6 +60,7 @@
 #include <linux/module.h>
 #undef DEBUG
 #include <linux/usb.h>
+#include <linux/smp_lock.h>
 
 
 
@@ -298,10 +299,12 @@ static int camera_release (struct inode *inode, struct file *file)
        kfree (camera->buf);
 
        /* If camera was unplugged with open file ... */
+       lock_kernel();
        if (!camera->dev) {
                minor_data [camera->subminor] = NULL;
                kfree (camera);
        }
+       unlock_kernel();
 
        dbg ("close"); 
 
index 7eca5e304fdffc78a337a4cabc07abc20924bdf3..e11327cefdd2ee10afb2292ad931b3796f4738a3 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/input.h>
+#include <linux/smp_lock.h>
 
 struct evdev {
        int exist;
@@ -91,8 +92,10 @@ static int evdev_fasync(int fd, struct file *file, int on)
 static int evdev_release(struct inode * inode, struct file * file)
 {
        struct evdev_list *list = file->private_data;
-       struct evdev_list **listptr = &list->evdev->list;
+       struct evdev_list **listptr;
 
+       lock_kernel();
+       listptr = &list->evdev->list;
        evdev_fasync(-1, file, 0);
 
        while (*listptr && (*listptr != list))
@@ -110,6 +113,7 @@ static int evdev_release(struct inode * inode, struct file * file)
        }
 
        kfree(list);
+       unlock_kernel();
 
        return 0;
 }
index 5349d515c6a001851bbf4df8d408b5a2e0fdf2f9..2210ad0d1923351c49363bfe8770b90f498201f7 100644 (file)
@@ -44,6 +44,7 @@
 #include <linux/module.h>
 #include <linux/poll.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 
 #define JOYDEV_MINOR_BASE      0
 #define JOYDEV_MINORS          32
@@ -160,8 +161,10 @@ static int joydev_fasync(int fd, struct file *file, int on)
 static int joydev_release(struct inode * inode, struct file * file)
 {
        struct joydev_list *list = file->private_data;
-       struct joydev_list **listptr = &list->joydev->list;
+       struct joydev_list **listptr;
 
+       lock_kernel();
+       listptr = &list->joydev->list;
        joydev_fasync(-1, file, 0);
 
        while (*listptr && (*listptr != list))
@@ -179,6 +182,7 @@ static int joydev_release(struct inode * inode, struct file * file)
        }
 
        kfree(list);
+       unlock_kernel();
 
        return 0;
 }
index dc578df335d1acc54f93373ee3ec9716bb694532..80a1ebbf4174aacd275f0d151be86e24ee1e0d5d 100644 (file)
@@ -76,6 +76,7 @@
 #include <linux/init.h>
 #include <linux/malloc.h>
 #include <linux/module.h>
+#include <linux/smp_lock.h>
 
 #include <linux/usb.h>
 
@@ -582,6 +583,7 @@ static int mdc800_device_release (struct inode* inode, struct file *file)
        int retval=0;
        dbg ("Mustek MDC800 device closed.");
 
+       lock_kernel();
        if (mdc800->open && (mdc800->state != NOT_CONNECTED))
        {
                mdc800->open=0;
@@ -593,6 +595,7 @@ static int mdc800_device_release (struct inode* inode, struct file *file)
        {
                retval=-EIO;
        }
+       unlock_kernel();
 
        return retval;
 }
index 5c871a88d94b519a758a18ecae115e2b72ec68a3..ea5ad301bbae1f6b7259efdc170de853436fb3a5 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/init.h>
 #include <linux/input.h>
 #include <linux/config.h>
+#include <linux/smp_lock.h>
 
 #ifndef CONFIG_INPUT_MOUSEDEV_SCREEN_X
 #define CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024
@@ -159,8 +160,10 @@ static int mousedev_fasync(int fd, struct file *file, int on)
 static int mousedev_release(struct inode * inode, struct file * file)
 {
        struct mousedev_list *list = file->private_data;
-       struct mousedev_list **listptr = &list->mousedev->list;
+       struct mousedev_list **listptr;
 
+       lock_kernel();
+       listptr = &list->mousedev->list;
        mousedev_fasync(-1, file, 0);
 
        while (*listptr && (*listptr != list))
@@ -197,6 +200,7 @@ static int mousedev_release(struct inode * inode, struct file * file)
        }
        
        kfree(list);
+       unlock_kernel();
 
        return 0;
 }
index 4dc11aee078a30c6f0e2a8ca817015c6a7178261..987f1a8b5011b5238afdbbed8cb0e4319042b0cd 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <linux/signal.h>
 #include <linux/poll.h>
 #include <linux/init.h>
@@ -167,17 +168,19 @@ static int usblp_open(struct inode *inode, struct file *file)
        if (minor < 0 || minor >= USBLP_MINORS)
                return -ENODEV;
 
+       lock_kernel();
        usblp  = usblp_table[minor];
 
+       retval = -ENODEV;
        if (!usblp || !usblp->dev)
-               return -ENODEV;
+               goto out;
 
+       retval = -EBUSY;
        if (usblp->used)
-               return -EBUSY;
+               goto out;
 
-       if ((retval = usblp_check_status(usblp))) {
-               return retval;
-       }
+       if ((retval = usblp_check_status(usblp)))
+               goto out;
 
        usblp->used = 1;
        file->private_data = usblp;
@@ -189,8 +192,9 @@ static int usblp_open(struct inode *inode, struct file *file)
                usblp->readcount = 0;
                usb_submit_urb(&usblp->readurb);
        }
-
-       return 0;
+out:
+       unlock_kernel();
+       return retval;
 }
 
 static int usblp_release(struct inode *inode, struct file *file)
index 2ab527f02d07791bcd8ff1d290debcd1c1d94ade..30bd06d32080ebfbc841634daabb718fbe7a0c15 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 #include <linux/kernel.h>
 #include <linux/major.h>
 #include <linux/malloc.h>
@@ -473,8 +474,13 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
        off = vma->vm_pgoff << PAGE_SHIFT;
        if (!fb)
                return -ENODEV;
-       if (fb->fb_mmap)
-               return fb->fb_mmap(info, file, vma);
+       if (fb->fb_mmap) {
+               int res;
+               lock_kernel();
+               res = fb->fb_mmap(info, file, vma);
+               unlock_kernel();
+               return res;
+       }
 
 #if defined(__sparc__) && !defined(__sparc_v9__)
        /* Should never get here, all fb drivers should have their own
@@ -483,6 +489,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
 #else
        /* !sparc32... */
 
+       lock_kernel();
        fb->fb_get_fix(&fix, PROC_CONSOLE(info), info);
 
        /* frame buffer memory */
@@ -497,6 +504,7 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
                start = fix.mmio_start;
                len = PAGE_ALIGN((start & ~PAGE_MASK)+fix.mmio_len);
        }
+       unlock_kernel();
        start &= PAGE_MASK;
        if ((vma->vm_end - vma->vm_start + off) > len)
                return -EINVAL;
@@ -612,12 +620,15 @@ static int
 fb_release(struct inode *inode, struct file *file)
 {
        int fbidx = GET_FB_IDX(inode->i_rdev);
-       struct fb_info *info = registered_fb[fbidx];
+       struct fb_info *info;
 
+       lock_kernel();
+       info = registered_fb[fbidx];
        if (info->fbops->fb_release)
                info->fbops->fb_release(info,1);
        if (info->fbops->owner)
                __MOD_DEC_USE_COUNT(info->fbops->owner);
+       unlock_kernel();
        return 0;
 }
 
index 9a034ca60012f712e015fc9f1bfd166a15bf9610..02a2b2758c3497e4d98f6d7c0c79b3c3e534b435 100644 (file)
@@ -635,6 +635,7 @@ int blkdev_put(struct block_device *bdev, int kind)
        kdev_t rdev = to_kdev_t(bdev->bd_dev); /* this should become bdev */
        down(&bdev->bd_sem);
        /* syncing will go here */
+       lock_kernel();
        if (kind == BDEV_FILE || kind == BDEV_FS)
                fsync_dev(rdev);
        if (atomic_dec_and_test(&bdev->bd_openers)) {
@@ -653,6 +654,7 @@ int blkdev_put(struct block_device *bdev, int kind)
        if (!atomic_read(&bdev->bd_openers))
                bdev->bd_op = NULL;     /* we can't rely on driver being */
                                        /* kind to stay around. */
+       unlock_kernel();
        up(&bdev->bd_sem);
        return ret;
 }
index f5c53fac2e351560241b9a0f53511fe723bc7cbd..e53933710c218cfa7d03a7d80b542a00ab85ffea 100644 (file)
@@ -635,6 +635,7 @@ int coda_release(struct inode *i, struct file *f)
        unsigned short cflags = coda_flags_to_cflags(flags);
        struct coda_cred *cred;
 
+       lock_kernel();
         ENTRY;
        coda_vfs_stat.release++;
 
@@ -655,6 +656,7 @@ int coda_release(struct inode *i, struct file *f)
                CODA_FREE(cred, sizeof(*cred));
 
         CDEBUG(D_FILE, "coda_release: result: %d\n", error);
+       unlock_kernel();
         return error;
 }
 
index dd2636895a5d2e9816725ddbb24a267b8fcfc74e..711beee06e4aed7928ba68613c035a68b38677f4 100644 (file)
@@ -16,6 +16,8 @@
 #include <linux/locks.h>
 #include <asm/segment.h>
 #include <linux/string.h>
+#define __NO_VERSION__
+#include <linux/module.h>
 #include <asm/uaccess.h>
 
 #include <linux/coda.h>
@@ -26,8 +28,6 @@
 
 /* pioctl ops */
 static int coda_ioctl_permission(struct inode *inode, int mask);
-static int coda_ioctl_open(struct inode *i, struct file *f);
-static int coda_ioctl_release(struct inode *i, struct file *f);
 static int coda_pioctl(struct inode * inode, struct file * filp, 
                        unsigned int cmd, unsigned long arg);
 
@@ -39,9 +39,8 @@ struct inode_operations coda_ioctl_inode_operations =
 };
 
 struct file_operations coda_ioctl_operations = {
+       owner:          THIS_MODULE,
        ioctl:          coda_pioctl,
-       open:           coda_ioctl_open,
-       release:        coda_ioctl_release,
 };
 
 /* the coda pioctl inode ops */
@@ -52,24 +51,6 @@ static int coda_ioctl_permission(struct inode *inode, int mask)
         return 0;
 }
 
-/* The pioctl file ops*/
-int coda_ioctl_open(struct inode *i, struct file *f)
-{
-        ENTRY;
-
-        CDEBUG(D_PIOCTL, "File inode number: %ld\n", 
-              f->f_dentry->d_inode->i_ino);
-
-       EXIT;
-        return 0;
-}
-
-int coda_ioctl_release(struct inode *i, struct file *f) 
-{
-        return 0;
-}
-
-
 static int coda_pioctl(struct inode * inode, struct file * filp, 
                       unsigned int cmd, unsigned long user_data)
 {
index 695e4158ccfd2122bfb673271b64f3fb3b56cf1d..c475b73acd7bbfc77aabd1af3037130ac499cfa0 100644 (file)
@@ -292,6 +292,7 @@ static int coda_psdev_open(struct inode * inode, struct file * file)
         ENTRY;
        
        /* first opener, initialize */
+       lock_kernel();
        if (!vcp->vc_inuse++) {
             INIT_LIST_HEAD(&vcp->vc_pending);
             INIT_LIST_HEAD(&vcp->vc_processing);
@@ -301,6 +302,7 @@ static int coda_psdev_open(struct inode * inode, struct file * file)
        CDEBUG(D_PSDEV, "inuse: %d\n", vcp->vc_inuse);
 
        EXIT;
+       unlock_kernel();
         return 0;
 }
 
@@ -312,13 +314,18 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
        struct list_head *lh, *next;
        ENTRY;
 
+       lock_kernel();
        if ( !vcp->vc_inuse ) {
+               unlock_kernel();
                printk("psdev_release: Not open.\n");
                return -1;
        }
 
        CDEBUG(D_PSDEV, "psdev_release: inuse %d\n", vcp->vc_inuse);
-       if (--vcp->vc_inuse) return 0;
+       if (--vcp->vc_inuse) {
+               unlock_kernel();
+               return 0;
+       }
         
         /* Wakeup clients so they can return. */
        CDEBUG(D_PSDEV, "wake up pending clients\n");
@@ -347,6 +354,7 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
        CDEBUG(D_PSDEV, "Done.\n");
 
        EXIT;
+       unlock_kernel();
        return 0;
 }
 
index 494cb270ac393a7ba597c91268f6344c41cc52e0..38a773d728a0ab59b6637d1a2ffa5466fe8e8688 100644 (file)
@@ -3311,7 +3311,12 @@ static int devfsd_close (struct inode *inode, struct file *file)
 {
     struct fs_info *fs_info = inode->i_sb->u.generic_sbp;
 
-    if (fs_info->devfsd_file != file) return 0;
+    lock_kernel();
+    if (fs_info->devfsd_file != file)
+    {
+       unlock_kernel();
+       return 0;
+    }
     fs_info->devfsd_event_mask = 0;
     fs_info->devfsd_file = NULL;
     if (fs_info->devfsd_buffer)
@@ -3322,6 +3327,7 @@ static int devfsd_close (struct inode *inode, struct file *file)
     fs_info->devfsd_buffer = NULL;
     fs_info->devfsd_task = NULL;
     wake_up (&fs_info->revalidate_wait_queue);
+    unlock_kernel();
     return 0;
 }   /*  End Function devfsd_close  */
 
index d2c137e2c0380d7a2c2b55fc674d5088f01af328..f591203c40ed46b6e157ba9c79542f7597e3ca98 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <linux/fs.h>
 #include <linux/sched.h>
+#include <linux/smp_lock.h>
 
 static loff_t ext2_file_lseek(struct file *, loff_t, int);
 static int ext2_open_file (struct inode *, struct file *);
@@ -73,8 +74,11 @@ static loff_t ext2_file_lseek(
  */
 static int ext2_release_file (struct inode * inode, struct file * filp)
 {
-       if (filp->f_mode & FMODE_WRITE)
+       if (filp->f_mode & FMODE_WRITE) {
+               lock_kernel();
                ext2_discard_prealloc (inode);
+               unlock_kernel();
+       }
        return 0;
 }
 
index a64bef65ca4659ffc8e4be5a8b9c0f8969e8be90..2eaceae075eb9c7677f932f865d6bddbe8697f9c 100644 (file)
@@ -124,11 +124,8 @@ static void __fput(struct file *filp)
        struct vfsmount * mnt = filp->f_vfsmnt;
        struct inode * inode = dentry->d_inode;
 
-       if (filp->f_op && filp->f_op->release) {
-               lock_kernel();
+       if (filp->f_op && filp->f_op->release)
                filp->f_op->release(inode, filp);
-               unlock_kernel();
-       }
        fops_put(filp->f_op);
        filp->f_dentry = NULL;
        filp->f_vfsmnt = NULL;
index 51d519d7f8d3208fa29c7c408bda43cbdc4025d7..15db6e9364ffe203b57af8b41f24f7a929892b32 100644 (file)
@@ -7,11 +7,15 @@
  */
 
 #include "hpfs_fn.h"
+#include <linux/sched.h>
+#include <linux/smp_lock.h>
 
 int hpfs_dir_release(struct inode *inode, struct file *filp)
 {
+       lock_kernel();
        hpfs_del_pos(inode, &filp->f_pos);
        /*hpfs_write_if_changed(inode);*/
+       unlock_kernel();
        return 0;
 }
 
index f284e3d4232aa6ca55f16bdb82af56f19b230604..fb5f566e7c95921d57972b9e2ff74679ca1a776a 100644 (file)
@@ -24,7 +24,9 @@ int hpfs_open(struct inode *i, struct file *f)
 
 int hpfs_file_release(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        hpfs_write_if_changed(inode);
+       unlock_kernel();
        return 0;
 }
 
index 4ef5569fca397e84992a674b91b7887430e89a6e..993dcc1a4879d1747436fb68d16d6387b88d3bf3 100644 (file)
@@ -897,11 +897,15 @@ int nfs_open(struct inode *inode, struct file *filp)
 
 int nfs_release(struct inode *inode, struct file *filp)
 {
-       struct rpc_auth *auth = NFS_CLIENT(inode)->cl_auth;
-       struct rpc_cred *cred = nfs_file_cred(filp);
+       struct rpc_auth *auth;
+       struct rpc_cred *cred;
 
+       lock_kernel();
+       auth = NFS_CLIENT(inode)->cl_auth;
+       cred = nfs_file_cred(filp);
        if (cred)
                rpcauth_releasecred(auth, cred);
+       unlock_kernel();
        return 0;
 }
 
index 7a144d7078511b3a33a7ac857efe3229fdcd9ce2..2cdec3ec8dd2bb1754106d3c0ad588d772078eab 100644 (file)
@@ -317,7 +317,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap)
        if (err)
                goto out_nfserr;
        if (EX_ISSYNC(fhp->fh_export))
-               write_inode_now(inode, 0);
+               write_inode_now(inode, 1);
        err = 0;
 out:
        return err;
@@ -894,7 +894,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
 
        if (EX_ISSYNC(fhp->fh_export)) {
                nfsd_sync_dir(dentry);
-               write_inode_now(dchild->d_inode, 0);
+               write_inode_now(dchild->d_inode, 1);
        }
 
 
@@ -1140,7 +1140,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp,
                                        | S_IFLNK;
                                err = notify_change(dnew, iap);
                                if (!err && EX_ISSYNC(fhp->fh_export))
-                                       write_inode_now(dentry->d_inode, 0);
+                                       write_inode_now(dentry->d_inode, 1);
                       }
                }
        } else
@@ -1200,7 +1200,7 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
        if (!err) {
                if (EX_ISSYNC(ffhp->fh_export)) {
                        nfsd_sync_dir(ddir);
-                       write_inode_now(dest, 0);
+                       write_inode_now(dest, 1);
                }
        } else {
                if (err == -EXDEV && rqstp->rq_vers == 2)
index 3b875a4452e2988f169432f3da48e16322719435..430f7b41207c0c048c1eca8933ac5159ea733efe 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/locks.h>
 #include <linux/init.h>
 #include <linux/malloc.h>
+#include <linux/smp_lock.h>
 
 #include <asm/openprom.h>
 #include <asm/oplib.h>
@@ -507,6 +508,7 @@ int property_release (struct inode *inode, struct file *filp)
        
        if (!op)
                return 0;
+       lock_kernel();
        node = nodes[(u16)((long)inode->u.generic_ip)].node;
        if ((u16)((long)inode->u.generic_ip) == aliases) {
                if ((op->flag & OPP_DIRTY) && (op->flag & OPP_STRING)) {
@@ -548,6 +550,7 @@ int property_release (struct inode *inode, struct file *filp)
                                op->name);
                }
        }
+       unlock_kernel();
        kfree (filp->private_data);
        return 0;
 }
index 12c160a1acc7e70b4237530187e04f87f6915a2c..d9a7559a9c093d075e139b23693dd3d6c09fa3c9 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -304,6 +304,7 @@ static int
 pipe_release(struct inode *inode, int decr, int decw)
 {
        down(PIPE_SEM(*inode));
+       lock_kernel();
        PIPE_READERS(*inode) -= decr;
        PIPE_WRITERS(*inode) -= decw;
        if (!PIPE_READERS(*inode) && !PIPE_WRITERS(*inode)) {
@@ -314,6 +315,7 @@ pipe_release(struct inode *inode, int decr, int decw)
        } else {
                wake_up_interruptible(PIPE_WAIT(*inode));
        }
+       unlock_kernel();
        up(PIPE_SEM(*inode));
 
        return 0;
index 2c3b966382fddcf9e80790e0fe98c60b689cea63..247bae08f89e520e4ecf9fc28bc796b49079540e 100644 (file)
@@ -343,8 +343,10 @@ smb_file_open(struct inode *inode, struct file * file)
 static int
 smb_file_release(struct inode *inode, struct file * file)
 {
+       lock_kernel();
        if (!--inode->u.smbfs_i.openers)
                smb_close(inode);
+       unlock_kernel();
        return 0;
 }
 
index 94597406dc7dde98e2c01c9d0b871759336ddcc1..662647088acab18f5c040f8a4bde6ef3c50b9c53 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/string.h> /* memset */
 #include <linux/errno.h>
 #include <linux/locks.h>
+#include <linux/smp_lock.h>
 
 #include "udf_i.h"
 #include "udf_sb.h"
@@ -296,8 +297,11 @@ int udf_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
  */
 static int udf_release_file(struct inode * inode, struct file * filp)
 {
-       if (filp->f_mode & FMODE_WRITE)
+       if (filp->f_mode & FMODE_WRITE) {
+               lock_kernel();
                udf_discard_prealloc(inode);
+               unlock_kernel();
+       }
        return 0;
 }
 
index 5610b7fe2c1c7b0a466102550b000391a373c9d7..4f00239bf83a12477a5436dd4afdd49e25635cfa 100644 (file)
@@ -151,7 +151,7 @@ extern struct blk_dev_struct blk_dev[MAX_BLKDEV];
 extern void grok_partitions(struct gendisk *dev, int drive, unsigned minors, long size);
 extern void register_disk(struct gendisk *dev, kdev_t first, unsigned minors, struct block_device_operations *ops, long size);
 extern void generic_unplug_device(void *data);
-extern int generic_make_request(request_queue_t *q, int rw,
+extern void generic_make_request(request_queue_t *q, int rw,
                                                struct buffer_head * bh);
 extern request_queue_t *blk_get_queue(kdev_t dev);
 extern void blkdev_release_request(struct request *);
index 5decebd989bbec655571e2f509b09a9948e5b5dc..fde6788c3d6b7802274001f8d937fd147da3b7c7 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <linux/proc_fs.h>
+#include <linux/smp_lock.h>
 
 #include <asm/segment.h>
 
@@ -389,12 +390,15 @@ static int irda_open( struct inode * inode, struct file *file)
 {
        IRDA_DEBUG( 4, __FUNCTION__ "()\n");
 
+       lock_kernel();
        if (irda.in_use) {
+               unlock_kernel();
                IRDA_DEBUG(0, __FUNCTION__ 
                           "(), irmanager is already running!\n");
                return -1;
        }
        irda.in_use = TRUE;
+       unlock_kernel();
        
        return 0;
 }
@@ -446,7 +450,9 @@ static int irda_close(struct inode *inode, struct file *file)
 {
        IRDA_DEBUG(4, __FUNCTION__ "()\n");
        
+       lock_kernel();
        irda.in_use = FALSE;
+       unlock_kernel();
 
        return 0;
 }
index d0e187aee5cc1db49bd4f2e44fe746f69ae0f47f..bc1b378fca047b1099a405a2529f9a3e4e913863 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/poll.h>
 #include <linux/init.h>
 #include <linux/devfs_fs_kernel.h>
+#include <linux/smp_lock.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -138,10 +139,13 @@ out:
 static int netlink_release(struct inode * inode, struct file * file)
 {
        unsigned int minor = MINOR(inode->i_rdev);
-       struct socket *sock = netlink_user[minor];
+       struct socket *sock;
 
+       lock_kernel();
+       sock = netlink_user[minor];
        netlink_user[minor] = NULL;
        open_map &= ~(1<<minor);
+       unlock_kernel();
        sock_release(sock);
        return 0;
 }
index 4cd725731db2b87fdc5b356f1d33bea32f57b8ff..2b54269918516ccf77081883e7bf9f651bb9905a 100644 (file)
@@ -702,10 +702,8 @@ int sock_close(struct inode *inode, struct file *filp)
                printk(KERN_DEBUG "sock_close: NULL inode\n");
                return 0;
        }
-       unlock_kernel();
        sock_fasync(-1, filp, 0);
        sock_release(socki_lookup(inode));
-       lock_kernel();
        return 0;
 }