[media] tm6000: Add locking for USB transfers
[pandora-kernel.git] / drivers / staging / tm6000 / tm6000-core.c
index f85e5f2..31fdf15 100644 (file)
@@ -39,6 +39,8 @@ int tm6000_read_write_usb(struct tm6000_core *dev, u8 req_type, u8 req,
        unsigned int pipe;
        u8           *data = NULL;
 
+       mutex_lock(&dev->usb_lock);
+
        if (len)
                data = kzalloc(len, GFP_KERNEL);
 
@@ -86,9 +88,9 @@ int tm6000_read_write_usb(struct tm6000_core *dev, u8 req_type, u8 req,
        }
 
        kfree(data);
-
        msleep(5);
 
+       mutex_unlock(&dev->usb_lock);
        return ret;
 }