On Sun, Dec 22, 2002 at 07:49:48PM +0100, Henning Meier-Geinitz wrote:
> 
> Decrease module usage count even if device was disconnected while
> open. Check if disconnected before read, write, and ioctl.

Hm, how about this simple patch to fix all of the module reference
counting problems.  Let me know if this works for you.

thanks,

greg k-h


===== drivers/usb/scanner.c 1.21 vs edited =====
--- 1.21/drivers/usb/scanner.c  Sun Dec 22 03:06:52 2002
+++ edited/drivers/usb/scanner.c        Mon Dec 23 12:00:00 2002
@@ -401,8 +401,6 @@
 
        int err=0;
 
-       MOD_INC_USE_COUNT;
-
        down(&scn_mutex);
 
        scn_minor = USB_SCN_MINOR(inode);
@@ -411,7 +409,6 @@
 
        if (!p_scn_table[scn_minor]) {
                up(&scn_mutex);
-               MOD_DEC_USE_COUNT;
                dbg("open_scanner(%d): Unable to access minor data", scn_minor);
                return -ENODEV;
        }
@@ -453,9 +450,6 @@
 
        up(&(scn->sem)); /* Wake up any possible contending processes */
 
-       if (err)
-               MOD_DEC_USE_COUNT;
-
        return err;
 }
 
@@ -486,8 +480,6 @@
        up(&scn_mutex);
        up(&(scn->sem));
 
-       MOD_DEC_USE_COUNT;
-
        return 0;
 }
 
@@ -831,6 +823,7 @@
 
 static struct
 file_operations usb_scanner_fops = {
+       owner:          THIS_MODULE,
        read:           read_scanner,
        write:          write_scanner,
        ioctl:          ioctl_scanner,



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to