diff options
Diffstat (limited to 'drivers/usb/misc/adutux.c')
-rw-r--r-- | drivers/usb/misc/adutux.c | 50 |
1 files changed, 9 insertions, 41 deletions
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index 885f99322a84..2a4793647580 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c | |||
@@ -27,30 +27,11 @@ | |||
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
29 | 29 | ||
30 | #ifdef CONFIG_USB_DEBUG | ||
31 | static int debug = 5; | ||
32 | #else | ||
33 | static int debug = 1; | ||
34 | #endif | ||
35 | |||
36 | /* Use our own dbg macro */ | ||
37 | #undef dbg | ||
38 | #define dbg(lvl, format, arg...) \ | ||
39 | do { \ | ||
40 | if (debug >= lvl) \ | ||
41 | printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ | ||
42 | } while (0) | ||
43 | |||
44 | |||
45 | /* Version Information */ | 30 | /* Version Information */ |
46 | #define DRIVER_VERSION "v0.0.13" | 31 | #define DRIVER_VERSION "v0.0.13" |
47 | #define DRIVER_AUTHOR "John Homppi" | 32 | #define DRIVER_AUTHOR "John Homppi" |
48 | #define DRIVER_DESC "adutux (see www.ontrak.net)" | 33 | #define DRIVER_DESC "adutux (see www.ontrak.net)" |
49 | 34 | ||
50 | /* Module parameters */ | ||
51 | module_param(debug, int, S_IRUGO | S_IWUSR); | ||
52 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
53 | |||
54 | /* Define these values to match your device */ | 35 | /* Define these values to match your device */ |
55 | #define ADU_VENDOR_ID 0x0a07 | 36 | #define ADU_VENDOR_ID 0x0a07 |
56 | #define ADU_PRODUCT_ID 0x0064 | 37 | #define ADU_PRODUCT_ID 0x0064 |
@@ -124,19 +105,11 @@ static DEFINE_MUTEX(adutux_mutex); | |||
124 | 105 | ||
125 | static struct usb_driver adu_driver; | 106 | static struct usb_driver adu_driver; |
126 | 107 | ||
127 | static void adu_debug_data(int level, const char *function, int size, | 108 | static inline void adu_debug_data(struct device *dev, const char *function, |
128 | const unsigned char *data) | 109 | int size, const unsigned char *data) |
129 | { | 110 | { |
130 | int i; | 111 | dev_dbg(dev, "%s - length = %d, data = %*ph\n", |
131 | 112 | function, size, size, data); | |
132 | if (debug < level) | ||
133 | return; | ||
134 | |||
135 | printk(KERN_DEBUG "%s: %s - length = %d, data = ", | ||
136 | __FILE__, function, size); | ||
137 | for (i = 0; i < size; ++i) | ||
138 | printk("%.2x ", data[i]); | ||
139 | printk("\n"); | ||
140 | } | 113 | } |
141 | 114 | ||
142 | /** | 115 | /** |
@@ -185,8 +158,8 @@ static void adu_interrupt_in_callback(struct urb *urb) | |||
185 | struct adu_device *dev = urb->context; | 158 | struct adu_device *dev = urb->context; |
186 | int status = urb->status; | 159 | int status = urb->status; |
187 | 160 | ||
188 | adu_debug_data(5, __func__, urb->actual_length, | 161 | adu_debug_data(&dev->udev->dev, __func__, |
189 | urb->transfer_buffer); | 162 | urb->actual_length, urb->transfer_buffer); |
190 | 163 | ||
191 | spin_lock(&dev->buflock); | 164 | spin_lock(&dev->buflock); |
192 | 165 | ||
@@ -222,8 +195,6 @@ exit: | |||
222 | spin_unlock(&dev->buflock); | 195 | spin_unlock(&dev->buflock); |
223 | /* always wake up so we recover from errors */ | 196 | /* always wake up so we recover from errors */ |
224 | wake_up_interruptible(&dev->read_wait); | 197 | wake_up_interruptible(&dev->read_wait); |
225 | adu_debug_data(5, __func__, urb->actual_length, | ||
226 | urb->transfer_buffer); | ||
227 | } | 198 | } |
228 | 199 | ||
229 | static void adu_interrupt_out_callback(struct urb *urb) | 200 | static void adu_interrupt_out_callback(struct urb *urb) |
@@ -231,7 +202,8 @@ static void adu_interrupt_out_callback(struct urb *urb) | |||
231 | struct adu_device *dev = urb->context; | 202 | struct adu_device *dev = urb->context; |
232 | int status = urb->status; | 203 | int status = urb->status; |
233 | 204 | ||
234 | adu_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); | 205 | adu_debug_data(&dev->udev->dev, __func__, |
206 | urb->actual_length, urb->transfer_buffer); | ||
235 | 207 | ||
236 | if (status != 0) { | 208 | if (status != 0) { |
237 | if ((status != -ENOENT) && | 209 | if ((status != -ENOENT) && |
@@ -240,17 +212,13 @@ static void adu_interrupt_out_callback(struct urb *urb) | |||
240 | "%s :nonzero status received: %d\n", __func__, | 212 | "%s :nonzero status received: %d\n", __func__, |
241 | status); | 213 | status); |
242 | } | 214 | } |
243 | goto exit; | 215 | return; |
244 | } | 216 | } |
245 | 217 | ||
246 | spin_lock(&dev->buflock); | 218 | spin_lock(&dev->buflock); |
247 | dev->out_urb_finished = 1; | 219 | dev->out_urb_finished = 1; |
248 | wake_up(&dev->write_wait); | 220 | wake_up(&dev->write_wait); |
249 | spin_unlock(&dev->buflock); | 221 | spin_unlock(&dev->buflock); |
250 | exit: | ||
251 | |||
252 | adu_debug_data(5, __func__, urb->actual_length, | ||
253 | urb->transfer_buffer); | ||
254 | } | 222 | } |
255 | 223 | ||
256 | static int adu_open(struct inode *inode, struct file *file) | 224 | static int adu_open(struct inode *inode, struct file *file) |