diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-02-28 01:41:29 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-04-03 17:54:26 -0400 |
commit | 0fdef36aca8a2900d3a5c113f6973d84cf38d7b7 (patch) | |
tree | d78a0624513b13c4d34a75b1e10016f49ebaefd2 | |
parent | 010f378e8c839a03f7741c95791a7b9980a9cdc2 (diff) |
Staging: line6: fix checkpatch errors in pod.c
2 errors left, but they are minor.
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/pod.c | 206 |
1 files changed, 115 insertions, 91 deletions
diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c index 614e9dc2ad19..fa5caa245d85 100644 --- a/drivers/staging/line6/pod.c +++ b/drivers/staging/line6/pod.c | |||
@@ -113,7 +113,7 @@ static struct line6_pcm_properties pod_pcm_properties = { | |||
113 | 113 | ||
114 | static const char pod_request_version[] = { 0xf0, 0x7e, 0x7f, 0x06, 0x01, 0xf7 }; | 114 | static const char pod_request_version[] = { 0xf0, 0x7e, 0x7f, 0x06, 0x01, 0xf7 }; |
115 | static const char pod_request_channel[] = { 0xf0, 0x00, 0x01, 0x0c, 0x03, 0x75, 0xf7 }; | 115 | static const char pod_request_channel[] = { 0xf0, 0x00, 0x01, 0x0c, 0x03, 0x75, 0xf7 }; |
116 | static const char pod_version_header [] = { 0xf2, 0x7e, 0x7f, 0x06, 0x02 }; | 116 | static const char pod_version_header[] = { 0xf2, 0x7e, 0x7f, 0x06, 0x02 }; |
117 | 117 | ||
118 | 118 | ||
119 | /* | 119 | /* |
@@ -123,7 +123,7 @@ static void pod_mark_batch_all_dirty(struct usb_line6_pod *pod) | |||
123 | { | 123 | { |
124 | int i; | 124 | int i; |
125 | 125 | ||
126 | for(i = POD_CONTROL_SIZE; i--;) | 126 | for (i = POD_CONTROL_SIZE; i--;) |
127 | set_bit(i, pod->param_dirty); | 127 | set_bit(i, pod->param_dirty); |
128 | } | 128 | } |
129 | 129 | ||
@@ -153,20 +153,19 @@ static void pod_startup_timeout(unsigned long arg) | |||
153 | int request = REQUEST_NONE; | 153 | int request = REQUEST_NONE; |
154 | struct usb_line6_pod *pod = (struct usb_line6_pod *)arg; | 154 | struct usb_line6_pod *pod = (struct usb_line6_pod *)arg; |
155 | 155 | ||
156 | if(pod->dumpreq.ok) { | 156 | if (pod->dumpreq.ok) { |
157 | if(!pod->versionreq_ok) | 157 | if (!pod->versionreq_ok) |
158 | request = REQUEST_VERSION; | 158 | request = REQUEST_VERSION; |
159 | } | 159 | } else { |
160 | else { | 160 | if (pod->versionreq_ok) |
161 | if(pod->versionreq_ok) | ||
162 | request = REQUEST_DUMP; | 161 | request = REQUEST_DUMP; |
163 | else if(pod->startup_count++ & 1) | 162 | else if (pod->startup_count++ & 1) |
164 | request = REQUEST_DUMP; | 163 | request = REQUEST_DUMP; |
165 | else | 164 | else |
166 | request = REQUEST_VERSION; | 165 | request = REQUEST_VERSION; |
167 | } | 166 | } |
168 | 167 | ||
169 | switch(request) { | 168 | switch (request) { |
170 | case REQUEST_DUMP: | 169 | case REQUEST_DUMP: |
171 | line6_dump_request_async(&pod->dumpreq, &pod->line6, 0); | 170 | line6_dump_request_async(&pod->dumpreq, &pod->line6, 0); |
172 | break; | 171 | break; |
@@ -194,8 +193,11 @@ static void pod_dump(struct usb_line6_pod *pod, const unsigned char *data) | |||
194 | { | 193 | { |
195 | int size = 1 + sizeof(pod->prog_data); | 194 | int size = 1 + sizeof(pod->prog_data); |
196 | char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_DUMP, size); | 195 | char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_DUMP, size); |
197 | if(!sysex) return; | 196 | if (!sysex) |
198 | sysex[SYSEX_DATA_OFS] = 5; /* Don't know what this is good for, but PODxt Pro transmits it, so we also do... */ | 197 | return; |
198 | /* Don't know what this is good for, but PODxt Pro transmits it, so we | ||
199 | * also do... */ | ||
200 | sysex[SYSEX_DATA_OFS] = 5; | ||
199 | memcpy(sysex + SYSEX_DATA_OFS + 1, data, sizeof(pod->prog_data)); | 201 | memcpy(sysex + SYSEX_DATA_OFS + 1, data, sizeof(pod->prog_data)); |
200 | line6_send_sysex_message(&pod->line6, sysex, size); | 202 | line6_send_sysex_message(&pod->line6, sysex, size); |
201 | memcpy(&pod->prog_data, data, sizeof(pod->prog_data)); | 203 | memcpy(&pod->prog_data, data, sizeof(pod->prog_data)); |
@@ -230,7 +232,7 @@ void pod_process_message(struct usb_line6_pod *pod) | |||
230 | const unsigned char *buf = pod->line6.buffer_message; | 232 | const unsigned char *buf = pod->line6.buffer_message; |
231 | 233 | ||
232 | /* filter messages by type */ | 234 | /* filter messages by type */ |
233 | switch(buf[0] & 0xf0) { | 235 | switch (buf[0] & 0xf0) { |
234 | case LINE6_PARAM_CHANGE: | 236 | case LINE6_PARAM_CHANGE: |
235 | case LINE6_PROGRAM_CHANGE: | 237 | case LINE6_PROGRAM_CHANGE: |
236 | case LINE6_SYSEX_BEGIN: | 238 | case LINE6_SYSEX_BEGIN: |
@@ -241,13 +243,15 @@ void pod_process_message(struct usb_line6_pod *pod) | |||
241 | } | 243 | } |
242 | 244 | ||
243 | /* process all remaining messages */ | 245 | /* process all remaining messages */ |
244 | switch(buf[0]) { | 246 | switch (buf[0]) { |
245 | case LINE6_PARAM_CHANGE | LINE6_CHANNEL_DEVICE: | 247 | case LINE6_PARAM_CHANGE | LINE6_CHANNEL_DEVICE: |
246 | pod_store_parameter(pod, buf[1], buf[2]); | 248 | pod_store_parameter(pod, buf[1], buf[2]); |
247 | /* intentionally no break here! */ | 249 | /* intentionally no break here! */ |
248 | 250 | ||
249 | case LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST: | 251 | case LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST: |
250 | if((buf[1] == POD_amp_model_setup) || (buf[1] == POD_effect_setup)) /* these also affect other settings */ | 252 | if ((buf[1] == POD_amp_model_setup) || |
253 | (buf[1] == POD_effect_setup)) | ||
254 | /* these also affect other settings */ | ||
251 | line6_dump_request_async(&pod->dumpreq, &pod->line6, 0); | 255 | line6_dump_request_async(&pod->dumpreq, &pod->line6, 0); |
252 | 256 | ||
253 | break; | 257 | break; |
@@ -262,11 +266,11 @@ void pod_process_message(struct usb_line6_pod *pod) | |||
262 | 266 | ||
263 | case LINE6_SYSEX_BEGIN | LINE6_CHANNEL_DEVICE: | 267 | case LINE6_SYSEX_BEGIN | LINE6_CHANNEL_DEVICE: |
264 | case LINE6_SYSEX_BEGIN | LINE6_CHANNEL_UNKNOWN: | 268 | case LINE6_SYSEX_BEGIN | LINE6_CHANNEL_UNKNOWN: |
265 | if(memcmp(buf + 1, line6_midi_id, sizeof(line6_midi_id)) == 0) { | 269 | if (memcmp(buf + 1, line6_midi_id, sizeof(line6_midi_id)) == 0) { |
266 | switch(buf[5]) { | 270 | switch (buf[5]) { |
267 | case POD_SYSEX_DUMP: | 271 | case POD_SYSEX_DUMP: |
268 | if(pod->line6.message_length == sizeof(pod->prog_data) + 7) { | 272 | if (pod->line6.message_length == sizeof(pod->prog_data) + 7) { |
269 | switch(pod->dumpreq.in_progress) { | 273 | switch (pod->dumpreq.in_progress) { |
270 | case LINE6_DUMP_CURRENT: | 274 | case LINE6_DUMP_CURRENT: |
271 | memcpy(&pod->prog_data, buf + 7, sizeof(pod->prog_data)); | 275 | memcpy(&pod->prog_data, buf + 7, sizeof(pod->prog_data)); |
272 | pod_mark_batch_all_dirty(pod); | 276 | pod_mark_batch_all_dirty(pod); |
@@ -282,8 +286,7 @@ void pod_process_message(struct usb_line6_pod *pod) | |||
282 | } | 286 | } |
283 | 287 | ||
284 | line6_dump_finished(&pod->dumpreq); | 288 | line6_dump_finished(&pod->dumpreq); |
285 | } | 289 | } else |
286 | else | ||
287 | DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "wrong size of channel dump message (%d instead of %d)\n", | 290 | DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "wrong size of channel dump message (%d instead of %d)\n", |
288 | pod->line6.message_length, (int)sizeof(pod->prog_data) + 7)); | 291 | pod->line6.message_length, (int)sizeof(pod->prog_data) + 7)); |
289 | 292 | ||
@@ -298,7 +301,7 @@ void pod_process_message(struct usb_line6_pod *pod) | |||
298 | wake_up_interruptible(&pod->x.wait); \ | 301 | wake_up_interruptible(&pod->x.wait); \ |
299 | break; | 302 | break; |
300 | 303 | ||
301 | switch(buf[6]) { | 304 | switch (buf[6]) { |
302 | PROCESS_SYSTEM_PARAM(monitor_level); | 305 | PROCESS_SYSTEM_PARAM(monitor_level); |
303 | PROCESS_SYSTEM_PARAM(routing); | 306 | PROCESS_SYSTEM_PARAM(routing); |
304 | PROCESS_SYSTEM_PARAM(tuner_mute); | 307 | PROCESS_SYSTEM_PARAM(tuner_mute); |
@@ -336,9 +339,8 @@ void pod_process_message(struct usb_line6_pod *pod) | |||
336 | default: | 339 | default: |
337 | DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown sysex message %02X\n", buf[5])); | 340 | DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown sysex message %02X\n", buf[5])); |
338 | } | 341 | } |
339 | } | 342 | } else if (memcmp(buf, pod_version_header, sizeof(pod_version_header)) == 0) { |
340 | else if(memcmp(buf, pod_version_header, sizeof(pod_version_header)) == 0) { | 343 | if (pod->versionreq_ok == 0) { |
341 | if(pod->versionreq_ok == 0) { | ||
342 | pod->firmware_version = buf[13] * 100 + buf[14] * 10 + buf[15]; | 344 | pod->firmware_version = buf[13] * 100 + buf[14] * 10 + buf[15]; |
343 | pod->device_id = ((int)buf[8] << 16) | ((int)buf[9] << 8) | (int)buf[10]; | 345 | pod->device_id = ((int)buf[8] << 16) | ((int)buf[9] << 8) | (int)buf[10]; |
344 | pod->versionreq_ok = 1; | 346 | pod->versionreq_ok = 1; |
@@ -347,11 +349,9 @@ void pod_process_message(struct usb_line6_pod *pod) | |||
347 | handler to create the special files: */ | 349 | handler to create the special files: */ |
348 | INIT_WORK(&pod->create_files_work, pod_create_files_work); | 350 | INIT_WORK(&pod->create_files_work, pod_create_files_work); |
349 | queue_work(line6_workqueue, &pod->create_files_work); | 351 | queue_work(line6_workqueue, &pod->create_files_work); |
350 | } | 352 | } else |
351 | else | ||
352 | DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "multiple firmware version message\n")); | 353 | DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "multiple firmware version message\n")); |
353 | } | 354 | } else |
354 | else | ||
355 | DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown sysex header\n")); | 355 | DEBUG_MESSAGES(dev_err(pod->line6.ifcdev, "unknown sysex header\n")); |
356 | 356 | ||
357 | break; | 357 | break; |
@@ -379,16 +379,15 @@ void pod_midi_postprocess(struct usb_line6_pod *pod, unsigned char *data, int le | |||
379 | { | 379 | { |
380 | int i; | 380 | int i; |
381 | 381 | ||
382 | if(!pod->midi_postprocess) | 382 | if (!pod->midi_postprocess) |
383 | return; | 383 | return; |
384 | 384 | ||
385 | for(i = 0; i < length; ++i) { | 385 | for (i = 0; i < length; ++i) { |
386 | if(data[i] == (LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST)) { | 386 | if (data[i] == (LINE6_PROGRAM_CHANGE | LINE6_CHANNEL_HOST)) { |
387 | line6_invalidate_current(&pod->dumpreq); | 387 | line6_invalidate_current(&pod->dumpreq); |
388 | break; | 388 | break; |
389 | } | 389 | } else if ((data[i] == (LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST)) && (i < length - 1)) |
390 | else if((data[i] == (LINE6_PARAM_CHANGE | LINE6_CHANNEL_HOST)) && (i < length - 1)) | 390 | if ((data[i + 1] == POD_amp_model_setup) || (data[i + 1] == POD_effect_setup)) { |
391 | if((data[i + 1] == POD_amp_model_setup) || (data[i + 1] == POD_effect_setup)) { | ||
392 | line6_invalidate_current(&pod->dumpreq); | 391 | line6_invalidate_current(&pod->dumpreq); |
393 | break; | 392 | break; |
394 | } | 393 | } |
@@ -402,7 +401,7 @@ static void pod_send_channel(struct usb_line6_pod *pod, int value) | |||
402 | { | 401 | { |
403 | line6_invalidate_current(&pod->dumpreq); | 402 | line6_invalidate_current(&pod->dumpreq); |
404 | 403 | ||
405 | if(line6_send_program(&pod->line6, value) == 0) | 404 | if (line6_send_program(&pod->line6, value) == 0) |
406 | pod->channel_num = value; | 405 | pod->channel_num = value; |
407 | else | 406 | else |
408 | line6_dump_finished(&pod->dumpreq); | 407 | line6_dump_finished(&pod->dumpreq); |
@@ -413,10 +412,10 @@ static void pod_send_channel(struct usb_line6_pod *pod, int value) | |||
413 | */ | 412 | */ |
414 | void pod_transmit_parameter(struct usb_line6_pod *pod, int param, int value) | 413 | void pod_transmit_parameter(struct usb_line6_pod *pod, int param, int value) |
415 | { | 414 | { |
416 | if(line6_transmit_parameter(&pod->line6, param, value) == 0) | 415 | if (line6_transmit_parameter(&pod->line6, param, value) == 0) |
417 | pod_store_parameter(pod, param, value); | 416 | pod_store_parameter(pod, param, value); |
418 | 417 | ||
419 | if((param == POD_amp_model_setup) || (param == POD_effect_setup)) /* these also affect other settings */ | 418 | if ((param == POD_amp_model_setup) || (param == POD_effect_setup)) /* these also affect other settings */ |
420 | line6_invalidate_current(&pod->dumpreq); | 419 | line6_invalidate_current(&pod->dumpreq); |
421 | } | 420 | } |
422 | 421 | ||
@@ -442,7 +441,8 @@ static ssize_t pod_send_store_command(struct device *dev, const char *buf, size_ | |||
442 | 441 | ||
443 | int size = 3 + sizeof(pod->prog_data_buf); | 442 | int size = 3 + sizeof(pod->prog_data_buf); |
444 | char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_STORE, size); | 443 | char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_STORE, size); |
445 | if(!sysex) return 0; | 444 | if (!sysex) |
445 | return 0; | ||
446 | 446 | ||
447 | sysex[SYSEX_DATA_OFS] = 5; /* see pod_dump() */ | 447 | sysex[SYSEX_DATA_OFS] = 5; /* see pod_dump() */ |
448 | pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS + 1); | 448 | pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS + 1); |
@@ -461,17 +461,18 @@ static ssize_t pod_send_retrieve_command(struct device *dev, const char *buf, si | |||
461 | { | 461 | { |
462 | struct usb_interface *interface = to_usb_interface(dev); | 462 | struct usb_interface *interface = to_usb_interface(dev); |
463 | struct usb_line6_pod *pod = usb_get_intfdata(interface); | 463 | struct usb_line6_pod *pod = usb_get_intfdata(interface); |
464 | |||
465 | int size = 4; | 464 | int size = 4; |
466 | char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_DUMPMEM, size); | 465 | char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_DUMPMEM, size); |
467 | if(!sysex) return 0; | 466 | |
467 | if (!sysex) | ||
468 | return 0; | ||
468 | 469 | ||
469 | pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS); | 470 | pod_resolve(buf, block0, block1, sysex + SYSEX_DATA_OFS); |
470 | sysex[SYSEX_DATA_OFS + 2] = 0; | 471 | sysex[SYSEX_DATA_OFS + 2] = 0; |
471 | sysex[SYSEX_DATA_OFS + 3] = 0; | 472 | sysex[SYSEX_DATA_OFS + 3] = 0; |
472 | line6_dump_started(&pod->dumpreq, POD_DUMP_MEMORY); | 473 | line6_dump_started(&pod->dumpreq, POD_DUMP_MEMORY); |
473 | 474 | ||
474 | if(line6_send_sysex_message(&pod->line6, sysex, size) < size) | 475 | if (line6_send_sysex_message(&pod->line6, sysex, size) < size) |
475 | line6_dump_finished(&pod->dumpreq); | 476 | line6_dump_finished(&pod->dumpreq); |
476 | 477 | ||
477 | kfree(sysex); | 478 | kfree(sysex); |
@@ -490,12 +491,15 @@ static ssize_t get_name_generic(struct usb_line6_pod *pod, const char *str, char | |||
490 | char *last_non_space = buf; | 491 | char *last_non_space = buf; |
491 | 492 | ||
492 | int retval = line6_wait_dump(&pod->dumpreq, 0); | 493 | int retval = line6_wait_dump(&pod->dumpreq, 0); |
493 | if(retval < 0) return retval; | 494 | if (retval < 0) |
495 | return retval; | ||
494 | 496 | ||
495 | for(p1 = str, p2 = buf; *p1; ++p1, ++p2) { | 497 | for (p1 = str, p2 = buf; *p1; ++p1, ++p2) { |
496 | *p2 = *p1; | 498 | *p2 = *p1; |
497 | if(*p2 != ' ') last_non_space = p2; | 499 | if (*p2 != ' ') |
498 | if(++length == POD_NAME_LENGTH) break; | 500 | last_non_space = p2; |
501 | if (++length == POD_NAME_LENGTH) | ||
502 | break; | ||
499 | } | 503 | } |
500 | 504 | ||
501 | *(last_non_space + 1) = '\n'; | 505 | *(last_non_space + 1) = '\n'; |
@@ -558,7 +562,8 @@ static ssize_t pod_get_dump(struct device *dev, struct device_attribute *attr, | |||
558 | struct usb_interface *interface = to_usb_interface(dev); | 562 | struct usb_interface *interface = to_usb_interface(dev); |
559 | struct usb_line6_pod *pod = usb_get_intfdata(interface); | 563 | struct usb_line6_pod *pod = usb_get_intfdata(interface); |
560 | int retval = line6_wait_dump(&pod->dumpreq, 0); | 564 | int retval = line6_wait_dump(&pod->dumpreq, 0); |
561 | if(retval < 0) return retval; | 565 | if (retval < 0) |
566 | return retval; | ||
562 | memcpy(buf, &pod->prog_data, sizeof(pod->prog_data)); | 567 | memcpy(buf, &pod->prog_data, sizeof(pod->prog_data)); |
563 | return sizeof(pod->prog_data); | 568 | return sizeof(pod->prog_data); |
564 | } | 569 | } |
@@ -572,7 +577,7 @@ static ssize_t pod_set_dump(struct device *dev, struct device_attribute *attr, | |||
572 | struct usb_interface *interface = to_usb_interface(dev); | 577 | struct usb_interface *interface = to_usb_interface(dev); |
573 | struct usb_line6_pod *pod = usb_get_intfdata(interface); | 578 | struct usb_line6_pod *pod = usb_get_intfdata(interface); |
574 | 579 | ||
575 | if(count != sizeof(pod->prog_data)) { | 580 | if (count != sizeof(pod->prog_data)) { |
576 | dev_err(pod->line6.ifcdev, | 581 | dev_err(pod->line6.ifcdev, |
577 | "data block must be exactly %d bytes\n", | 582 | "data block must be exactly %d bytes\n", |
578 | (int)sizeof(pod->prog_data)); | 583 | (int)sizeof(pod->prog_data)); |
@@ -595,13 +600,14 @@ static ssize_t pod_get_system_param(struct usb_line6_pod *pod, char *buf, int co | |||
595 | int retval = 0; | 600 | int retval = 0; |
596 | DECLARE_WAITQUEUE(wait, current); | 601 | DECLARE_WAITQUEUE(wait, current); |
597 | 602 | ||
598 | if(((pod->prog_data.control[POD_tuner] & 0x40) == 0) && tuner) | 603 | if (((pod->prog_data.control[POD_tuner] & 0x40) == 0) && tuner) |
599 | return -ENODEV; | 604 | return -ENODEV; |
600 | 605 | ||
601 | /* send value request to tuner: */ | 606 | /* send value request to tuner: */ |
602 | param->value = POD_system_invalid; | 607 | param->value = POD_system_invalid; |
603 | sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_SYSTEMREQ, size); | 608 | sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_SYSTEMREQ, size); |
604 | if(!sysex) return 0; | 609 | if (!sysex) |
610 | return 0; | ||
605 | sysex[SYSEX_DATA_OFS] = code; | 611 | sysex[SYSEX_DATA_OFS] = code; |
606 | line6_send_sysex_message(&pod->line6, sysex, size); | 612 | line6_send_sysex_message(&pod->line6, sysex, size); |
607 | kfree(sysex); | 613 | kfree(sysex); |
@@ -610,19 +616,18 @@ static ssize_t pod_get_system_param(struct usb_line6_pod *pod, char *buf, int co | |||
610 | add_wait_queue(¶m->wait, &wait); | 616 | add_wait_queue(¶m->wait, &wait); |
611 | current->state = TASK_INTERRUPTIBLE; | 617 | current->state = TASK_INTERRUPTIBLE; |
612 | 618 | ||
613 | while(param->value == POD_system_invalid) { | 619 | while (param->value == POD_system_invalid) { |
614 | if(signal_pending(current)) { | 620 | if (signal_pending(current)) { |
615 | retval = -ERESTARTSYS; | 621 | retval = -ERESTARTSYS; |
616 | break; | 622 | break; |
617 | } | 623 | } else |
618 | else | ||
619 | schedule(); | 624 | schedule(); |
620 | } | 625 | } |
621 | 626 | ||
622 | current->state = TASK_RUNNING; | 627 | current->state = TASK_RUNNING; |
623 | remove_wait_queue(¶m->wait, &wait); | 628 | remove_wait_queue(¶m->wait, &wait); |
624 | 629 | ||
625 | if(retval < 0) | 630 | if (retval < 0) |
626 | return retval; | 631 | return retval; |
627 | 632 | ||
628 | value = sign ? (int)(signed short)param->value : (int)(unsigned short)param->value; | 633 | value = sign ? (int)(signed short)param->value : (int)(unsigned short)param->value; |
@@ -633,18 +638,21 @@ static ssize_t pod_get_system_param(struct usb_line6_pod *pod, char *buf, int co | |||
633 | Send system parameter. | 638 | Send system parameter. |
634 | @param tuner non-zero, if code refers to a tuner parameter | 639 | @param tuner non-zero, if code refers to a tuner parameter |
635 | */ | 640 | */ |
636 | static ssize_t pod_set_system_param(struct usb_line6_pod *pod, const char *buf, int count, int code, unsigned short mask, int tuner) | 641 | static ssize_t pod_set_system_param(struct usb_line6_pod *pod, const char *buf, |
642 | int count, int code, unsigned short mask, | ||
643 | int tuner) | ||
637 | { | 644 | { |
638 | char *sysex; | 645 | char *sysex; |
639 | static const int size = 5; | 646 | static const int size = 5; |
640 | unsigned short value; | 647 | unsigned short value; |
641 | 648 | ||
642 | if(((pod->prog_data.control[POD_tuner] & 0x40) == 0) && tuner) | 649 | if (((pod->prog_data.control[POD_tuner] & 0x40) == 0) && tuner) |
643 | return -EINVAL; | 650 | return -EINVAL; |
644 | 651 | ||
645 | /* send value to tuner: */ | 652 | /* send value to tuner: */ |
646 | sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_SYSTEM, size); | 653 | sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_SYSTEM, size); |
647 | if(!sysex) return 0; | 654 | if (!sysex) |
655 | return 0; | ||
648 | value = simple_strtoul(buf, NULL, 10) & mask; | 656 | value = simple_strtoul(buf, NULL, 10) & mask; |
649 | sysex[SYSEX_DATA_OFS] = code; | 657 | sysex[SYSEX_DATA_OFS] = code; |
650 | sysex[SYSEX_DATA_OFS + 1] = (value >> 12) & 0x0f; | 658 | sysex[SYSEX_DATA_OFS + 1] = (value >> 12) & 0x0f; |
@@ -665,7 +673,8 @@ static ssize_t pod_get_dump_buf(struct device *dev, | |||
665 | struct usb_interface *interface = to_usb_interface(dev); | 673 | struct usb_interface *interface = to_usb_interface(dev); |
666 | struct usb_line6_pod *pod = usb_get_intfdata(interface); | 674 | struct usb_line6_pod *pod = usb_get_intfdata(interface); |
667 | int retval = line6_wait_dump(&pod->dumpreq, 0); | 675 | int retval = line6_wait_dump(&pod->dumpreq, 0); |
668 | if(retval < 0) return retval; | 676 | if (retval < 0) |
677 | return retval; | ||
669 | memcpy(buf, &pod->prog_data_buf, sizeof(pod->prog_data_buf)); | 678 | memcpy(buf, &pod->prog_data_buf, sizeof(pod->prog_data_buf)); |
670 | return sizeof(pod->prog_data_buf); | 679 | return sizeof(pod->prog_data_buf); |
671 | } | 680 | } |
@@ -680,7 +689,7 @@ static ssize_t pod_set_dump_buf(struct device *dev, | |||
680 | struct usb_interface *interface = to_usb_interface(dev); | 689 | struct usb_interface *interface = to_usb_interface(dev); |
681 | struct usb_line6_pod *pod = usb_get_intfdata(interface); | 690 | struct usb_line6_pod *pod = usb_get_intfdata(interface); |
682 | 691 | ||
683 | if(count != sizeof(pod->prog_data)) { | 692 | if (count != sizeof(pod->prog_data)) { |
684 | dev_err(pod->line6.ifcdev, | 693 | dev_err(pod->line6.ifcdev, |
685 | "data block must be exactly %d bytes\n", | 694 | "data block must be exactly %d bytes\n", |
686 | (int)sizeof(pod->prog_data)); | 695 | (int)sizeof(pod->prog_data)); |
@@ -702,7 +711,8 @@ static ssize_t pod_set_finish(struct device *dev, | |||
702 | struct usb_line6_pod *pod = usb_get_intfdata(interface); | 711 | struct usb_line6_pod *pod = usb_get_intfdata(interface); |
703 | int size = 0; | 712 | int size = 0; |
704 | char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_FINISH, size); | 713 | char *sysex = pod_alloc_sysex_buffer(pod, POD_SYSEX_FINISH, size); |
705 | if(!sysex) return 0; | 714 | if (!sysex) |
715 | return 0; | ||
706 | line6_send_sysex_message(&pod->line6, sysex, size); | 716 | line6_send_sysex_message(&pod->line6, sysex, size); |
707 | kfree(sysex); | 717 | kfree(sysex); |
708 | return count; | 718 | return count; |
@@ -827,7 +837,8 @@ static ssize_t pod_get_firmware_version(struct device *dev, | |||
827 | { | 837 | { |
828 | struct usb_interface *interface = to_usb_interface(dev); | 838 | struct usb_interface *interface = to_usb_interface(dev); |
829 | struct usb_line6_pod *pod = usb_get_intfdata(interface); | 839 | struct usb_line6_pod *pod = usb_get_intfdata(interface); |
830 | return sprintf(buf, "%d.%02d\n", pod->firmware_version / 100, pod->firmware_version % 100); | 840 | return sprintf(buf, "%d.%02d\n", pod->firmware_version / 100, |
841 | pod->firmware_version % 100); | ||
831 | } | 842 | } |
832 | 843 | ||
833 | /* | 844 | /* |
@@ -855,12 +866,11 @@ static ssize_t pod_wait_for_clip(struct device *dev, | |||
855 | add_wait_queue(&pod->clipping.wait, &wait); | 866 | add_wait_queue(&pod->clipping.wait, &wait); |
856 | current->state = TASK_INTERRUPTIBLE; | 867 | current->state = TASK_INTERRUPTIBLE; |
857 | 868 | ||
858 | while(pod->clipping.value == 0) { | 869 | while (pod->clipping.value == 0) { |
859 | if(signal_pending(current)) { | 870 | if (signal_pending(current)) { |
860 | err = -ERESTARTSYS; | 871 | err = -ERESTARTSYS; |
861 | break; | 872 | break; |
862 | } | 873 | } else |
863 | else | ||
864 | schedule(); | 874 | schedule(); |
865 | } | 875 | } |
866 | 876 | ||
@@ -875,18 +885,20 @@ static ssize_t pod_get_ ## code(struct device *dev, \ | |||
875 | { \ | 885 | { \ |
876 | struct usb_interface *interface = to_usb_interface(dev); \ | 886 | struct usb_interface *interface = to_usb_interface(dev); \ |
877 | struct usb_line6_pod *pod = usb_get_intfdata(interface); \ | 887 | struct usb_line6_pod *pod = usb_get_intfdata(interface); \ |
878 | return pod_get_system_param(pod, buf, POD_ ## code, &pod->code, tuner, sign); \ | 888 | return pod_get_system_param(pod, buf, POD_ ## code, &pod->code, \ |
889 | tuner, sign); \ | ||
879 | } | 890 | } |
880 | 891 | ||
881 | #define POD_GET_SET_SYSTEM_PARAM(code, mask, tuner, sign) \ | 892 | #define POD_GET_SET_SYSTEM_PARAM(code, mask, tuner, sign) \ |
882 | POD_GET_SYSTEM_PARAM(code, tuner, sign) \ | 893 | POD_GET_SYSTEM_PARAM(code, tuner, sign) \ |
883 | static ssize_t pod_set_ ## code(struct device *dev, \ | 894 | static ssize_t pod_set_ ## code(struct device *dev, \ |
884 | struct device_attribute *attr, const char *buf, \ | 895 | struct device_attribute *attr, \ |
885 | size_t count) \ | 896 | const char *buf, size_t count) \ |
886 | { \ | 897 | { \ |
887 | struct usb_interface *interface = to_usb_interface(dev); \ | 898 | struct usb_interface *interface = to_usb_interface(dev); \ |
888 | struct usb_line6_pod *pod = usb_get_intfdata(interface); \ | 899 | struct usb_line6_pod *pod = usb_get_intfdata(interface); \ |
889 | return pod_set_system_param(pod, buf, count, POD_ ## code, mask, tuner); \ | 900 | return pod_set_system_param(pod, buf, count, POD_ ## code, mask, \ |
901 | tuner); \ | ||
890 | } | 902 | } |
891 | 903 | ||
892 | POD_GET_SET_SYSTEM_PARAM(monitor_level, 0xffff, 0, 0); | 904 | POD_GET_SET_SYSTEM_PARAM(monitor_level, 0xffff, 0, 0); |
@@ -937,15 +949,17 @@ static void pod_destruct(struct usb_interface *interface) | |||
937 | struct usb_line6_pod *pod = usb_get_intfdata(interface); | 949 | struct usb_line6_pod *pod = usb_get_intfdata(interface); |
938 | struct usb_line6 *line6; | 950 | struct usb_line6 *line6; |
939 | 951 | ||
940 | if(pod == NULL) return; | 952 | if (pod == NULL) |
953 | return; | ||
941 | line6 = &pod->line6; | 954 | line6 = &pod->line6; |
942 | if(line6 == NULL) return; | 955 | if (line6 == NULL) |
956 | return; | ||
943 | line6_cleanup_audio(line6); | 957 | line6_cleanup_audio(line6); |
944 | 958 | ||
945 | /* free dump request data: */ | 959 | /* free dump request data: */ |
946 | line6_dumpreq_destruct(&pod->dumpreq); | 960 | line6_dumpreq_destruct(&pod->dumpreq); |
947 | 961 | ||
948 | if(pod->buffer_versionreq) kfree(pod->buffer_versionreq); | 962 | kfree(pod->buffer_versionreq); |
949 | } | 963 | } |
950 | 964 | ||
951 | /* | 965 | /* |
@@ -995,7 +1009,8 @@ int pod_init(struct usb_interface *interface, struct usb_line6_pod *pod) | |||
995 | int err; | 1009 | int err; |
996 | struct usb_line6 *line6 = &pod->line6; | 1010 | struct usb_line6 *line6 = &pod->line6; |
997 | 1011 | ||
998 | if((interface == NULL) || (pod == NULL)) return -ENODEV; | 1012 | if ((interface == NULL) || (pod == NULL)) |
1013 | return -ENODEV; | ||
999 | 1014 | ||
1000 | pod->channel_num = 255; | 1015 | pod->channel_num = 255; |
1001 | 1016 | ||
@@ -1011,57 +1026,65 @@ int pod_init(struct usb_interface *interface, struct usb_line6_pod *pod) | |||
1011 | memset(pod->param_dirty, 0xff, sizeof(pod->param_dirty)); | 1026 | memset(pod->param_dirty, 0xff, sizeof(pod->param_dirty)); |
1012 | 1027 | ||
1013 | /* initialize USB buffers: */ | 1028 | /* initialize USB buffers: */ |
1014 | err = line6_dumpreq_init(&pod->dumpreq, pod_request_channel, sizeof(pod_request_channel)); | 1029 | err = line6_dumpreq_init(&pod->dumpreq, pod_request_channel, |
1015 | 1030 | sizeof(pod_request_channel)); | |
1016 | if(err < 0) { | 1031 | if (err < 0) { |
1017 | dev_err(&interface->dev, "Out of memory\n"); | 1032 | dev_err(&interface->dev, "Out of memory\n"); |
1018 | pod_destruct(interface); | 1033 | pod_destruct(interface); |
1019 | return -ENOMEM; | 1034 | return -ENOMEM; |
1020 | } | 1035 | } |
1021 | 1036 | ||
1022 | pod->buffer_versionreq = kmalloc(sizeof(pod_request_version), GFP_KERNEL); | 1037 | pod->buffer_versionreq = kmalloc(sizeof(pod_request_version), |
1038 | GFP_KERNEL); | ||
1023 | 1039 | ||
1024 | if(pod->buffer_versionreq == NULL) { | 1040 | if (pod->buffer_versionreq == NULL) { |
1025 | dev_err(&interface->dev, "Out of memory\n"); | 1041 | dev_err(&interface->dev, "Out of memory\n"); |
1026 | pod_destruct(interface); | 1042 | pod_destruct(interface); |
1027 | return -ENOMEM; | 1043 | return -ENOMEM; |
1028 | } | 1044 | } |
1029 | 1045 | ||
1030 | memcpy(pod->buffer_versionreq, pod_request_version, sizeof(pod_request_version)); | 1046 | memcpy(pod->buffer_versionreq, pod_request_version, |
1047 | sizeof(pod_request_version)); | ||
1031 | 1048 | ||
1032 | /* create sysfs entries: */ | 1049 | /* create sysfs entries: */ |
1033 | if((err = pod_create_files2(&interface->dev)) < 0) { | 1050 | err = pod_create_files2(&interface->dev); |
1051 | if (err < 0) { | ||
1034 | pod_destruct(interface); | 1052 | pod_destruct(interface); |
1035 | return err; | 1053 | return err; |
1036 | } | 1054 | } |
1037 | 1055 | ||
1038 | /* initialize audio system: */ | 1056 | /* initialize audio system: */ |
1039 | if((err = line6_init_audio(line6)) < 0) { | 1057 | err = line6_init_audio(line6); |
1058 | if (err < 0) { | ||
1040 | pod_destruct(interface); | 1059 | pod_destruct(interface); |
1041 | return err; | 1060 | return err; |
1042 | } | 1061 | } |
1043 | 1062 | ||
1044 | /* initialize MIDI subsystem: */ | 1063 | /* initialize MIDI subsystem: */ |
1045 | if((err = line6_init_midi(line6)) < 0) { | 1064 | err = line6_init_midi(line6); |
1065 | if (err < 0) { | ||
1046 | pod_destruct(interface); | 1066 | pod_destruct(interface); |
1047 | return err; | 1067 | return err; |
1048 | } | 1068 | } |
1049 | 1069 | ||
1050 | /* initialize PCM subsystem: */ | 1070 | /* initialize PCM subsystem: */ |
1051 | if((err = line6_init_pcm(line6, &pod_pcm_properties)) < 0) { | 1071 | err = line6_init_pcm(line6, &pod_pcm_properties); |
1072 | if (err < 0) { | ||
1052 | pod_destruct(interface); | 1073 | pod_destruct(interface); |
1053 | return err; | 1074 | return err; |
1054 | } | 1075 | } |
1055 | 1076 | ||
1056 | /* register audio system: */ | 1077 | /* register audio system: */ |
1057 | if((err = line6_register_audio(line6)) < 0) { | 1078 | err = line6_register_audio(line6); |
1079 | if (err < 0) { | ||
1058 | pod_destruct(interface); | 1080 | pod_destruct(interface); |
1059 | return err; | 1081 | return err; |
1060 | } | 1082 | } |
1061 | 1083 | ||
1062 | if(pod->line6.properties->capabilities & LINE6_BIT_CONTROL) { | 1084 | if (pod->line6.properties->capabilities & LINE6_BIT_CONTROL) { |
1063 | /* query some data: */ | 1085 | /* query some data: */ |
1064 | line6_startup_delayed(&pod->dumpreq, POD_STARTUP_DELAY, pod_startup_timeout, pod); | 1086 | line6_startup_delayed(&pod->dumpreq, POD_STARTUP_DELAY, |
1087 | pod_startup_timeout, pod); | ||
1065 | line6_read_serial_number(&pod->line6, &pod->serial_number); | 1088 | line6_read_serial_number(&pod->line6, &pod->serial_number); |
1066 | } | 1089 | } |
1067 | 1090 | ||
@@ -1075,21 +1098,22 @@ void pod_disconnect(struct usb_interface *interface) | |||
1075 | { | 1098 | { |
1076 | struct usb_line6_pod *pod; | 1099 | struct usb_line6_pod *pod; |
1077 | 1100 | ||
1078 | if(interface == NULL) return; | 1101 | if (interface == NULL) |
1102 | return; | ||
1079 | pod = usb_get_intfdata(interface); | 1103 | pod = usb_get_intfdata(interface); |
1080 | 1104 | ||
1081 | if(pod != NULL) { | 1105 | if (pod != NULL) { |
1082 | struct snd_line6_pcm *line6pcm = pod->line6.line6pcm; | 1106 | struct snd_line6_pcm *line6pcm = pod->line6.line6pcm; |
1083 | struct device *dev = &interface->dev; | 1107 | struct device *dev = &interface->dev; |
1084 | 1108 | ||
1085 | if(line6pcm != NULL) { | 1109 | if (line6pcm != NULL) { |
1086 | unlink_wait_clear_audio_out_urbs(line6pcm); | 1110 | unlink_wait_clear_audio_out_urbs(line6pcm); |
1087 | unlink_wait_clear_audio_in_urbs(line6pcm); | 1111 | unlink_wait_clear_audio_in_urbs(line6pcm); |
1088 | } | 1112 | } |
1089 | 1113 | ||
1090 | if(dev != NULL) { | 1114 | if (dev != NULL) { |
1091 | /* remove sysfs entries: */ | 1115 | /* remove sysfs entries: */ |
1092 | if(pod->versionreq_ok) | 1116 | if (pod->versionreq_ok) |
1093 | pod_remove_files(pod->firmware_version, pod->line6.properties->device_bit, dev); | 1117 | pod_remove_files(pod->firmware_version, pod->line6.properties->device_bit, dev); |
1094 | 1118 | ||
1095 | device_remove_file(dev, &dev_attr_channel); | 1119 | device_remove_file(dev, &dev_attr_channel); |