ChangeSet 1.879.9.11, 2003/01/07 12:55:14-08:00, greg@kroah.com [PATCH] USB: removed MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT from driver that do not need it. diff -Nru a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c --- a/drivers/usb/misc/auerswald.c Wed Jan 8 12:00:16 2003 +++ b/drivers/usb/misc/auerswald.c Wed Jan 8 12:00:16 2003 @@ -1946,9 +1946,6 @@ if (intf->altsetting->desc.bInterfaceNumber != 0) return -ENODEV; - /* prevent module unloading while sleeping */ - MOD_INC_USE_COUNT; - /* allocate memory for our device and intialize it */ cp = kmalloc (sizeof(auerswald_t), GFP_KERNEL); if (cp == NULL) { @@ -2066,7 +2063,6 @@ /* Error exit: clean up the memory */ pfail: auerswald_delete (cp); - MOD_DEC_USE_COUNT; return -EIO; } @@ -2138,9 +2134,6 @@ if (scp) scp->disconnect( scp); } } - - /* The device releases this module */ - MOD_DEC_USE_COUNT; } /* Descriptor for the devices which are served by this driver. diff -Nru a/drivers/usb/misc/brlvger.c b/drivers/usb/misc/brlvger.c --- a/drivers/usb/misc/brlvger.c Wed Jan 8 12:00:16 2003 +++ b/drivers/usb/misc/brlvger.c Wed Jan 8 12:00:16 2003 @@ -467,8 +467,6 @@ n = devnum - BRLVGER_MINOR; - MOD_INC_USE_COUNT; - do { down(&disconnect_sem); priv = display_table[n]; @@ -478,7 +476,6 @@ if (file->f_flags & O_NONBLOCK) { dbg3("Failing non-blocking open: " "device %d not connected", n); - MOD_DEC_USE_COUNT; return -EAGAIN; } /* Blocking open. One global wait queue will @@ -490,7 +487,6 @@ != NULL); if(ret) { dbg2("Interrupted wait for device %d", n); - MOD_DEC_USE_COUNT; return ret; } } @@ -504,7 +500,7 @@ /* Only one process can open each device, no sharing. */ ret = -EBUSY; if(priv->opened) - goto error; + goto out; dbg("Opening display %d", priv->subminor); @@ -512,7 +508,7 @@ priv->intr_urb = usb_alloc_urb(0, GFP_KERNEL); if(!priv->intr_urb) { err("Unable to allocate URB"); - goto error; + goto out; } usb_fill_int_urb( priv->intr_urb, priv->dev, usb_rcvintpipe(priv->dev, @@ -521,19 +517,19 @@ intr_callback, priv, priv->in_interrupt->bInterval); if((ret = usb_submit_urb(priv->intr_urb, GFP_KERNEL)) <0){ err("Error %d while submitting URB", ret); - goto error; + goto out; } /* Set voltage */ if(brlvger_set_display_voltage(priv, raw_voltage) <0) { err("Unable to set voltage"); - goto error; + goto out; } /* Turn display on */ if((ret = brlvger_set_display_on_off(priv, 1)) <0) { err("Error %d while turning display on", ret); - goto error; + goto out; } /* Mark as opened, so disconnect cannot free priv. */ @@ -544,8 +540,6 @@ ret = 0; goto out; - error: - MOD_DEC_USE_COUNT; out: up(&priv->open_sem); return ret; @@ -576,8 +570,6 @@ priv->opened = 0; up(&priv->open_sem); } - - MOD_DEC_USE_COUNT; return 0; } diff -Nru a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c --- a/drivers/usb/misc/rio500.c Wed Jan 8 12:00:16 2003 +++ b/drivers/usb/misc/rio500.c Wed Jan 8 12:00:16 2003 @@ -94,8 +94,6 @@ init_waitqueue_head(&rio->wait_q); - MOD_INC_USE_COUNT; - unlock_kernel(); info("Rio opened."); @@ -109,8 +107,6 @@ rio->isopen = 0; - MOD_DEC_USE_COUNT; - info("Rio closed."); return 0; } @@ -443,6 +439,7 @@ static struct file_operations usb_rio_fops = { + .owner = THIS_MODULE, .read = read_rio, .write = write_rio, .ioctl = ioctl_rio,