diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-02-28 01:42:18 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-03 17:54:26 -0400 |
commit | 36445bc118848df0eed1e2da400b2b66041a2c9c (patch) | |
tree | e61ef75e5a06435aa8eca6384a2ae4d9914ab0a9 | |
parent | dfc70567d76b9d506855fd5b334a4dd0ebdf1aa7 (diff) |
Staging: line6: fix checkpatch errors in driver.c
Lots of warnings also fixed up.
Cc: Markus Grabner <grabner@icg.tugraz.at>
Cc: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/line6/driver.c | 336 |
1 files changed, 194 insertions, 142 deletions
diff --git a/drivers/staging/line6/driver.c b/drivers/staging/line6/driver.c index 0484ee60778d..85a20d0002c0 100644 --- a/drivers/staging/line6/driver.c +++ b/drivers/staging/line6/driver.c | |||
@@ -50,7 +50,7 @@ static struct usb_device_id line6_id_table[] = { | |||
50 | { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_VARIAX) }, | 50 | { USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_VARIAX) }, |
51 | { }, | 51 | { }, |
52 | }; | 52 | }; |
53 | MODULE_DEVICE_TABLE (usb, line6_id_table); | 53 | MODULE_DEVICE_TABLE(usb, line6_id_table); |
54 | 54 | ||
55 | static struct line6_properties line6_properties_table[] = { | 55 | static struct line6_properties line6_properties_table[] = { |
56 | { "BassPODxt", LINE6_BIT_BASSPODXT, LINE6_BIT_CONTROL_PCM }, | 56 | { "BassPODxt", LINE6_BIT_BASSPODXT, LINE6_BIT_CONTROL_PCM }, |
@@ -82,8 +82,7 @@ struct workqueue_struct *line6_workqueue; | |||
82 | /** | 82 | /** |
83 | Class for asynchronous messages. | 83 | Class for asynchronous messages. |
84 | */ | 84 | */ |
85 | struct message | 85 | struct message { |
86 | { | ||
87 | struct usb_line6 *line6; | 86 | struct usb_line6 *line6; |
88 | const char *buffer; | 87 | const char *buffer; |
89 | int size; | 88 | int size; |
@@ -95,7 +94,8 @@ struct message | |||
95 | Forward declarations. | 94 | Forward declarations. |
96 | */ | 95 | */ |
97 | static void line6_data_received(struct urb *urb); | 96 | static void line6_data_received(struct urb *urb); |
98 | static int line6_send_raw_message_async_part(struct message *msg, struct urb *urb); | 97 | static int line6_send_raw_message_async_part(struct message *msg, |
98 | struct urb *urb); | ||
99 | 99 | ||
100 | 100 | ||
101 | /* | 101 | /* |
@@ -103,13 +103,10 @@ static int line6_send_raw_message_async_part(struct message *msg, struct urb *ur | |||
103 | */ | 103 | */ |
104 | static int line6_start_listen(struct usb_line6 *line6) | 104 | static int line6_start_listen(struct usb_line6 *line6) |
105 | { | 105 | { |
106 | usb_fill_int_urb(line6->urb_listen, | 106 | usb_fill_int_urb(line6->urb_listen, line6->usbdev, |
107 | line6->usbdev, | 107 | usb_rcvintpipe(line6->usbdev, line6->ep_control_read), |
108 | usb_rcvintpipe(line6->usbdev, line6->ep_control_read), | 108 | line6->buffer_listen, LINE6_BUFSIZE_LISTEN, |
109 | line6->buffer_listen, LINE6_BUFSIZE_LISTEN, | 109 | line6_data_received, line6, line6->interval); |
110 | line6_data_received, | ||
111 | line6, | ||
112 | line6->interval); | ||
113 | line6->urb_listen->actual_length = 0; | 110 | line6->urb_listen->actual_length = 0; |
114 | return usb_submit_urb(line6->urb_listen, GFP_KERNEL); | 111 | return usb_submit_urb(line6->urb_listen, GFP_KERNEL); |
115 | } | 112 | } |
@@ -118,31 +115,31 @@ static int line6_start_listen(struct usb_line6 *line6) | |||
118 | /* | 115 | /* |
119 | Write hexdump to syslog. | 116 | Write hexdump to syslog. |
120 | */ | 117 | */ |
121 | void line6_write_hexdump(struct usb_line6 *line6, char dir, const unsigned char *buffer, int size) | 118 | void line6_write_hexdump(struct usb_line6 *line6, char dir, |
119 | const unsigned char *buffer, int size) | ||
122 | { | 120 | { |
123 | static const int BYTES_PER_LINE = 8; | 121 | static const int BYTES_PER_LINE = 8; |
124 | char hexdump[100]; | 122 | char hexdump[100]; |
125 | char asc[BYTES_PER_LINE + 1]; | 123 | char asc[BYTES_PER_LINE + 1]; |
126 | int i, j; | 124 | int i, j; |
127 | 125 | ||
128 | for(i = 0; i < size; i += BYTES_PER_LINE) { | 126 | for (i = 0; i < size; i += BYTES_PER_LINE) { |
129 | int hexdumpsize = sizeof(hexdump); | 127 | int hexdumpsize = sizeof(hexdump); |
130 | char *p = hexdump; | 128 | char *p = hexdump; |
131 | int n = min(size - i, BYTES_PER_LINE); | 129 | int n = min(size - i, BYTES_PER_LINE); |
132 | asc[n] = 0; | 130 | asc[n] = 0; |
133 | 131 | ||
134 | for(j = 0; j < BYTES_PER_LINE; ++j) { | 132 | for (j = 0; j < BYTES_PER_LINE; ++j) { |
135 | int bytes; | 133 | int bytes; |
136 | 134 | ||
137 | if(j < n) { | 135 | if (j < n) { |
138 | unsigned char val = buffer[i + j]; | 136 | unsigned char val = buffer[i + j]; |
139 | bytes = snprintf(p, hexdumpsize, " %02X", val); | 137 | bytes = snprintf(p, hexdumpsize, " %02X", val); |
140 | asc[j] = ((val >= 0x20) && (val < 0x7f)) ? val : '.'; | 138 | asc[j] = ((val >= 0x20) && (val < 0x7f)) ? val : '.'; |
141 | } | 139 | } else |
142 | else | ||
143 | bytes = snprintf(p, hexdumpsize, " "); | 140 | bytes = snprintf(p, hexdumpsize, " "); |
144 | 141 | ||
145 | if(bytes > hexdumpsize) | 142 | if (bytes > hexdumpsize) |
146 | break; /* buffer overflow */ | 143 | break; /* buffer overflow */ |
147 | 144 | ||
148 | p += bytes; | 145 | p += bytes; |
@@ -162,17 +159,19 @@ static void line6_dump_urb(struct urb *urb) | |||
162 | { | 159 | { |
163 | struct usb_line6 *line6 = (struct usb_line6 *)urb->context; | 160 | struct usb_line6 *line6 = (struct usb_line6 *)urb->context; |
164 | 161 | ||
165 | if(urb->status < 0) | 162 | if (urb->status < 0) |
166 | return; | 163 | return; |
167 | 164 | ||
168 | line6_write_hexdump(line6, 'R', (unsigned char *)urb->transfer_buffer, urb->actual_length); | 165 | line6_write_hexdump(line6, 'R', (unsigned char *)urb->transfer_buffer, |
166 | urb->actual_length); | ||
169 | } | 167 | } |
170 | #endif | 168 | #endif |
171 | 169 | ||
172 | /* | 170 | /* |
173 | Send raw message in pieces of wMaxPacketSize bytes. | 171 | Send raw message in pieces of wMaxPacketSize bytes. |
174 | */ | 172 | */ |
175 | int line6_send_raw_message(struct usb_line6 *line6, const char *buffer, int size) | 173 | int line6_send_raw_message(struct usb_line6 *line6, const char *buffer, |
174 | int size) | ||
176 | { | 175 | { |
177 | int i, done = 0; | 176 | int i, done = 0; |
178 | 177 | ||
@@ -180,16 +179,21 @@ int line6_send_raw_message(struct usb_line6 *line6, const char *buffer, int size | |||
180 | line6_write_hexdump(line6, 'S', buffer, size); | 179 | line6_write_hexdump(line6, 'S', buffer, size); |
181 | #endif | 180 | #endif |
182 | 181 | ||
183 | for(i = 0; i < size; i += line6->max_packet_size) { | 182 | for (i = 0; i < size; i += line6->max_packet_size) { |
184 | int partial; | 183 | int partial; |
185 | const char *frag_buf = buffer + i; | 184 | const char *frag_buf = buffer + i; |
186 | int frag_size = min(line6->max_packet_size, size - i); | 185 | int frag_size = min(line6->max_packet_size, size - i); |
187 | int retval = usb_interrupt_msg(line6->usbdev, | 186 | int retval; |
188 | usb_sndintpipe(line6->usbdev, line6->ep_control_write), | 187 | |
189 | (char *)frag_buf, frag_size, &partial, LINE6_TIMEOUT * HZ); | 188 | retval = usb_interrupt_msg(line6->usbdev, |
189 | usb_sndintpipe(line6->usbdev, | ||
190 | line6->ep_control_write), | ||
191 | (char *)frag_buf, frag_size, | ||
192 | &partial, LINE6_TIMEOUT * HZ); | ||
190 | 193 | ||
191 | if(retval) { | 194 | if (retval) { |
192 | dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval); | 195 | dev_err(line6->ifcdev, |
196 | "usb_interrupt_msg failed (%d)\n", retval); | ||
193 | break; | 197 | break; |
194 | } | 198 | } |
195 | 199 | ||
@@ -206,29 +210,28 @@ static void line6_async_request_sent(struct urb *urb) | |||
206 | { | 210 | { |
207 | struct message *msg = (struct message *)urb->context; | 211 | struct message *msg = (struct message *)urb->context; |
208 | 212 | ||
209 | if(msg->done >= msg->size) { | 213 | if (msg->done >= msg->size) { |
210 | usb_free_urb(urb); | 214 | usb_free_urb(urb); |
211 | kfree(msg); | 215 | kfree(msg); |
212 | } | 216 | } else |
213 | else | ||
214 | line6_send_raw_message_async_part(msg, urb); | 217 | line6_send_raw_message_async_part(msg, urb); |
215 | } | 218 | } |
216 | 219 | ||
217 | /* | 220 | /* |
218 | Asynchronously send part of a raw message. | 221 | Asynchronously send part of a raw message. |
219 | */ | 222 | */ |
220 | static int line6_send_raw_message_async_part(struct message *msg, struct urb *urb) | 223 | static int line6_send_raw_message_async_part(struct message *msg, |
224 | struct urb *urb) | ||
221 | { | 225 | { |
222 | int retval; | 226 | int retval; |
223 | struct usb_line6 *line6 = msg->line6; | 227 | struct usb_line6 *line6 = msg->line6; |
224 | int done = msg->done; | 228 | int done = msg->done; |
225 | int bytes = min(msg->size - done, line6->max_packet_size); | 229 | int bytes = min(msg->size - done, line6->max_packet_size); |
226 | 230 | ||
227 | usb_fill_int_urb(urb, | 231 | usb_fill_int_urb(urb, line6->usbdev, |
228 | line6->usbdev, | 232 | usb_sndintpipe(line6->usbdev, line6->ep_control_write), |
229 | usb_sndintpipe(line6->usbdev, line6->ep_control_write), | 233 | (char *)msg->buffer + done, bytes, |
230 | (char *)msg->buffer + done, bytes, | 234 | line6_async_request_sent, msg, line6->interval); |
231 | line6_async_request_sent, msg, line6->interval); | ||
232 | 235 | ||
233 | #if DO_DUMP_URB_SEND | 236 | #if DO_DUMP_URB_SEND |
234 | line6_write_hexdump(line6, 'S', (char *)msg->buffer + done, bytes); | 237 | line6_write_hexdump(line6, 'S', (char *)msg->buffer + done, bytes); |
@@ -237,8 +240,9 @@ static int line6_send_raw_message_async_part(struct message *msg, struct urb *ur | |||
237 | msg->done += bytes; | 240 | msg->done += bytes; |
238 | retval = usb_submit_urb(urb, GFP_ATOMIC); | 241 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
239 | 242 | ||
240 | if(retval < 0) { | 243 | if (retval < 0) { |
241 | dev_err(line6->ifcdev, "line6_send_raw_message_async: usb_submit_urb failed (%d)\n", retval); | 244 | dev_err(line6->ifcdev, "%s: usb_submit_urb failed (%d)\n", |
245 | __func__, retval); | ||
242 | usb_free_urb(urb); | 246 | usb_free_urb(urb); |
243 | kfree(msg); | 247 | kfree(msg); |
244 | return -EINVAL; | 248 | return -EINVAL; |
@@ -250,7 +254,8 @@ static int line6_send_raw_message_async_part(struct message *msg, struct urb *ur | |||
250 | /* | 254 | /* |
251 | Asynchronously send raw message. | 255 | Asynchronously send raw message. |
252 | */ | 256 | */ |
253 | int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer, int size) | 257 | int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer, |
258 | int size) | ||
254 | { | 259 | { |
255 | struct message *msg; | 260 | struct message *msg; |
256 | struct urb *urb; | 261 | struct urb *urb; |
@@ -258,7 +263,7 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer, in | |||
258 | /* create message: */ | 263 | /* create message: */ |
259 | msg = kmalloc(sizeof(struct message), GFP_ATOMIC); | 264 | msg = kmalloc(sizeof(struct message), GFP_ATOMIC); |
260 | 265 | ||
261 | if(msg == NULL) { | 266 | if (msg == NULL) { |
262 | dev_err(line6->ifcdev, "Out of memory\n"); | 267 | dev_err(line6->ifcdev, "Out of memory\n"); |
263 | return -ENOMEM; | 268 | return -ENOMEM; |
264 | } | 269 | } |
@@ -266,7 +271,7 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer, in | |||
266 | /* create URB: */ | 271 | /* create URB: */ |
267 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 272 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
268 | 273 | ||
269 | if(urb == NULL) { | 274 | if (urb == NULL) { |
270 | kfree(msg); | 275 | kfree(msg); |
271 | dev_err(line6->ifcdev, "Out of memory\n"); | 276 | dev_err(line6->ifcdev, "Out of memory\n"); |
272 | return -ENOMEM; | 277 | return -ENOMEM; |
@@ -285,7 +290,8 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer, in | |||
285 | /* | 290 | /* |
286 | Send sysex message in pieces of wMaxPacketSize bytes. | 291 | Send sysex message in pieces of wMaxPacketSize bytes. |
287 | */ | 292 | */ |
288 | int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer, int size) | 293 | int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer, |
294 | int size) | ||
289 | { | 295 | { |
290 | return line6_send_raw_message(line6, buffer, size + SYSEX_EXTRA_SIZE) - SYSEX_EXTRA_SIZE; | 296 | return line6_send_raw_message(line6, buffer, size + SYSEX_EXTRA_SIZE) - SYSEX_EXTRA_SIZE; |
291 | } | 297 | } |
@@ -295,11 +301,12 @@ int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer, int si | |||
295 | @param code sysex message code | 301 | @param code sysex message code |
296 | @param size number of bytes between code and sysex end | 302 | @param size number of bytes between code and sysex end |
297 | */ | 303 | */ |
298 | char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, int code2, int size) | 304 | char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, int code2, |
305 | int size) | ||
299 | { | 306 | { |
300 | char *buffer = kmalloc(size + SYSEX_EXTRA_SIZE, GFP_KERNEL); | 307 | char *buffer = kmalloc(size + SYSEX_EXTRA_SIZE, GFP_KERNEL); |
301 | 308 | ||
302 | if(!buffer) { | 309 | if (!buffer) { |
303 | dev_err(line6->ifcdev, "out of memory\n"); | 310 | dev_err(line6->ifcdev, "out of memory\n"); |
304 | return NULL; | 311 | return NULL; |
305 | } | 312 | } |
@@ -321,7 +328,7 @@ static void line6_data_received(struct urb *urb) | |||
321 | struct MidiBuffer *mb = &line6->line6midi->midibuf_in; | 328 | struct MidiBuffer *mb = &line6->line6midi->midibuf_in; |
322 | int done; | 329 | int done; |
323 | 330 | ||
324 | if(urb->status == -ESHUTDOWN) | 331 | if (urb->status == -ESHUTDOWN) |
325 | return; | 332 | return; |
326 | 333 | ||
327 | #if DO_DUMP_URB_RECEIVE | 334 | #if DO_DUMP_URB_RECEIVE |
@@ -330,19 +337,19 @@ static void line6_data_received(struct urb *urb) | |||
330 | 337 | ||
331 | done = midibuf_write(mb, urb->transfer_buffer, urb->actual_length); | 338 | done = midibuf_write(mb, urb->transfer_buffer, urb->actual_length); |
332 | 339 | ||
333 | if(done < urb->actual_length) { | 340 | if (done < urb->actual_length) { |
334 | midibuf_ignore(mb, done); | 341 | midibuf_ignore(mb, done); |
335 | DEBUG_MESSAGES(dev_err(line6->ifcdev, "%d %d buffer overflow - message skipped\n", done, urb->actual_length)); | 342 | DEBUG_MESSAGES(dev_err(line6->ifcdev, "%d %d buffer overflow - message skipped\n", done, urb->actual_length)); |
336 | } | 343 | } |
337 | 344 | ||
338 | for(;;) { | 345 | for (;;) { |
339 | done = midibuf_read(mb, line6->buffer_message, LINE6_MESSAGE_MAXLEN); | 346 | done = midibuf_read(mb, line6->buffer_message, LINE6_MESSAGE_MAXLEN); |
340 | 347 | ||
341 | if(done == 0) | 348 | if (done == 0) |
342 | break; | 349 | break; |
343 | 350 | ||
344 | /* MIDI input filter */ | 351 | /* MIDI input filter */ |
345 | if(midibuf_skip_message(mb, line6->line6midi->midi_mask_receive)) | 352 | if (midibuf_skip_message(mb, line6->line6midi->midi_mask_receive)) |
346 | continue; | 353 | continue; |
347 | 354 | ||
348 | line6->message_length = done; | 355 | line6->message_length = done; |
@@ -351,7 +358,7 @@ static void line6_data_received(struct urb *urb) | |||
351 | #endif | 358 | #endif |
352 | line6_midi_receive(line6, line6->buffer_message, done); | 359 | line6_midi_receive(line6, line6->buffer_message, done); |
353 | 360 | ||
354 | switch(line6->usbdev->descriptor.idProduct) { | 361 | switch (line6->usbdev->descriptor.idProduct) { |
355 | case LINE6_DEVID_BASSPODXT: | 362 | case LINE6_DEVID_BASSPODXT: |
356 | case LINE6_DEVID_BASSPODXTLIVE: | 363 | case LINE6_DEVID_BASSPODXTLIVE: |
357 | case LINE6_DEVID_BASSPODXTPRO: | 364 | case LINE6_DEVID_BASSPODXTPRO: |
@@ -362,7 +369,7 @@ static void line6_data_received(struct urb *urb) | |||
362 | break; | 369 | break; |
363 | 370 | ||
364 | case LINE6_DEVID_PODXTLIVE: | 371 | case LINE6_DEVID_PODXTLIVE: |
365 | switch(line6->interface_number) { | 372 | switch (line6->interface_number) { |
366 | case PODXTLIVE_INTERFACE_POD: | 373 | case PODXTLIVE_INTERFACE_POD: |
367 | pod_process_message((struct usb_line6_pod *)line6); | 374 | pod_process_message((struct usb_line6_pod *)line6); |
368 | break; | 375 | break; |
@@ -399,7 +406,7 @@ int line6_send_program(struct usb_line6 *line6, int value) | |||
399 | 406 | ||
400 | buffer = kmalloc(2, GFP_KERNEL); | 407 | buffer = kmalloc(2, GFP_KERNEL); |
401 | 408 | ||
402 | if(!buffer) { | 409 | if (!buffer) { |
403 | dev_err(line6->ifcdev, "out of memory\n"); | 410 | dev_err(line6->ifcdev, "out of memory\n"); |
404 | return -ENOMEM; | 411 | return -ENOMEM; |
405 | } | 412 | } |
@@ -412,10 +419,11 @@ int line6_send_program(struct usb_line6 *line6, int value) | |||
412 | #endif | 419 | #endif |
413 | 420 | ||
414 | retval = usb_interrupt_msg(line6->usbdev, | 421 | retval = usb_interrupt_msg(line6->usbdev, |
415 | usb_sndintpipe(line6->usbdev, line6->ep_control_write), | 422 | usb_sndintpipe(line6->usbdev, |
416 | buffer, 2, &partial, LINE6_TIMEOUT * HZ); | 423 | line6->ep_control_write), |
424 | buffer, 2, &partial, LINE6_TIMEOUT * HZ); | ||
417 | 425 | ||
418 | if(retval) | 426 | if (retval) |
419 | dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval); | 427 | dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval); |
420 | 428 | ||
421 | kfree(buffer); | 429 | kfree(buffer); |
@@ -433,7 +441,7 @@ int line6_transmit_parameter(struct usb_line6 *line6, int param, int value) | |||
433 | 441 | ||
434 | buffer = kmalloc(3, GFP_KERNEL); | 442 | buffer = kmalloc(3, GFP_KERNEL); |
435 | 443 | ||
436 | if(!buffer) { | 444 | if (!buffer) { |
437 | dev_err(line6->ifcdev, "out of memory\n"); | 445 | dev_err(line6->ifcdev, "out of memory\n"); |
438 | return -ENOMEM; | 446 | return -ENOMEM; |
439 | } | 447 | } |
@@ -450,7 +458,7 @@ int line6_transmit_parameter(struct usb_line6 *line6, int param, int value) | |||
450 | usb_sndintpipe(line6->usbdev, line6->ep_control_write), | 458 | usb_sndintpipe(line6->usbdev, line6->ep_control_write), |
451 | buffer, 3, &partial, LINE6_TIMEOUT * HZ); | 459 | buffer, 3, &partial, LINE6_TIMEOUT * HZ); |
452 | 460 | ||
453 | if(retval) | 461 | if (retval) |
454 | dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval); | 462 | dev_err(line6->ifcdev, "usb_interrupt_msg failed (%d)\n", retval); |
455 | 463 | ||
456 | kfree(buffer); | 464 | kfree(buffer); |
@@ -471,7 +479,7 @@ int line6_read_data(struct usb_line6 *line6, int address, void *data, size_t dat | |||
471 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | 479 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
472 | (datalen << 8) | 0x21, address, NULL, 0, LINE6_TIMEOUT * HZ); | 480 | (datalen << 8) | 0x21, address, NULL, 0, LINE6_TIMEOUT * HZ); |
473 | 481 | ||
474 | if(ret < 0) { | 482 | if (ret < 0) { |
475 | dev_err(line6->ifcdev, "read request failed (error %d)\n", ret); | 483 | dev_err(line6->ifcdev, "read request failed (error %d)\n", ret); |
476 | return ret; | 484 | return ret; |
477 | } | 485 | } |
@@ -479,26 +487,34 @@ int line6_read_data(struct usb_line6 *line6, int address, void *data, size_t dat | |||
479 | /* Wait for data length. We'll get a couple of 0xff until length arrives. */ | 487 | /* Wait for data length. We'll get a couple of 0xff until length arrives. */ |
480 | do { | 488 | do { |
481 | ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67, | 489 | ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67, |
482 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 490 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | |
483 | 0x0012, 0x0000, &len, 1, LINE6_TIMEOUT * HZ); | 491 | USB_DIR_IN, |
484 | if(ret < 0) { | 492 | 0x0012, 0x0000, &len, 1, |
485 | dev_err(line6->ifcdev, "receive length failed (error %d)\n", ret); | 493 | LINE6_TIMEOUT * HZ); |
494 | if (ret < 0) { | ||
495 | dev_err(line6->ifcdev, | ||
496 | "receive length failed (error %d)\n", ret); | ||
486 | return ret; | 497 | return ret; |
487 | } | 498 | } |
488 | } | 499 | } |
489 | while(len == 0xff); | 500 | while (len == 0xff) |
490 | 501 | ; | |
491 | if(len != datalen) { /* should be equal or something went wrong */ | 502 | |
492 | dev_err(line6->ifcdev, "length mismatch (expected %d, got %d)\n", (int)datalen, (int)len); | 503 | if (len != datalen) { |
504 | /* should be equal or something went wrong */ | ||
505 | dev_err(line6->ifcdev, | ||
506 | "length mismatch (expected %d, got %d)\n", | ||
507 | (int)datalen, (int)len); | ||
493 | return -EINVAL; | 508 | return -EINVAL; |
494 | } | 509 | } |
495 | 510 | ||
496 | /* receive the result: */ | 511 | /* receive the result: */ |
497 | ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67, | 512 | ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), 0x67, |
498 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 513 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
499 | 0x0013, 0x0000, data, datalen, LINE6_TIMEOUT * HZ); | 514 | 0x0013, 0x0000, data, datalen, |
515 | LINE6_TIMEOUT * HZ); | ||
500 | 516 | ||
501 | if(ret < 0) { | 517 | if (ret < 0) { |
502 | dev_err(line6->ifcdev, "read failed (error %d)\n", ret); | 518 | dev_err(line6->ifcdev, "read failed (error %d)\n", ret); |
503 | return ret; | 519 | return ret; |
504 | } | 520 | } |
@@ -509,34 +525,42 @@ int line6_read_data(struct usb_line6 *line6, int address, void *data, size_t dat | |||
509 | /* | 525 | /* |
510 | Write data to device. | 526 | Write data to device. |
511 | */ | 527 | */ |
512 | int line6_write_data(struct usb_line6 *line6, int address, void *data, size_t datalen) | 528 | int line6_write_data(struct usb_line6 *line6, int address, void *data, |
529 | size_t datalen) | ||
513 | { | 530 | { |
514 | struct usb_device *usbdev = line6->usbdev; | 531 | struct usb_device *usbdev = line6->usbdev; |
515 | int ret; | 532 | int ret; |
516 | unsigned char status; | 533 | unsigned char status; |
517 | 534 | ||
518 | ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev,0), 0x67, | 535 | ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67, |
519 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | 536 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
520 | 0x0022, address, data, datalen, LINE6_TIMEOUT * HZ); | 537 | 0x0022, address, data, datalen, |
538 | LINE6_TIMEOUT * HZ); | ||
521 | 539 | ||
522 | if(ret < 0) { | 540 | if (ret < 0) { |
523 | dev_err(line6->ifcdev, "write request failed (error %d)\n", ret); | 541 | dev_err(line6->ifcdev, |
542 | "write request failed (error %d)\n", ret); | ||
524 | return ret; | 543 | return ret; |
525 | } | 544 | } |
526 | 545 | ||
527 | do { | 546 | do { |
528 | ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev,0), 0x67, | 547 | ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev, 0), |
529 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 548 | 0x67, |
530 | 0x0012, 0x0000, &status, 1, LINE6_TIMEOUT * HZ); | 549 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | |
531 | 550 | USB_DIR_IN, | |
532 | if(ret < 0) { | 551 | 0x0012, 0x0000, |
533 | dev_err(line6->ifcdev, "receiving status failed (error %d)\n", ret); | 552 | &status, 1, LINE6_TIMEOUT * HZ); |
553 | |||
554 | if (ret < 0) { | ||
555 | dev_err(line6->ifcdev, | ||
556 | "receiving status failed (error %d)\n", ret); | ||
534 | return ret; | 557 | return ret; |
535 | } | 558 | } |
536 | } | 559 | } |
537 | while(status == 0xff); | 560 | while (status == 0xff) |
561 | ; | ||
538 | 562 | ||
539 | if(status != 0) { | 563 | if (status != 0) { |
540 | dev_err(line6->ifcdev, "write failed (error %d)\n", ret); | 564 | dev_err(line6->ifcdev, "write failed (error %d)\n", ret); |
541 | return -EINVAL; | 565 | return -EINVAL; |
542 | } | 566 | } |
@@ -591,16 +615,19 @@ ssize_t line6_set_raw(struct device *dev, struct device_attribute *attr, | |||
591 | static void line6_destruct(struct usb_interface *interface) | 615 | static void line6_destruct(struct usb_interface *interface) |
592 | { | 616 | { |
593 | struct usb_line6 *line6; | 617 | struct usb_line6 *line6; |
594 | if(interface == NULL) return; | 618 | |
619 | if (interface == NULL) | ||
620 | return; | ||
595 | line6 = usb_get_intfdata(interface); | 621 | line6 = usb_get_intfdata(interface); |
596 | if(line6 == NULL) return; | 622 | if (line6 == NULL) |
623 | return; | ||
597 | 624 | ||
598 | /* free buffer memory first: */ | 625 | /* free buffer memory first: */ |
599 | if(line6->buffer_message != NULL) kfree(line6->buffer_message); | 626 | kfree(line6->buffer_message); |
600 | if(line6->buffer_listen != NULL) kfree(line6->buffer_listen); | 627 | kfree(line6->buffer_listen); |
601 | 628 | ||
602 | /* then free URBs: */ | 629 | /* then free URBs: */ |
603 | if(line6->urb_listen != NULL) usb_free_urb(line6->urb_listen); | 630 | usb_free_urb(line6->urb_listen); |
604 | 631 | ||
605 | /* make sure the device isn't destructed twice: */ | 632 | /* make sure the device isn't destructed twice: */ |
606 | usb_set_intfdata(interface, NULL); | 633 | usb_set_intfdata(interface, NULL); |
@@ -613,11 +640,11 @@ static void line6_list_devices(void) | |||
613 | { | 640 | { |
614 | int i; | 641 | int i; |
615 | 642 | ||
616 | for(i = 0; i < LINE6_MAX_DEVICES; ++i) { | 643 | for (i = 0; i < LINE6_MAX_DEVICES; ++i) { |
617 | struct usb_line6 *dev = line6_devices[i]; | 644 | struct usb_line6 *dev = line6_devices[i]; |
618 | printk(KERN_INFO "Line6 device %d: ", i); | 645 | printk(KERN_INFO "Line6 device %d: ", i); |
619 | 646 | ||
620 | if(dev == NULL) | 647 | if (dev == NULL) |
621 | printk("(not used)\n"); | 648 | printk("(not used)\n"); |
622 | else | 649 | else |
623 | printk("%s:%d\n", dev->properties->name, dev->interface_number); | 650 | printk("%s:%d\n", dev->properties->name, dev->interface_number); |
@@ -640,33 +667,35 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
640 | int ep_read = 0, ep_write = 0; | 667 | int ep_read = 0, ep_write = 0; |
641 | int ret; | 668 | int ret; |
642 | 669 | ||
643 | if(interface == NULL) return -ENODEV; | 670 | if (interface == NULL) |
671 | return -ENODEV; | ||
644 | usbdev = interface_to_usbdev(interface); | 672 | usbdev = interface_to_usbdev(interface); |
645 | if(usbdev == NULL) return -ENODEV; | 673 | if (usbdev == NULL) |
674 | return -ENODEV; | ||
646 | 675 | ||
647 | /* increment reference counters: */ | 676 | /* increment reference counters: */ |
648 | usb_get_intf(interface); | 677 | usb_get_intf(interface); |
649 | usb_get_dev(usbdev); | 678 | usb_get_dev(usbdev); |
650 | 679 | ||
651 | /* we don't handle multiple configurations */ | 680 | /* we don't handle multiple configurations */ |
652 | if(usbdev->descriptor.bNumConfigurations != 1) | 681 | if (usbdev->descriptor.bNumConfigurations != 1) |
653 | return -ENODEV; | 682 | return -ENODEV; |
654 | 683 | ||
655 | /* check vendor and product id */ | 684 | /* check vendor and product id */ |
656 | for(devtype = sizeof(line6_id_table) / sizeof(line6_id_table[0]) - 1; devtype--;) | 685 | for (devtype = sizeof(line6_id_table) / sizeof(line6_id_table[0]) - 1; devtype--;) |
657 | if((le16_to_cpu(usbdev->descriptor.idVendor) == line6_id_table[devtype].idVendor) && | 686 | if ((le16_to_cpu(usbdev->descriptor.idVendor) == line6_id_table[devtype].idVendor) && |
658 | (le16_to_cpu(usbdev->descriptor.idProduct) == line6_id_table[devtype].idProduct)) | 687 | (le16_to_cpu(usbdev->descriptor.idProduct) == line6_id_table[devtype].idProduct)) |
659 | break; | 688 | break; |
660 | 689 | ||
661 | if(devtype < 0) | 690 | if (devtype < 0) |
662 | return -ENODEV; | 691 | return -ENODEV; |
663 | 692 | ||
664 | /* find free slot in device table: */ | 693 | /* find free slot in device table: */ |
665 | for(devnum = 0; devnum < LINE6_MAX_DEVICES; ++devnum) | 694 | for (devnum = 0; devnum < LINE6_MAX_DEVICES; ++devnum) |
666 | if(line6_devices[devnum] == NULL) | 695 | if (line6_devices[devnum] == NULL) |
667 | break; | 696 | break; |
668 | 697 | ||
669 | if(devnum == LINE6_MAX_DEVICES) | 698 | if (devnum == LINE6_MAX_DEVICES) |
670 | return -ENODEV; | 699 | return -ENODEV; |
671 | 700 | ||
672 | /* initialize device info: */ | 701 | /* initialize device info: */ |
@@ -677,7 +706,7 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
677 | /* query interface number */ | 706 | /* query interface number */ |
678 | interface_number = interface->cur_altsetting->desc.bInterfaceNumber; | 707 | interface_number = interface->cur_altsetting->desc.bInterfaceNumber; |
679 | 708 | ||
680 | switch(product) { | 709 | switch (product) { |
681 | case LINE6_DEVID_BASSPODXTLIVE: | 710 | case LINE6_DEVID_BASSPODXTLIVE: |
682 | case LINE6_DEVID_POCKETPOD: | 711 | case LINE6_DEVID_POCKETPOD: |
683 | case LINE6_DEVID_PODXTLIVE: | 712 | case LINE6_DEVID_PODXTLIVE: |
@@ -687,10 +716,15 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
687 | 716 | ||
688 | case LINE6_DEVID_PODX3: | 717 | case LINE6_DEVID_PODX3: |
689 | case LINE6_DEVID_PODX3LIVE: | 718 | case LINE6_DEVID_PODX3LIVE: |
690 | switch(interface_number) { | 719 | switch (interface_number) { |
691 | case 0: alternate = 1; break; | 720 | case 0: |
692 | case 1: alternate = 0; break; | 721 | alternate = 1; |
693 | default: MISSING_CASE; | 722 | break; |
723 | case 1: | ||
724 | alternate = 0; | ||
725 | break; | ||
726 | default: | ||
727 | MISSING_CASE; | ||
694 | } | 728 | } |
695 | break; | 729 | break; |
696 | 730 | ||
@@ -703,15 +737,21 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
703 | 737 | ||
704 | case LINE6_DEVID_TONEPORT_GX: | 738 | case LINE6_DEVID_TONEPORT_GX: |
705 | case LINE6_DEVID_GUITARPORT: | 739 | case LINE6_DEVID_GUITARPORT: |
706 | alternate = 2; // 1..4 seem to be ok | 740 | alternate = 2; /* 1..4 seem to be ok */ |
707 | break; | 741 | break; |
708 | 742 | ||
709 | case LINE6_DEVID_TONEPORT_UX1: | 743 | case LINE6_DEVID_TONEPORT_UX1: |
710 | case LINE6_DEVID_TONEPORT_UX2: | 744 | case LINE6_DEVID_TONEPORT_UX2: |
711 | switch(interface_number) { | 745 | switch (interface_number) { |
712 | case 0: alternate = 2; break; /* defaults to 44.1kHz, 16-bit */ | 746 | case 0: |
713 | case 1: alternate = 0; break; | 747 | /* defaults to 44.1kHz, 16-bit */ |
714 | default: MISSING_CASE; | 748 | alternate = 2; |
749 | break; | ||
750 | case 1: | ||
751 | alternate = 0; | ||
752 | break; | ||
753 | default: | ||
754 | MISSING_CASE; | ||
715 | } | 755 | } |
716 | break; | 756 | break; |
717 | 757 | ||
@@ -720,13 +760,14 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
720 | return -ENODEV; | 760 | return -ENODEV; |
721 | } | 761 | } |
722 | 762 | ||
723 | if((ret = usb_set_interface(usbdev, interface_number, alternate)) < 0) { | 763 | ret = usb_set_interface(usbdev, interface_number, alternate); |
764 | if (ret < 0) { | ||
724 | dev_err(&interface->dev, "set_interface failed\n"); | 765 | dev_err(&interface->dev, "set_interface failed\n"); |
725 | return ret; | 766 | return ret; |
726 | } | 767 | } |
727 | 768 | ||
728 | /* initialize device data based on product id: */ | 769 | /* initialize device data based on product id: */ |
729 | switch(product) { | 770 | switch (product) { |
730 | case LINE6_DEVID_BASSPODXT: | 771 | case LINE6_DEVID_BASSPODXT: |
731 | case LINE6_DEVID_BASSPODXTLIVE: | 772 | case LINE6_DEVID_BASSPODXTLIVE: |
732 | case LINE6_DEVID_BASSPODXTPRO: | 773 | case LINE6_DEVID_BASSPODXTPRO: |
@@ -755,7 +796,7 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
755 | break; | 796 | break; |
756 | 797 | ||
757 | case LINE6_DEVID_PODXTLIVE: | 798 | case LINE6_DEVID_PODXTLIVE: |
758 | switch(interface_number) { | 799 | switch (interface_number) { |
759 | case PODXTLIVE_INTERFACE_POD: | 800 | case PODXTLIVE_INTERFACE_POD: |
760 | size = sizeof(struct usb_line6_pod); | 801 | size = sizeof(struct usb_line6_pod); |
761 | ep_read = 0x84; | 802 | ep_read = 0x84; |
@@ -784,14 +825,14 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
784 | return -ENODEV; | 825 | return -ENODEV; |
785 | } | 826 | } |
786 | 827 | ||
787 | if(size == 0) { | 828 | if (size == 0) { |
788 | dev_err(line6->ifcdev, "driver bug: interface data size not set\n"); | 829 | dev_err(line6->ifcdev, "driver bug: interface data size not set\n"); |
789 | return -ENODEV; | 830 | return -ENODEV; |
790 | } | 831 | } |
791 | 832 | ||
792 | line6 = kzalloc(size, GFP_KERNEL); | 833 | line6 = kzalloc(size, GFP_KERNEL); |
793 | 834 | ||
794 | if(line6 == NULL) { | 835 | if (line6 == NULL) { |
795 | dev_err(&interface->dev, "Out of memory\n"); | 836 | dev_err(&interface->dev, "Out of memory\n"); |
796 | return -ENOMEM; | 837 | return -ENOMEM; |
797 | } | 838 | } |
@@ -811,11 +852,10 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
811 | unsigned epnum = usb_pipeendpoint(usb_rcvintpipe(usbdev, ep_read)); | 852 | unsigned epnum = usb_pipeendpoint(usb_rcvintpipe(usbdev, ep_read)); |
812 | ep = usbdev->ep_in[epnum]; | 853 | ep = usbdev->ep_in[epnum]; |
813 | 854 | ||
814 | if(ep != NULL) { | 855 | if (ep != NULL) { |
815 | line6->interval = ep->desc.bInterval; | 856 | line6->interval = ep->desc.bInterval; |
816 | line6->max_packet_size = le16_to_cpu(ep->desc.wMaxPacketSize); | 857 | line6->max_packet_size = le16_to_cpu(ep->desc.wMaxPacketSize); |
817 | } | 858 | } else { |
818 | else { | ||
819 | line6->interval = LINE6_FALLBACK_INTERVAL; | 859 | line6->interval = LINE6_FALLBACK_INTERVAL; |
820 | line6->max_packet_size = LINE6_FALLBACK_MAXPACKETSIZE; | 860 | line6->max_packet_size = LINE6_FALLBACK_MAXPACKETSIZE; |
821 | dev_err(line6->ifcdev, "endpoint not available, using fallback values"); | 861 | dev_err(line6->ifcdev, "endpoint not available, using fallback values"); |
@@ -824,11 +864,11 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
824 | 864 | ||
825 | usb_set_intfdata(interface, line6); | 865 | usb_set_intfdata(interface, line6); |
826 | 866 | ||
827 | if(properties->capabilities & LINE6_BIT_CONTROL) { | 867 | if (properties->capabilities & LINE6_BIT_CONTROL) { |
828 | /* initialize USB buffers: */ | 868 | /* initialize USB buffers: */ |
829 | line6->buffer_listen = kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL); | 869 | line6->buffer_listen = kmalloc(LINE6_BUFSIZE_LISTEN, GFP_KERNEL); |
830 | 870 | ||
831 | if(line6->buffer_listen == NULL) { | 871 | if (line6->buffer_listen == NULL) { |
832 | dev_err(&interface->dev, "Out of memory\n"); | 872 | dev_err(&interface->dev, "Out of memory\n"); |
833 | line6_destruct(interface); | 873 | line6_destruct(interface); |
834 | return -ENOMEM; | 874 | return -ENOMEM; |
@@ -836,7 +876,7 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
836 | 876 | ||
837 | line6->buffer_message = kmalloc(LINE6_MESSAGE_MAXLEN, GFP_KERNEL); | 877 | line6->buffer_message = kmalloc(LINE6_MESSAGE_MAXLEN, GFP_KERNEL); |
838 | 878 | ||
839 | if(line6->buffer_message == NULL) { | 879 | if (line6->buffer_message == NULL) { |
840 | dev_err(&interface->dev, "Out of memory\n"); | 880 | dev_err(&interface->dev, "Out of memory\n"); |
841 | line6_destruct(interface); | 881 | line6_destruct(interface); |
842 | return -ENOMEM; | 882 | return -ENOMEM; |
@@ -844,21 +884,23 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
844 | 884 | ||
845 | line6->urb_listen = usb_alloc_urb(0, GFP_KERNEL); | 885 | line6->urb_listen = usb_alloc_urb(0, GFP_KERNEL); |
846 | 886 | ||
847 | if(line6->urb_listen == NULL) { | 887 | if (line6->urb_listen == NULL) { |
848 | dev_err(&interface->dev, "Out of memory\n"); | 888 | dev_err(&interface->dev, "Out of memory\n"); |
849 | line6_destruct(interface); | 889 | line6_destruct(interface); |
850 | return -ENOMEM; | 890 | return -ENOMEM; |
851 | } | 891 | } |
852 | 892 | ||
853 | if((ret = line6_start_listen(line6)) < 0) { | 893 | ret = line6_start_listen(line6); |
854 | dev_err(&interface->dev, " line6_probe: usb_submit_urb failed\n"); | 894 | if (ret < 0) { |
895 | dev_err(&interface->dev, "%s: usb_submit_urb failed\n", | ||
896 | __func__); | ||
855 | line6_destruct(interface); | 897 | line6_destruct(interface); |
856 | return ret; | 898 | return ret; |
857 | } | 899 | } |
858 | } | 900 | } |
859 | 901 | ||
860 | /* initialize device data based on product id: */ | 902 | /* initialize device data based on product id: */ |
861 | switch(product) { | 903 | switch (product) { |
862 | case LINE6_DEVID_BASSPODXT: | 904 | case LINE6_DEVID_BASSPODXT: |
863 | case LINE6_DEVID_BASSPODXTLIVE: | 905 | case LINE6_DEVID_BASSPODXTLIVE: |
864 | case LINE6_DEVID_BASSPODXTPRO: | 906 | case LINE6_DEVID_BASSPODXTPRO: |
@@ -871,7 +913,7 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
871 | break; | 913 | break; |
872 | 914 | ||
873 | case LINE6_DEVID_PODXTLIVE: | 915 | case LINE6_DEVID_PODXTLIVE: |
874 | switch(interface_number) { | 916 | switch (interface_number) { |
875 | case PODXTLIVE_INTERFACE_POD: | 917 | case PODXTLIVE_INTERFACE_POD: |
876 | ret = pod_init(interface, (struct usb_line6_pod *)line6); | 918 | ret = pod_init(interface, (struct usb_line6_pod *)line6); |
877 | break; | 919 | break; |
@@ -881,7 +923,9 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
881 | break; | 923 | break; |
882 | 924 | ||
883 | default: | 925 | default: |
884 | dev_err(&interface->dev, "PODxt Live interface %d not supported\n", interface_number); | 926 | dev_err(&interface->dev, |
927 | "PODxt Live interface %d not supported\n", | ||
928 | interface_number); | ||
885 | ret = -ENODEV; | 929 | ret = -ENODEV; |
886 | } | 930 | } |
887 | 931 | ||
@@ -903,17 +947,20 @@ static int line6_probe(struct usb_interface *interface, const struct usb_device_ | |||
903 | ret = -ENODEV; | 947 | ret = -ENODEV; |
904 | } | 948 | } |
905 | 949 | ||
906 | if(ret < 0) { | 950 | if (ret < 0) { |
907 | line6_destruct(interface); | 951 | line6_destruct(interface); |
908 | return ret; | 952 | return ret; |
909 | } | 953 | } |
910 | 954 | ||
911 | if((ret = sysfs_create_link(&interface->dev.kobj, &usbdev->dev.kobj, "usb_device")) < 0) { | 955 | ret = sysfs_create_link(&interface->dev.kobj, &usbdev->dev.kobj, |
956 | "usb_device"); | ||
957 | if (ret < 0) { | ||
912 | line6_destruct(interface); | 958 | line6_destruct(interface); |
913 | return ret; | 959 | return ret; |
914 | } | 960 | } |
915 | 961 | ||
916 | dev_info(&interface->dev, "Line6 %s now attached\n", line6->properties->name); | 962 | dev_info(&interface->dev, "Line6 %s now attached\n", |
963 | line6->properties->name); | ||
917 | line6_devices[devnum] = line6; | 964 | line6_devices[devnum] = line6; |
918 | line6_list_devices(); | 965 | line6_list_devices(); |
919 | return ret; | 966 | return ret; |
@@ -928,22 +975,26 @@ static void line6_disconnect(struct usb_interface *interface) | |||
928 | struct usb_device *usbdev; | 975 | struct usb_device *usbdev; |
929 | int interface_number, i; | 976 | int interface_number, i; |
930 | 977 | ||
931 | if(interface == NULL) return; | 978 | if (interface == NULL) |
979 | return; | ||
932 | usbdev = interface_to_usbdev(interface); | 980 | usbdev = interface_to_usbdev(interface); |
933 | if(usbdev == NULL) return; | 981 | if (usbdev == NULL) |
982 | return; | ||
934 | 983 | ||
935 | sysfs_remove_link(&interface->dev.kobj, "usb_device"); | 984 | sysfs_remove_link(&interface->dev.kobj, "usb_device"); |
936 | 985 | ||
937 | interface_number = interface->cur_altsetting->desc.bInterfaceNumber; | 986 | interface_number = interface->cur_altsetting->desc.bInterfaceNumber; |
938 | line6 = usb_get_intfdata(interface); | 987 | line6 = usb_get_intfdata(interface); |
939 | 988 | ||
940 | if(line6 != NULL) { | 989 | if (line6 != NULL) { |
941 | if(line6->urb_listen != NULL) usb_kill_urb(line6->urb_listen); | 990 | if (line6->urb_listen != NULL) |
991 | usb_kill_urb(line6->urb_listen); | ||
942 | 992 | ||
943 | if(usbdev != line6->usbdev) | 993 | if (usbdev != line6->usbdev) |
944 | dev_err(line6->ifcdev, "driver bug: inconsistent usb device\n"); | 994 | dev_err(line6->ifcdev, |
995 | "driver bug: inconsistent usb device\n"); | ||
945 | 996 | ||
946 | switch(line6->usbdev->descriptor.idProduct) { | 997 | switch (line6->usbdev->descriptor.idProduct) { |
947 | case LINE6_DEVID_BASSPODXT: | 998 | case LINE6_DEVID_BASSPODXT: |
948 | case LINE6_DEVID_BASSPODXTLIVE: | 999 | case LINE6_DEVID_BASSPODXTLIVE: |
949 | case LINE6_DEVID_BASSPODXTPRO: | 1000 | case LINE6_DEVID_BASSPODXTPRO: |
@@ -956,7 +1007,7 @@ static void line6_disconnect(struct usb_interface *interface) | |||
956 | break; | 1007 | break; |
957 | 1008 | ||
958 | case LINE6_DEVID_PODXTLIVE: | 1009 | case LINE6_DEVID_PODXTLIVE: |
959 | switch(interface_number) { | 1010 | switch (interface_number) { |
960 | case PODXTLIVE_INTERFACE_POD: | 1011 | case PODXTLIVE_INTERFACE_POD: |
961 | pod_disconnect(interface); | 1012 | pod_disconnect(interface); |
962 | break; | 1013 | break; |
@@ -985,8 +1036,8 @@ static void line6_disconnect(struct usb_interface *interface) | |||
985 | 1036 | ||
986 | dev_info(&interface->dev, "Line6 %s now disconnected\n", line6->properties->name); | 1037 | dev_info(&interface->dev, "Line6 %s now disconnected\n", line6->properties->name); |
987 | 1038 | ||
988 | for(i = LINE6_MAX_DEVICES; i--;) | 1039 | for (i = LINE6_MAX_DEVICES; i--;) |
989 | if(line6_devices[i] == line6) | 1040 | if (line6_devices[i] == line6) |
990 | line6_devices[i] = NULL; | 1041 | line6_devices[i] = NULL; |
991 | } | 1042 | } |
992 | 1043 | ||
@@ -1013,7 +1064,8 @@ static int __init line6_init(void) | |||
1013 | { | 1064 | { |
1014 | int i, retval; | 1065 | int i, retval; |
1015 | 1066 | ||
1016 | printk("%s driver version %s%s\n", DRIVER_NAME, DRIVER_VERSION, DRIVER_REVISION); | 1067 | printk(KERN_INFO "%s driver version %s%s\n", |
1068 | DRIVER_NAME, DRIVER_VERSION, DRIVER_REVISION); | ||
1017 | line6_workqueue = create_workqueue(DRIVER_NAME); | 1069 | line6_workqueue = create_workqueue(DRIVER_NAME); |
1018 | 1070 | ||
1019 | if (line6_workqueue == NULL) { | 1071 | if (line6_workqueue == NULL) { |
@@ -1021,12 +1073,12 @@ static int __init line6_init(void) | |||
1021 | return -EINVAL; | 1073 | return -EINVAL; |
1022 | } | 1074 | } |
1023 | 1075 | ||
1024 | for(i = LINE6_MAX_DEVICES; i--;) | 1076 | for (i = LINE6_MAX_DEVICES; i--;) |
1025 | line6_devices[i] = NULL; | 1077 | line6_devices[i] = NULL; |
1026 | 1078 | ||
1027 | retval = usb_register(&line6_driver); | 1079 | retval = usb_register(&line6_driver); |
1028 | 1080 | ||
1029 | if(retval) | 1081 | if (retval) |
1030 | err("usb_register failed. Error number %d", retval); | 1082 | err("usb_register failed. Error number %d", retval); |
1031 | 1083 | ||
1032 | return retval; | 1084 | return retval; |