USB: fix locking in idmouse
[safe/jmp/linux-2.6] / drivers / usb / atm / usbatm.h
index ebb79da..ff8551e 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/list.h>
 #include <linux/stringify.h>
 #include <linux/usb.h>
+#include <linux/mutex.h>
 
 /*
 #define VERBOSE_DEBUG
 #endif
 
 
+/* flags, set by mini-driver in bind() */
+
+#define UDSL_SKIP_HEAVY_INIT   (1<<0)
+#define UDSL_USE_ISOC          (1<<1)
+#define UDSL_IGNORE_EILSEQ     (1<<2)
+
+
 /* mini driver */
 
 struct usbatm_data;
@@ -95,16 +103,11 @@ struct usbatm_data;
 */
 
 struct usbatm_driver {
-       struct module *owner;
-
        const char *driver_name;
 
-       /*
-       *  init device ... can sleep, or cause probe() failure.  Drivers with a heavy_init
-       *  method can avoid having it called by setting need_heavy_init to zero.
-       */
+       /* init device ... can sleep, or cause probe() failure */
         int (*bind) (struct usbatm_data *, struct usb_interface *,
-                    const struct usb_device_id *id, int *need_heavy_init);
+                    const struct usb_device_id *id);
 
        /* additional device initialization that is too slow to be done in probe() */
         int (*heavy_init) (struct usbatm_data *, struct usb_interface *);
@@ -118,8 +121,9 @@ struct usbatm_driver {
        /* cleanup ATM device ... can sleep, but can't fail */
        void (*atm_stop) (struct usbatm_data *, struct atm_dev *);
 
-        int in;                /* rx endpoint */
-        int out;       /* tx endpoint */
+        int bulk_in;   /* bulk rx endpoint */
+        int isoc_in;   /* isochronous rx endpoint */
+        int bulk_out;  /* bulk tx endpoint */
 
        unsigned rx_padding;
        unsigned tx_padding;
@@ -134,6 +138,7 @@ struct usbatm_channel {
        int endpoint;                   /* usb pipe */
        unsigned int stride;            /* ATM cell size + padding */
        unsigned int buf_size;          /* urb buffer size */
+       unsigned int packet_size;       /* endpoint maxpacket */
        spinlock_t lock;
        struct list_head list;
        struct tasklet_struct tasklet;
@@ -152,6 +157,7 @@ struct usbatm_data {
        struct usbatm_driver *driver;
        void *driver_data;
        char driver_name[16];
+       unsigned int flags; /* set by mini-driver in bind() */
 
        /* USB device */
        struct usb_device *usb_dev;
@@ -166,7 +172,8 @@ struct usbatm_data {
         ********************************/
 
        struct kref refcount;
-       struct semaphore serialize;
+       struct mutex serialize;
+       int disconnected;
 
        /* heavy init */
        int thread_pid;
@@ -182,6 +189,13 @@ struct usbatm_data {
        struct sk_buff_head sndqueue;
        struct sk_buff *current_skb;    /* being emptied */
 
+       struct usbatm_vcc_data *cached_vcc;
+       int cached_vci;
+       short cached_vpi;
+
+       unsigned char *cell_buf;        /* holds partial rx cell */
+       unsigned int buf_usage;
+
        struct urb *urbs[0];
 };