diff options
Diffstat (limited to 'drivers/usb/atm/usbatm.h')
-rw-r--r-- | drivers/usb/atm/usbatm.h | 59 |
1 files changed, 41 insertions, 18 deletions
diff --git a/drivers/usb/atm/usbatm.h b/drivers/usb/atm/usbatm.h index 1adacd60d713..ff8551e93372 100644 --- a/drivers/usb/atm/usbatm.h +++ b/drivers/usb/atm/usbatm.h | |||
@@ -24,21 +24,21 @@ | |||
24 | #ifndef _USBATM_H_ | 24 | #ifndef _USBATM_H_ |
25 | #define _USBATM_H_ | 25 | #define _USBATM_H_ |
26 | 26 | ||
27 | #include <linux/config.h> | ||
28 | |||
29 | /* | ||
30 | #define VERBOSE_DEBUG | ||
31 | */ | ||
32 | |||
33 | #include <asm/semaphore.h> | 27 | #include <asm/semaphore.h> |
34 | #include <linux/atm.h> | 28 | #include <linux/atm.h> |
35 | #include <linux/atmdev.h> | 29 | #include <linux/atmdev.h> |
36 | #include <linux/completion.h> | 30 | #include <linux/completion.h> |
37 | #include <linux/device.h> | 31 | #include <linux/device.h> |
32 | #include <linux/kernel.h> | ||
38 | #include <linux/kref.h> | 33 | #include <linux/kref.h> |
39 | #include <linux/list.h> | 34 | #include <linux/list.h> |
40 | #include <linux/stringify.h> | 35 | #include <linux/stringify.h> |
41 | #include <linux/usb.h> | 36 | #include <linux/usb.h> |
37 | #include <linux/mutex.h> | ||
38 | |||
39 | /* | ||
40 | #define VERBOSE_DEBUG | ||
41 | */ | ||
42 | 42 | ||
43 | #ifdef DEBUG | 43 | #ifdef DEBUG |
44 | #define UDSL_ASSERT(x) BUG_ON(!(x)) | 44 | #define UDSL_ASSERT(x) BUG_ON(!(x)) |
@@ -52,8 +52,13 @@ | |||
52 | dev_info(&(instance)->usb_intf->dev , format , ## arg) | 52 | dev_info(&(instance)->usb_intf->dev , format , ## arg) |
53 | #define usb_warn(instance, format, arg...) \ | 53 | #define usb_warn(instance, format, arg...) \ |
54 | dev_warn(&(instance)->usb_intf->dev , format , ## arg) | 54 | dev_warn(&(instance)->usb_intf->dev , format , ## arg) |
55 | #ifdef DEBUG | ||
55 | #define usb_dbg(instance, format, arg...) \ | 56 | #define usb_dbg(instance, format, arg...) \ |
56 | dev_dbg(&(instance)->usb_intf->dev , format , ## arg) | 57 | dev_printk(KERN_DEBUG , &(instance)->usb_intf->dev , format , ## arg) |
58 | #else | ||
59 | #define usb_dbg(instance, format, arg...) \ | ||
60 | do {} while (0) | ||
61 | #endif | ||
57 | 62 | ||
58 | /* FIXME: move to dev_* once ATM is driver model aware */ | 63 | /* FIXME: move to dev_* once ATM is driver model aware */ |
59 | #define atm_printk(level, instance, format, arg...) \ | 64 | #define atm_printk(level, instance, format, arg...) \ |
@@ -69,12 +74,24 @@ | |||
69 | #ifdef DEBUG | 74 | #ifdef DEBUG |
70 | #define atm_dbg(instance, format, arg...) \ | 75 | #define atm_dbg(instance, format, arg...) \ |
71 | atm_printk(KERN_DEBUG, instance , format , ## arg) | 76 | atm_printk(KERN_DEBUG, instance , format , ## arg) |
77 | #define atm_rldbg(instance, format, arg...) \ | ||
78 | if (printk_ratelimit()) \ | ||
79 | atm_printk(KERN_DEBUG, instance , format , ## arg) | ||
72 | #else | 80 | #else |
73 | #define atm_dbg(instance, format, arg...) \ | 81 | #define atm_dbg(instance, format, arg...) \ |
74 | do {} while (0) | 82 | do {} while (0) |
83 | #define atm_rldbg(instance, format, arg...) \ | ||
84 | do {} while (0) | ||
75 | #endif | 85 | #endif |
76 | 86 | ||
77 | 87 | ||
88 | /* flags, set by mini-driver in bind() */ | ||
89 | |||
90 | #define UDSL_SKIP_HEAVY_INIT (1<<0) | ||
91 | #define UDSL_USE_ISOC (1<<1) | ||
92 | #define UDSL_IGNORE_EILSEQ (1<<2) | ||
93 | |||
94 | |||
78 | /* mini driver */ | 95 | /* mini driver */ |
79 | 96 | ||
80 | struct usbatm_data; | 97 | struct usbatm_data; |
@@ -86,16 +103,11 @@ struct usbatm_data; | |||
86 | */ | 103 | */ |
87 | 104 | ||
88 | struct usbatm_driver { | 105 | struct usbatm_driver { |
89 | struct module *owner; | ||
90 | |||
91 | const char *driver_name; | 106 | const char *driver_name; |
92 | 107 | ||
93 | /* | 108 | /* init device ... can sleep, or cause probe() failure */ |
94 | * init device ... can sleep, or cause probe() failure. Drivers with a heavy_init | ||
95 | * method can avoid having it called by setting need_heavy_init to zero. | ||
96 | */ | ||
97 | int (*bind) (struct usbatm_data *, struct usb_interface *, | 109 | int (*bind) (struct usbatm_data *, struct usb_interface *, |
98 | const struct usb_device_id *id, int *need_heavy_init); | 110 | const struct usb_device_id *id); |
99 | 111 | ||
100 | /* additional device initialization that is too slow to be done in probe() */ | 112 | /* additional device initialization that is too slow to be done in probe() */ |
101 | int (*heavy_init) (struct usbatm_data *, struct usb_interface *); | 113 | int (*heavy_init) (struct usbatm_data *, struct usb_interface *); |
@@ -109,8 +121,9 @@ struct usbatm_driver { | |||
109 | /* cleanup ATM device ... can sleep, but can't fail */ | 121 | /* cleanup ATM device ... can sleep, but can't fail */ |
110 | void (*atm_stop) (struct usbatm_data *, struct atm_dev *); | 122 | void (*atm_stop) (struct usbatm_data *, struct atm_dev *); |
111 | 123 | ||
112 | int in; /* rx endpoint */ | 124 | int bulk_in; /* bulk rx endpoint */ |
113 | int out; /* tx endpoint */ | 125 | int isoc_in; /* isochronous rx endpoint */ |
126 | int bulk_out; /* bulk tx endpoint */ | ||
114 | 127 | ||
115 | unsigned rx_padding; | 128 | unsigned rx_padding; |
116 | unsigned tx_padding; | 129 | unsigned tx_padding; |
@@ -125,6 +138,7 @@ struct usbatm_channel { | |||
125 | int endpoint; /* usb pipe */ | 138 | int endpoint; /* usb pipe */ |
126 | unsigned int stride; /* ATM cell size + padding */ | 139 | unsigned int stride; /* ATM cell size + padding */ |
127 | unsigned int buf_size; /* urb buffer size */ | 140 | unsigned int buf_size; /* urb buffer size */ |
141 | unsigned int packet_size; /* endpoint maxpacket */ | ||
128 | spinlock_t lock; | 142 | spinlock_t lock; |
129 | struct list_head list; | 143 | struct list_head list; |
130 | struct tasklet_struct tasklet; | 144 | struct tasklet_struct tasklet; |
@@ -143,6 +157,7 @@ struct usbatm_data { | |||
143 | struct usbatm_driver *driver; | 157 | struct usbatm_driver *driver; |
144 | void *driver_data; | 158 | void *driver_data; |
145 | char driver_name[16]; | 159 | char driver_name[16]; |
160 | unsigned int flags; /* set by mini-driver in bind() */ | ||
146 | 161 | ||
147 | /* USB device */ | 162 | /* USB device */ |
148 | struct usb_device *usb_dev; | 163 | struct usb_device *usb_dev; |
@@ -157,7 +172,8 @@ struct usbatm_data { | |||
157 | ********************************/ | 172 | ********************************/ |
158 | 173 | ||
159 | struct kref refcount; | 174 | struct kref refcount; |
160 | struct semaphore serialize; | 175 | struct mutex serialize; |
176 | int disconnected; | ||
161 | 177 | ||
162 | /* heavy init */ | 178 | /* heavy init */ |
163 | int thread_pid; | 179 | int thread_pid; |
@@ -171,7 +187,14 @@ struct usbatm_data { | |||
171 | struct usbatm_channel tx_channel; | 187 | struct usbatm_channel tx_channel; |
172 | 188 | ||
173 | struct sk_buff_head sndqueue; | 189 | struct sk_buff_head sndqueue; |
174 | struct sk_buff *current_skb; /* being emptied */ | 190 | struct sk_buff *current_skb; /* being emptied */ |
191 | |||
192 | struct usbatm_vcc_data *cached_vcc; | ||
193 | int cached_vci; | ||
194 | short cached_vpi; | ||
195 | |||
196 | unsigned char *cell_buf; /* holds partial rx cell */ | ||
197 | unsigned int buf_usage; | ||
175 | 198 | ||
176 | struct urb *urbs[0]; | 199 | struct urb *urbs[0]; |
177 | }; | 200 | }; |