Make ati_remote clean up properly when removing either the device 
or the module.

Signed-off-by: Ville Syrjala <[EMAIL PROTECTED]>
---

 ati_remote.c |   24 +++---------------------
 1 files changed, 3 insertions(+), 21 deletions(-)

--- linux-2.6.10-mm2/drivers/usb/input/ati_remote.c.orig        2005-01-16 
16:56:59.000000000 +0200
+++ linux-2.6.10-mm2/drivers/usb/input/ati_remote.c     2005-01-16 
16:59:24.000000000 +0200
@@ -174,7 +174,6 @@
        dma_addr_t outbuf_dma;
 
        int open;                   /* open counter */
-       int present;                /* device plugged in? */
        
        unsigned char old_data[2];  /* Detect duplicate events */
        unsigned long old_jiffies;
@@ -356,19 +355,8 @@
 {
        struct ati_remote *ati_remote = inputdev->private;
        
-       if (ati_remote == NULL) {
-               err("ati_remote: %s: object is NULL!\n", __FUNCTION__);
-               return;
-       }
-       
-       if (ati_remote->open <= 0)
-               dev_dbg(&ati_remote->interface->dev, "%s: Not open.\n", 
__FUNCTION__);
-       else
-               --ati_remote->open;
-       
-       /* If still present, disconnect will call delete. */
-       if (!ati_remote->present && !ati_remote->open)
-               ati_remote_delete(ati_remote);
+       if (!--ati_remote->open)
+               usb_kill_urb(ati_remote->irq_urb);
 }
 
 /*
@@ -819,7 +807,6 @@
                 ati_remote->name, path);
 
        usb_set_intfdata(interface, ati_remote);
-       ati_remote->present = 1;        
        
 error:
        if (buf)
@@ -847,12 +834,7 @@
                return;
        }
        
-       /* Mark device as unplugged */
-       ati_remote->present = 0;
-
-       /* If device is still open, ati_remote_close will call delete. */
-       if (!ati_remote->open)
-               ati_remote_delete(ati_remote);
+       ati_remote_delete(ati_remote);
 
        up(&disconnect_sem);
 }
-- 
Ville Syrj�l�
[EMAIL PROTECTED]
http://www.sci.fi/~syrjala/


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to