diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-11-18 17:04:52 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-01-06 16:52:21 -0500 |
commit | 8fa07567bf5d824537839e6984a571daeed2c7fc (patch) | |
tree | f7f43efd18cbf62bdad1244af1bdade6fee725f7 | |
parent | 4398ecfac1cfe26ee63d0d4151cf9c3fa89e81d1 (diff) |
Staging: comedi: usbdux: code style cleanups
Fix a lot of checkpatch.pl warnings and errors in the usbdux driver.
Cc: Bernd Porr <BerndPorr@f2s.com>
Cc: David Schleef <ds@schleef.org>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/comedi/drivers/usbdux.c | 458 |
1 files changed, 221 insertions, 237 deletions
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 331dc59c8ff5..3c51607a2e02 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c | |||
@@ -296,7 +296,7 @@ static DECLARE_MUTEX(start_stop_sem); | |||
296 | 296 | ||
297 | // Stops the data acquision | 297 | // Stops the data acquision |
298 | // It should be safe to call this function from any context | 298 | // It should be safe to call this function from any context |
299 | static int usbduxsub_unlink_InURBs(usbduxsub_t * usbduxsub_tmp) | 299 | static int usbduxsub_unlink_InURBs(usbduxsub_t *usbduxsub_tmp) |
300 | { | 300 | { |
301 | int i = 0; | 301 | int i = 0; |
302 | int err = 0; | 302 | int err = 0; |
@@ -317,10 +317,12 @@ static int usbduxsub_unlink_InURBs(usbduxsub_t * usbduxsub_tmp) | |||
317 | return err; | 317 | return err; |
318 | } | 318 | } |
319 | 319 | ||
320 | /* This will stop a running acquisition operation */ | 320 | /* |
321 | // Is called from within this driver from both the | 321 | * This will stop a running acquisition operation |
322 | // interrupt context and from comedi | 322 | * Is called from within this driver from both the |
323 | static int usbdux_ai_stop(usbduxsub_t * this_usbduxsub, int do_unlink) | 323 | * interrupt context and from comedi |
324 | */ | ||
325 | static int usbdux_ai_stop(usbduxsub_t *this_usbduxsub, int do_unlink) | ||
324 | { | 326 | { |
325 | int ret = 0; | 327 | int ret = 0; |
326 | 328 | ||
@@ -460,27 +462,26 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb) | |||
460 | 462 | ||
461 | urb->dev = this_usbduxsub->usbdev; | 463 | urb->dev = this_usbduxsub->usbdev; |
462 | 464 | ||
463 | // resubmit the urb | 465 | /* resubmit the urb */ |
464 | err = USB_SUBMIT_URB(urb); | 466 | err = USB_SUBMIT_URB(urb); |
465 | if (unlikely(err < 0)) { | 467 | if (unlikely(err < 0)) { |
466 | printk("comedi_: usbdux_: urb resubmit failed in int-context! err=%d ", err); | 468 | printk("comedi_: usbdux_: urb resubmit failed in int-context! err=%d ", err); |
467 | if (err == -EL2NSYNC) { | 469 | if (err == -EL2NSYNC) |
468 | printk("--> buggy USB host controller or bug in IRQ handler!\n"); | 470 | printk("--> buggy USB host controller or bug in IRQ handler!\n"); |
469 | } else { | 471 | else |
470 | printk("\n"); | 472 | printk("\n"); |
471 | } | ||
472 | s->async->events |= COMEDI_CB_EOA; | 473 | s->async->events |= COMEDI_CB_EOA; |
473 | s->async->events |= COMEDI_CB_ERROR; | 474 | s->async->events |= COMEDI_CB_ERROR; |
474 | comedi_event(this_usbduxsub->comedidev, s); | 475 | comedi_event(this_usbduxsub->comedidev, s); |
475 | // don't do an unlink here | 476 | /* don't do an unlink here */ |
476 | usbdux_ai_stop(this_usbduxsub, 0); | 477 | usbdux_ai_stop(this_usbduxsub, 0); |
477 | return; | 478 | return; |
478 | } | 479 | } |
479 | 480 | ||
480 | this_usbduxsub->ai_counter--; | 481 | this_usbduxsub->ai_counter--; |
481 | if (likely(this_usbduxsub->ai_counter > 0)) { | 482 | if (likely(this_usbduxsub->ai_counter > 0)) |
482 | return; | 483 | return; |
483 | } | 484 | |
484 | // timer zero, transfer measurements to comedi | 485 | // timer zero, transfer measurements to comedi |
485 | this_usbduxsub->ai_counter = this_usbduxsub->ai_timer; | 486 | this_usbduxsub->ai_counter = this_usbduxsub->ai_timer; |
486 | 487 | ||
@@ -518,17 +519,16 @@ static void usbduxsub_ai_IsocIrq(struct urb *urb) | |||
518 | comedi_event(this_usbduxsub->comedidev, s); | 519 | comedi_event(this_usbduxsub->comedidev, s); |
519 | } | 520 | } |
520 | 521 | ||
521 | static int usbduxsub_unlink_OutURBs(usbduxsub_t * usbduxsub_tmp) | 522 | static int usbduxsub_unlink_OutURBs(usbduxsub_t *usbduxsub_tmp) |
522 | { | 523 | { |
523 | int i = 0; | 524 | int i = 0; |
524 | |||
525 | int err = 0; | 525 | int err = 0; |
526 | 526 | ||
527 | if (usbduxsub_tmp && usbduxsub_tmp->urbOut) { | 527 | if (usbduxsub_tmp && usbduxsub_tmp->urbOut) { |
528 | for (i = 0; i < usbduxsub_tmp->numOfOutBuffers; i++) { | 528 | for (i = 0; i < usbduxsub_tmp->numOfOutBuffers; i++) { |
529 | if (usbduxsub_tmp->urbOut[i]) { | 529 | if (usbduxsub_tmp->urbOut[i]) |
530 | usb_kill_urb(usbduxsub_tmp->urbOut[i]); | 530 | usb_kill_urb(usbduxsub_tmp->urbOut[i]); |
531 | } | 531 | |
532 | #ifdef NOISY_DUX_DEBUGBUG | 532 | #ifdef NOISY_DUX_DEBUGBUG |
533 | printk("comedi: usbdux: unlinked OutURB %d: res=%d\n", | 533 | printk("comedi: usbdux: unlinked OutURB %d: res=%d\n", |
534 | i, err); | 534 | i, err); |
@@ -541,7 +541,7 @@ static int usbduxsub_unlink_OutURBs(usbduxsub_t * usbduxsub_tmp) | |||
541 | /* This will cancel a running acquisition operation | 541 | /* This will cancel a running acquisition operation |
542 | * in any context. | 542 | * in any context. |
543 | */ | 543 | */ |
544 | static int usbdux_ao_stop(usbduxsub_t * this_usbduxsub, int do_unlink) | 544 | static int usbdux_ao_stop(usbduxsub_t *this_usbduxsub, int do_unlink) |
545 | { | 545 | { |
546 | int ret = 0; | 546 | int ret = 0; |
547 | 547 | ||
@@ -554,18 +554,16 @@ static int usbdux_ao_stop(usbduxsub_t * this_usbduxsub, int do_unlink) | |||
554 | #ifdef NOISY_DUX_DEBUGBUG | 554 | #ifdef NOISY_DUX_DEBUGBUG |
555 | printk("comedi: usbdux_ao_cancel\n"); | 555 | printk("comedi: usbdux_ao_cancel\n"); |
556 | #endif | 556 | #endif |
557 | if (do_unlink) { | 557 | if (do_unlink) |
558 | ret = usbduxsub_unlink_OutURBs(this_usbduxsub); | 558 | ret = usbduxsub_unlink_OutURBs(this_usbduxsub); |
559 | } | ||
560 | 559 | ||
561 | this_usbduxsub->ao_cmd_running = 0; | 560 | this_usbduxsub->ao_cmd_running = 0; |
562 | 561 | ||
563 | return ret; | 562 | return ret; |
564 | } | 563 | } |
565 | 564 | ||
566 | // force unlink | 565 | /* force unlink, is called by comedi */ |
567 | // is called by comedi | 566 | static int usbdux_ao_cancel(comedi_device *dev, comedi_subdevice *s) |
568 | static int usbdux_ao_cancel(comedi_device * dev, comedi_subdevice * s) | ||
569 | { | 567 | { |
570 | usbduxsub_t *this_usbduxsub = dev->private; | 568 | usbduxsub_t *this_usbduxsub = dev->private; |
571 | int res = 0; | 569 | int res = 0; |
@@ -618,12 +616,12 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb) | |||
618 | /* success */ | 616 | /* success */ |
619 | break; | 617 | break; |
620 | 618 | ||
621 | // after an unlink command, unplug, ... etc | ||
622 | // no unlink needed here. Already shutting down. | ||
623 | case -ECONNRESET: | 619 | case -ECONNRESET: |
624 | case -ENOENT: | 620 | case -ENOENT: |
625 | case -ESHUTDOWN: | 621 | case -ESHUTDOWN: |
626 | case -ECONNABORTED: | 622 | case -ECONNABORTED: |
623 | // after an unlink command, unplug, ... etc | ||
624 | // no unlink needed here. Already shutting down. | ||
627 | if (this_usbduxsub->ao_cmd_running) { | 625 | if (this_usbduxsub->ao_cmd_running) { |
628 | s->async->events |= COMEDI_CB_EOA; | 626 | s->async->events |= COMEDI_CB_EOA; |
629 | comedi_event(this_usbduxsub->comedidev, s); | 627 | comedi_event(this_usbduxsub->comedidev, s); |
@@ -631,8 +629,8 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb) | |||
631 | } | 629 | } |
632 | return; | 630 | return; |
633 | 631 | ||
634 | // a real error | ||
635 | default: | 632 | default: |
633 | // a real error | ||
636 | if (this_usbduxsub->ao_cmd_running) { | 634 | if (this_usbduxsub->ao_cmd_running) { |
637 | printk("comedi_: usbdux_: Non-zero urb status received in ao intr context: %d\n", urb->status); | 635 | printk("comedi_: usbdux_: Non-zero urb status received in ao intr context: %d\n", urb->status); |
638 | s->async->events |= COMEDI_CB_ERROR; | 636 | s->async->events |= COMEDI_CB_ERROR; |
@@ -645,9 +643,9 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb) | |||
645 | } | 643 | } |
646 | 644 | ||
647 | // are we actually running? | 645 | // are we actually running? |
648 | if (!(this_usbduxsub->ao_cmd_running)) { | 646 | if (!(this_usbduxsub->ao_cmd_running)) |
649 | return; | 647 | return; |
650 | } | 648 | |
651 | // normal operation: executing a command in this subdevice | 649 | // normal operation: executing a command in this subdevice |
652 | this_usbduxsub->ao_counter--; | 650 | this_usbduxsub->ao_counter--; |
653 | if (this_usbduxsub->ao_counter <= 0) { | 651 | if (this_usbduxsub->ao_counter <= 0) { |
@@ -672,9 +670,9 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb) | |||
672 | s->async->cmd.chanlist_len; | 670 | s->async->cmd.chanlist_len; |
673 | for (i = 0; i < s->async->cmd.chanlist_len; i++) { | 671 | for (i = 0; i < s->async->cmd.chanlist_len; i++) { |
674 | sampl_t temp; | 672 | sampl_t temp; |
675 | if (i >= NUMOUTCHANNELS) { | 673 | if (i >= NUMOUTCHANNELS) |
676 | break; | 674 | break; |
677 | } | 675 | |
678 | // pointer to the DA | 676 | // pointer to the DA |
679 | datap = (&(((int8_t *) urb->transfer_buffer)[i * 3 + 1])); | 677 | datap = (&(((int8_t *) urb->transfer_buffer)[i * 3 + 1])); |
680 | // get the data from comedi | 678 | // get the data from comedi |
@@ -712,11 +710,11 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb) | |||
712 | if ((ret = USB_SUBMIT_URB(urb)) < 0) { | 710 | if ((ret = USB_SUBMIT_URB(urb)) < 0) { |
713 | printk("comedi_: usbdux_: ao urb resubm failed in int-cont."); | 711 | printk("comedi_: usbdux_: ao urb resubm failed in int-cont."); |
714 | printk("ret=%d", ret); | 712 | printk("ret=%d", ret); |
715 | if (ret == EL2NSYNC) { | 713 | if (ret == EL2NSYNC) |
716 | printk("--> buggy USB host controller or bug in IRQ handling!\n"); | 714 | printk("--> buggy USB host controller or bug in IRQ handling!\n"); |
717 | } else { | 715 | else |
718 | printk("\n"); | 716 | printk("\n"); |
719 | } | 717 | |
720 | s->async->events |= COMEDI_CB_EOA; | 718 | s->async->events |= COMEDI_CB_EOA; |
721 | s->async->events |= COMEDI_CB_ERROR; | 719 | s->async->events |= COMEDI_CB_ERROR; |
722 | comedi_event(this_usbduxsub->comedidev, s); | 720 | comedi_event(this_usbduxsub->comedidev, s); |
@@ -726,7 +724,7 @@ static void usbduxsub_ao_IsocIrq(struct urb *urb) | |||
726 | } | 724 | } |
727 | } | 725 | } |
728 | 726 | ||
729 | static int usbduxsub_start(usbduxsub_t * usbduxsub) | 727 | static int usbduxsub_start(usbduxsub_t *usbduxsub) |
730 | { | 728 | { |
731 | int errcode = 0; | 729 | int errcode = 0; |
732 | uint8_t local_transfer_buffer[16]; | 730 | uint8_t local_transfer_buffer[16]; |
@@ -759,7 +757,7 @@ static int usbduxsub_start(usbduxsub_t * usbduxsub) | |||
759 | return 0; | 757 | return 0; |
760 | } | 758 | } |
761 | 759 | ||
762 | static int usbduxsub_stop(usbduxsub_t * usbduxsub) | 760 | static int usbduxsub_stop(usbduxsub_t *usbduxsub) |
763 | { | 761 | { |
764 | int errcode = 0; | 762 | int errcode = 0; |
765 | 763 | ||
@@ -790,9 +788,9 @@ static int usbduxsub_stop(usbduxsub_t * usbduxsub) | |||
790 | return 0; | 788 | return 0; |
791 | } | 789 | } |
792 | 790 | ||
793 | static int usbduxsub_upload(usbduxsub_t * usbduxsub, | 791 | static int usbduxsub_upload(usbduxsub_t *usbduxsub, |
794 | uint8_t * local_transfer_buffer, | 792 | uint8_t *local_transfer_buffer, |
795 | unsigned int startAddr, unsigned int len) | 793 | unsigned int startAddr, unsigned int len) |
796 | { | 794 | { |
797 | int errcode; | 795 | int errcode; |
798 | 796 | ||
@@ -834,8 +832,8 @@ static int usbduxsub_upload(usbduxsub_t * usbduxsub, | |||
834 | return 0; | 832 | return 0; |
835 | } | 833 | } |
836 | 834 | ||
837 | int firmwareUpload(usbduxsub_t * usbduxsub, | 835 | static int firmwareUpload(usbduxsub_t *usbduxsub, uint8_t *firmwareBinary, |
838 | uint8_t * firmwareBinary, int sizeFirmware) | 836 | int sizeFirmware) |
839 | { | 837 | { |
840 | int ret; | 838 | int ret; |
841 | 839 | ||
@@ -860,16 +858,16 @@ int firmwareUpload(usbduxsub_t * usbduxsub, | |||
860 | return 0; | 858 | return 0; |
861 | } | 859 | } |
862 | 860 | ||
863 | int usbduxsub_submit_InURBs(usbduxsub_t * usbduxsub) | 861 | static int usbduxsub_submit_InURBs(usbduxsub_t *usbduxsub) |
864 | { | 862 | { |
865 | int i, errFlag; | 863 | int i, errFlag; |
866 | 864 | ||
867 | if (!usbduxsub) { | 865 | if (!usbduxsub) |
868 | return -EFAULT; | 866 | return -EFAULT; |
869 | } | 867 | |
870 | /* Submit all URBs and start the transfer on the bus */ | 868 | /* Submit all URBs and start the transfer on the bus */ |
871 | for (i = 0; i < usbduxsub->numOfInBuffers; i++) { | 869 | for (i = 0; i < usbduxsub->numOfInBuffers; i++) { |
872 | // in case of a resubmission after an unlink... | 870 | /* in case of a resubmission after an unlink... */ |
873 | usbduxsub->urbIn[i]->interval = usbduxsub->ai_interval; | 871 | usbduxsub->urbIn[i]->interval = usbduxsub->ai_interval; |
874 | usbduxsub->urbIn[i]->context = usbduxsub->comedidev; | 872 | usbduxsub->urbIn[i]->context = usbduxsub->comedidev; |
875 | usbduxsub->urbIn[i]->dev = usbduxsub->usbdev; | 873 | usbduxsub->urbIn[i]->dev = usbduxsub->usbdev; |
@@ -889,7 +887,7 @@ int usbduxsub_submit_InURBs(usbduxsub_t * usbduxsub) | |||
889 | return 0; | 887 | return 0; |
890 | } | 888 | } |
891 | 889 | ||
892 | int usbduxsub_submit_OutURBs(usbduxsub_t * usbduxsub) | 890 | static int usbduxsub_submit_OutURBs(usbduxsub_t *usbduxsub) |
893 | { | 891 | { |
894 | int i, errFlag; | 892 | int i, errFlag; |
895 | 893 | ||
@@ -916,8 +914,8 @@ int usbduxsub_submit_OutURBs(usbduxsub_t * usbduxsub) | |||
916 | return 0; | 914 | return 0; |
917 | } | 915 | } |
918 | 916 | ||
919 | static int usbdux_ai_cmdtest(comedi_device * dev, | 917 | static int usbdux_ai_cmdtest(comedi_device *dev, comedi_subdevice *s, |
920 | comedi_subdevice * s, comedi_cmd * cmd) | 918 | comedi_cmd *cmd) |
921 | { | 919 | { |
922 | int err = 0, tmp, i; | 920 | int err = 0, tmp, i; |
923 | unsigned int tmpTimer; | 921 | unsigned int tmpTimer; |
@@ -1072,7 +1070,7 @@ static int8_t create_adc_command(unsigned int chan, int range) | |||
1072 | #define SENDPWMON 7 | 1070 | #define SENDPWMON 7 |
1073 | #define SENDPWMOFF 8 | 1071 | #define SENDPWMOFF 8 |
1074 | 1072 | ||
1075 | static int send_dux_commands(usbduxsub_t * this_usbduxsub, int cmd_type) | 1073 | static int send_dux_commands(usbduxsub_t *this_usbduxsub, int cmd_type) |
1076 | { | 1074 | { |
1077 | int result, nsent; | 1075 | int result, nsent; |
1078 | 1076 | ||
@@ -1089,13 +1087,13 @@ static int send_dux_commands(usbduxsub_t * this_usbduxsub, int cmd_type) | |||
1089 | usb_sndbulkpipe(this_usbduxsub->usbdev, | 1087 | usb_sndbulkpipe(this_usbduxsub->usbdev, |
1090 | COMMAND_OUT_EP), | 1088 | COMMAND_OUT_EP), |
1091 | this_usbduxsub->dux_commands, SIZEOFDUXBUFFER, &nsent, 10 * HZ); | 1089 | this_usbduxsub->dux_commands, SIZEOFDUXBUFFER, &nsent, 10 * HZ); |
1092 | if (result < 0) { | 1090 | if (result < 0) |
1093 | printk("comedi%d: could not transmit dux_command to the usb-device, err=%d\n", this_usbduxsub->comedidev->minor, result); | 1091 | printk("comedi%d: could not transmit dux_command to the usb-device, err=%d\n", this_usbduxsub->comedidev->minor, result); |
1094 | } | 1092 | |
1095 | return result; | 1093 | return result; |
1096 | } | 1094 | } |
1097 | 1095 | ||
1098 | static int receive_dux_commands(usbduxsub_t * this_usbduxsub, int command) | 1096 | static int receive_dux_commands(usbduxsub_t *this_usbduxsub, int command) |
1099 | { | 1097 | { |
1100 | int result = (-EFAULT); | 1098 | int result = (-EFAULT); |
1101 | int nrec; | 1099 | int nrec; |
@@ -1119,8 +1117,8 @@ static int receive_dux_commands(usbduxsub_t * this_usbduxsub, int command) | |||
1119 | return -EFAULT; | 1117 | return -EFAULT; |
1120 | } | 1118 | } |
1121 | 1119 | ||
1122 | static int usbdux_ai_inttrig(comedi_device * dev, | 1120 | static int usbdux_ai_inttrig(comedi_device *dev, comedi_subdevice *s, |
1123 | comedi_subdevice * s, unsigned int trignum) | 1121 | unsigned int trignum) |
1124 | { | 1122 | { |
1125 | int ret; | 1123 | int ret; |
1126 | usbduxsub_t *this_usbduxsub = dev->private; | 1124 | usbduxsub_t *this_usbduxsub = dev->private; |
@@ -1160,7 +1158,7 @@ static int usbdux_ai_inttrig(comedi_device * dev, | |||
1160 | return 1; | 1158 | return 1; |
1161 | } | 1159 | } |
1162 | 1160 | ||
1163 | static int usbdux_ai_cmd(comedi_device * dev, comedi_subdevice * s) | 1161 | static int usbdux_ai_cmd(comedi_device *dev, comedi_subdevice *s) |
1164 | { | 1162 | { |
1165 | comedi_cmd *cmd = &s->async->cmd; | 1163 | comedi_cmd *cmd = &s->async->cmd; |
1166 | unsigned int chan, range; | 1164 | unsigned int chan, range; |
@@ -1171,10 +1169,10 @@ static int usbdux_ai_cmd(comedi_device * dev, comedi_subdevice * s) | |||
1171 | #ifdef NOISY_DUX_DEBUGBUG | 1169 | #ifdef NOISY_DUX_DEBUGBUG |
1172 | printk("comedi%d: usbdux_ai_cmd\n", dev->minor); | 1170 | printk("comedi%d: usbdux_ai_cmd\n", dev->minor); |
1173 | #endif | 1171 | #endif |
1174 | if (!this_usbduxsub) { | 1172 | if (!this_usbduxsub) |
1175 | return -EFAULT; | 1173 | return -EFAULT; |
1176 | } | 1174 | |
1177 | // block other CPUs from starting an ai_cmd | 1175 | /* block other CPUs from starting an ai_cmd */ |
1178 | down(&this_usbduxsub->sem); | 1176 | down(&this_usbduxsub->sem); |
1179 | 1177 | ||
1180 | if (!(this_usbduxsub->probed)) { | 1178 | if (!(this_usbduxsub->probed)) { |
@@ -1186,7 +1184,7 @@ static int usbdux_ai_cmd(comedi_device * dev, comedi_subdevice * s) | |||
1186 | up(&this_usbduxsub->sem); | 1184 | up(&this_usbduxsub->sem); |
1187 | return -EBUSY; | 1185 | return -EBUSY; |
1188 | } | 1186 | } |
1189 | // set current channel of the running aquisition to zero | 1187 | /* set current channel of the running aquisition to zero */ |
1190 | s->async->cur_chan = 0; | 1188 | s->async->cur_chan = 0; |
1191 | 1189 | ||
1192 | this_usbduxsub->dux_commands[1] = cmd->chanlist_len; | 1190 | this_usbduxsub->dux_commands[1] = cmd->chanlist_len; |
@@ -1211,20 +1209,21 @@ static int usbdux_ai_cmd(comedi_device * dev, comedi_subdevice * s) | |||
1211 | } | 1209 | } |
1212 | 1210 | ||
1213 | if (this_usbduxsub->high_speed) { | 1211 | if (this_usbduxsub->high_speed) { |
1214 | // every channel gets a time window of 125us. Thus, if we | 1212 | /* |
1215 | // sample all 8 channels we need 1ms. If we sample only | 1213 | * every channel gets a time window of 125us. Thus, if we |
1216 | // one channel we need only 125us | 1214 | * sample all 8 channels we need 1ms. If we sample only one |
1215 | * channel we need only 125us | ||
1216 | */ | ||
1217 | this_usbduxsub->ai_interval = 1; | 1217 | this_usbduxsub->ai_interval = 1; |
1218 | // find a power of 2 for the interval | 1218 | /* find a power of 2 for the interval */ |
1219 | while ((this_usbduxsub->ai_interval) < (cmd->chanlist_len)) { | 1219 | while ((this_usbduxsub->ai_interval) < (cmd->chanlist_len)) { |
1220 | this_usbduxsub->ai_interval = | 1220 | this_usbduxsub->ai_interval = |
1221 | (this_usbduxsub->ai_interval) * 2; | 1221 | (this_usbduxsub->ai_interval) * 2; |
1222 | } | 1222 | } |
1223 | this_usbduxsub->ai_timer = | 1223 | this_usbduxsub->ai_timer = cmd->scan_begin_arg / (125000 * |
1224 | cmd->scan_begin_arg / (125000 * | ||
1225 | (this_usbduxsub->ai_interval)); | 1224 | (this_usbduxsub->ai_interval)); |
1226 | } else { | 1225 | } else { |
1227 | // interval always 1ms | 1226 | /* interval always 1ms */ |
1228 | this_usbduxsub->ai_interval = 1; | 1227 | this_usbduxsub->ai_interval = 1; |
1229 | this_usbduxsub->ai_timer = cmd->scan_begin_arg / 1000000; | 1228 | this_usbduxsub->ai_timer = cmd->scan_begin_arg / 1000000; |
1230 | } | 1229 | } |
@@ -1267,8 +1266,8 @@ static int usbdux_ai_cmd(comedi_device * dev, comedi_subdevice * s) | |||
1267 | } | 1266 | } |
1268 | 1267 | ||
1269 | /* Mode 0 is used to get a single conversion on demand */ | 1268 | /* Mode 0 is used to get a single conversion on demand */ |
1270 | static int usbdux_ai_insn_read(comedi_device * dev, | 1269 | static int usbdux_ai_insn_read(comedi_device *dev, comedi_subdevice *s, |
1271 | comedi_subdevice * s, comedi_insn * insn, lsampl_t * data) | 1270 | comedi_insn *insn, lsampl_t *data) |
1272 | { | 1271 | { |
1273 | int i; | 1272 | int i; |
1274 | lsampl_t one = 0; | 1273 | lsampl_t one = 0; |
@@ -1314,9 +1313,9 @@ static int usbdux_ai_insn_read(comedi_device * dev, | |||
1314 | return 0; | 1313 | return 0; |
1315 | } | 1314 | } |
1316 | one = le16_to_cpu(this_usbduxsub->insnBuffer[1]); | 1315 | one = le16_to_cpu(this_usbduxsub->insnBuffer[1]); |
1317 | if (CR_RANGE(insn->chanspec) <= 1) { | 1316 | if (CR_RANGE(insn->chanspec) <= 1) |
1318 | one = one ^ 0x800; | 1317 | one = one ^ 0x800; |
1319 | } | 1318 | |
1320 | data[i] = one; | 1319 | data[i] = one; |
1321 | } | 1320 | } |
1322 | up(&this_usbduxsub->sem); | 1321 | up(&this_usbduxsub->sem); |
@@ -1326,30 +1325,30 @@ static int usbdux_ai_insn_read(comedi_device * dev, | |||
1326 | ////////////////// | 1325 | ////////////////// |
1327 | // analog out | 1326 | // analog out |
1328 | 1327 | ||
1329 | static int usbdux_ao_insn_read(comedi_device * dev, comedi_subdevice * s, | 1328 | static int usbdux_ao_insn_read(comedi_device *dev, comedi_subdevice *s, |
1330 | comedi_insn * insn, lsampl_t * data) | 1329 | comedi_insn *insn, lsampl_t *data) |
1331 | { | 1330 | { |
1332 | int i; | 1331 | int i; |
1333 | int chan = CR_CHAN(insn->chanspec); | 1332 | int chan = CR_CHAN(insn->chanspec); |
1334 | usbduxsub_t *this_usbduxsub = dev->private; | 1333 | usbduxsub_t *this_usbduxsub = dev->private; |
1335 | 1334 | ||
1336 | if (!this_usbduxsub) { | 1335 | if (!this_usbduxsub) |
1337 | return -EFAULT; | 1336 | return -EFAULT; |
1338 | } | 1337 | |
1339 | down(&this_usbduxsub->sem); | 1338 | down(&this_usbduxsub->sem); |
1340 | if (!(this_usbduxsub->probed)) { | 1339 | if (!(this_usbduxsub->probed)) { |
1341 | up(&this_usbduxsub->sem); | 1340 | up(&this_usbduxsub->sem); |
1342 | return -ENODEV; | 1341 | return -ENODEV; |
1343 | } | 1342 | } |
1344 | for (i = 0; i < insn->n; i++) { | 1343 | for (i = 0; i < insn->n; i++) |
1345 | data[i] = this_usbduxsub->outBuffer[chan]; | 1344 | data[i] = this_usbduxsub->outBuffer[chan]; |
1346 | } | 1345 | |
1347 | up(&this_usbduxsub->sem); | 1346 | up(&this_usbduxsub->sem); |
1348 | return i; | 1347 | return i; |
1349 | } | 1348 | } |
1350 | 1349 | ||
1351 | static int usbdux_ao_insn_write(comedi_device * dev, comedi_subdevice * s, | 1350 | static int usbdux_ao_insn_write(comedi_device *dev, comedi_subdevice *s, |
1352 | comedi_insn * insn, lsampl_t * data) | 1351 | comedi_insn *insn, lsampl_t *data) |
1353 | { | 1352 | { |
1354 | int i, err; | 1353 | int i, err; |
1355 | int chan = CR_CHAN(insn->chanspec); | 1354 | int chan = CR_CHAN(insn->chanspec); |
@@ -1358,9 +1357,9 @@ static int usbdux_ao_insn_write(comedi_device * dev, comedi_subdevice * s, | |||
1358 | #ifdef NOISY_DUX_DEBUGBUG | 1357 | #ifdef NOISY_DUX_DEBUGBUG |
1359 | printk("comedi%d: ao_insn_write\n", dev->minor); | 1358 | printk("comedi%d: ao_insn_write\n", dev->minor); |
1360 | #endif | 1359 | #endif |
1361 | if (!this_usbduxsub) { | 1360 | if (!this_usbduxsub) |
1362 | return -EFAULT; | 1361 | return -EFAULT; |
1363 | } | 1362 | |
1364 | down(&this_usbduxsub->sem); | 1363 | down(&this_usbduxsub->sem); |
1365 | if (!(this_usbduxsub->probed)) { | 1364 | if (!(this_usbduxsub->probed)) { |
1366 | up(&this_usbduxsub->sem); | 1365 | up(&this_usbduxsub->sem); |
@@ -1396,15 +1395,15 @@ static int usbdux_ao_insn_write(comedi_device * dev, comedi_subdevice * s, | |||
1396 | return i; | 1395 | return i; |
1397 | } | 1396 | } |
1398 | 1397 | ||
1399 | static int usbdux_ao_inttrig(comedi_device * dev, comedi_subdevice * s, | 1398 | static int usbdux_ao_inttrig(comedi_device *dev, comedi_subdevice *s, |
1400 | unsigned int trignum) | 1399 | unsigned int trignum) |
1401 | { | 1400 | { |
1402 | int ret; | 1401 | int ret; |
1403 | usbduxsub_t *this_usbduxsub = dev->private; | 1402 | usbduxsub_t *this_usbduxsub = dev->private; |
1404 | 1403 | ||
1405 | if (!this_usbduxsub) { | 1404 | if (!this_usbduxsub) |
1406 | return -EFAULT; | 1405 | return -EFAULT; |
1407 | } | 1406 | |
1408 | down(&this_usbduxsub->sem); | 1407 | down(&this_usbduxsub->sem); |
1409 | if (!(this_usbduxsub->probed)) { | 1408 | if (!(this_usbduxsub->probed)) { |
1410 | up(&this_usbduxsub->sem); | 1409 | up(&this_usbduxsub->sem); |
@@ -1433,18 +1432,18 @@ static int usbdux_ao_inttrig(comedi_device * dev, comedi_subdevice * s, | |||
1433 | return 1; | 1432 | return 1; |
1434 | } | 1433 | } |
1435 | 1434 | ||
1436 | static int usbdux_ao_cmdtest(comedi_device * dev, | 1435 | static int usbdux_ao_cmdtest(comedi_device *dev, comedi_subdevice *s, |
1437 | comedi_subdevice * s, comedi_cmd * cmd) | 1436 | comedi_cmd *cmd) |
1438 | { | 1437 | { |
1439 | int err = 0, tmp; | 1438 | int err = 0, tmp; |
1440 | usbduxsub_t *this_usbduxsub = dev->private; | 1439 | usbduxsub_t *this_usbduxsub = dev->private; |
1441 | 1440 | ||
1442 | if (!this_usbduxsub) { | 1441 | if (!this_usbduxsub) |
1443 | return -EFAULT; | 1442 | return -EFAULT; |
1444 | } | 1443 | |
1445 | if (!(this_usbduxsub->probed)) { | 1444 | if (!(this_usbduxsub->probed)) |
1446 | return -ENODEV; | 1445 | return -ENODEV; |
1447 | } | 1446 | |
1448 | #ifdef NOISY_DUX_DEBUGBUG | 1447 | #ifdef NOISY_DUX_DEBUGBUG |
1449 | printk("comedi%d: usbdux_ao_cmdtest\n", dev->minor); | 1448 | printk("comedi%d: usbdux_ao_cmdtest\n", dev->minor); |
1450 | #endif | 1449 | #endif |
@@ -1566,16 +1565,16 @@ static int usbdux_ao_cmdtest(comedi_device * dev, | |||
1566 | return 0; | 1565 | return 0; |
1567 | } | 1566 | } |
1568 | 1567 | ||
1569 | static int usbdux_ao_cmd(comedi_device * dev, comedi_subdevice * s) | 1568 | static int usbdux_ao_cmd(comedi_device *dev, comedi_subdevice *s) |
1570 | { | 1569 | { |
1571 | comedi_cmd *cmd = &s->async->cmd; | 1570 | comedi_cmd *cmd = &s->async->cmd; |
1572 | unsigned int chan, gain; | 1571 | unsigned int chan, gain; |
1573 | int i, ret; | 1572 | int i, ret; |
1574 | usbduxsub_t *this_usbduxsub = dev->private; | 1573 | usbduxsub_t *this_usbduxsub = dev->private; |
1575 | 1574 | ||
1576 | if (!this_usbduxsub) { | 1575 | if (!this_usbduxsub) |
1577 | return -EFAULT; | 1576 | return -EFAULT; |
1578 | } | 1577 | |
1579 | down(&this_usbduxsub->sem); | 1578 | down(&this_usbduxsub->sem); |
1580 | if (!(this_usbduxsub->probed)) { | 1579 | if (!(this_usbduxsub->probed)) { |
1581 | up(&this_usbduxsub->sem); | 1580 | up(&this_usbduxsub->sem); |
@@ -1666,8 +1665,8 @@ static int usbdux_ao_cmd(comedi_device * dev, comedi_subdevice * s) | |||
1666 | return 0; | 1665 | return 0; |
1667 | } | 1666 | } |
1668 | 1667 | ||
1669 | static int usbdux_dio_insn_config(comedi_device * dev, | 1668 | static int usbdux_dio_insn_config(comedi_device *dev, comedi_subdevice *s, |
1670 | comedi_subdevice * s, comedi_insn * insn, lsampl_t * data) | 1669 | comedi_insn *insn, lsampl_t *data) |
1671 | { | 1670 | { |
1672 | int chan = CR_CHAN(insn->chanspec); | 1671 | int chan = CR_CHAN(insn->chanspec); |
1673 | 1672 | ||
@@ -1697,16 +1696,16 @@ static int usbdux_dio_insn_config(comedi_device * dev, | |||
1697 | return insn->n; | 1696 | return insn->n; |
1698 | } | 1697 | } |
1699 | 1698 | ||
1700 | static int usbdux_dio_insn_bits(comedi_device * dev, | 1699 | static int usbdux_dio_insn_bits(comedi_device *dev, comedi_subdevice *s, |
1701 | comedi_subdevice * s, comedi_insn * insn, lsampl_t * data) | 1700 | comedi_insn *insn, lsampl_t *data) |
1702 | { | 1701 | { |
1703 | 1702 | ||
1704 | usbduxsub_t *this_usbduxsub = dev->private; | 1703 | usbduxsub_t *this_usbduxsub = dev->private; |
1705 | int err; | 1704 | int err; |
1706 | 1705 | ||
1707 | if (!this_usbduxsub) { | 1706 | if (!this_usbduxsub) |
1708 | return -EFAULT; | 1707 | return -EFAULT; |
1709 | } | 1708 | |
1710 | 1709 | ||
1711 | if (insn->n != 2) | 1710 | if (insn->n != 2) |
1712 | return -EINVAL; | 1711 | return -EINVAL; |
@@ -1742,18 +1741,16 @@ static int usbdux_dio_insn_bits(comedi_device * dev, | |||
1742 | return 2; | 1741 | return 2; |
1743 | } | 1742 | } |
1744 | 1743 | ||
1745 | // reads the 4 counters | 1744 | /* reads the 4 counters, only two are used just now */ |
1746 | // only two are used just now | 1745 | static int usbdux_counter_read(comedi_device *dev, comedi_subdevice *s, |
1747 | static int usbdux_counter_read(comedi_device * dev, comedi_subdevice * s, | 1746 | comedi_insn *insn, lsampl_t *data) |
1748 | comedi_insn * insn, lsampl_t * data) | ||
1749 | { | 1747 | { |
1750 | usbduxsub_t *this_usbduxsub = dev->private; | 1748 | usbduxsub_t *this_usbduxsub = dev->private; |
1751 | int chan = insn->chanspec; | 1749 | int chan = insn->chanspec; |
1752 | int err; | 1750 | int err; |
1753 | 1751 | ||
1754 | if (!this_usbduxsub) { | 1752 | if (!this_usbduxsub) |
1755 | return -EFAULT; | 1753 | return -EFAULT; |
1756 | } | ||
1757 | 1754 | ||
1758 | down(&this_usbduxsub->sem); | 1755 | down(&this_usbduxsub->sem); |
1759 | 1756 | ||
@@ -1778,15 +1775,14 @@ static int usbdux_counter_read(comedi_device * dev, comedi_subdevice * s, | |||
1778 | return 1; | 1775 | return 1; |
1779 | } | 1776 | } |
1780 | 1777 | ||
1781 | static int usbdux_counter_write(comedi_device * dev, comedi_subdevice * s, | 1778 | static int usbdux_counter_write(comedi_device *dev, comedi_subdevice *s, |
1782 | comedi_insn * insn, lsampl_t * data) | 1779 | comedi_insn *insn, lsampl_t *data) |
1783 | { | 1780 | { |
1784 | usbduxsub_t *this_usbduxsub = dev->private; | 1781 | usbduxsub_t *this_usbduxsub = dev->private; |
1785 | int err; | 1782 | int err; |
1786 | 1783 | ||
1787 | if (!this_usbduxsub) { | 1784 | if (!this_usbduxsub) |
1788 | return -EFAULT; | 1785 | return -EFAULT; |
1789 | } | ||
1790 | 1786 | ||
1791 | down(&this_usbduxsub->sem); | 1787 | down(&this_usbduxsub->sem); |
1792 | 1788 | ||
@@ -1808,8 +1804,8 @@ static int usbdux_counter_write(comedi_device * dev, comedi_subdevice * s, | |||
1808 | return 1; | 1804 | return 1; |
1809 | } | 1805 | } |
1810 | 1806 | ||
1811 | static int usbdux_counter_config(comedi_device * dev, comedi_subdevice * s, | 1807 | static int usbdux_counter_config(comedi_device *dev, comedi_subdevice *s, |
1812 | comedi_insn * insn, lsampl_t * data) | 1808 | comedi_insn *insn, lsampl_t *data) |
1813 | { | 1809 | { |
1814 | // nothing to do so far | 1810 | // nothing to do so far |
1815 | return 2; | 1811 | return 2; |
@@ -1818,7 +1814,7 @@ static int usbdux_counter_config(comedi_device * dev, comedi_subdevice * s, | |||
1818 | ///////////////////////////// | 1814 | ///////////////////////////// |
1819 | // PWM | 1815 | // PWM |
1820 | 1816 | ||
1821 | static int usbduxsub_unlink_PwmURBs(usbduxsub_t * usbduxsub_tmp) | 1817 | static int usbduxsub_unlink_PwmURBs(usbduxsub_t *usbduxsub_tmp) |
1822 | { | 1818 | { |
1823 | int err = 0; | 1819 | int err = 0; |
1824 | 1820 | ||
@@ -1835,7 +1831,7 @@ static int usbduxsub_unlink_PwmURBs(usbduxsub_t * usbduxsub_tmp) | |||
1835 | /* This cancels a running acquisition operation | 1831 | /* This cancels a running acquisition operation |
1836 | * in any context. | 1832 | * in any context. |
1837 | */ | 1833 | */ |
1838 | static int usbdux_pwm_stop(usbduxsub_t * this_usbduxsub, int do_unlink) | 1834 | static int usbdux_pwm_stop(usbduxsub_t *this_usbduxsub, int do_unlink) |
1839 | { | 1835 | { |
1840 | int ret = 0; | 1836 | int ret = 0; |
1841 | 1837 | ||
@@ -1848,32 +1844,30 @@ static int usbdux_pwm_stop(usbduxsub_t * this_usbduxsub, int do_unlink) | |||
1848 | #ifdef NOISY_DUX_DEBUGBUG | 1844 | #ifdef NOISY_DUX_DEBUGBUG |
1849 | printk("comedi: usbdux_pwm_cancel\n"); | 1845 | printk("comedi: usbdux_pwm_cancel\n"); |
1850 | #endif | 1846 | #endif |
1851 | if (do_unlink) { | 1847 | if (do_unlink) |
1852 | ret = usbduxsub_unlink_PwmURBs(this_usbduxsub); | 1848 | ret = usbduxsub_unlink_PwmURBs(this_usbduxsub); |
1853 | } | 1849 | |
1854 | 1850 | ||
1855 | this_usbduxsub->pwm_cmd_running = 0; | 1851 | this_usbduxsub->pwm_cmd_running = 0; |
1856 | 1852 | ||
1857 | return ret; | 1853 | return ret; |
1858 | } | 1854 | } |
1859 | 1855 | ||
1860 | // force unlink | 1856 | /* force unlink - is called by comedi */ |
1861 | // is called by comedi | 1857 | static int usbdux_pwm_cancel(comedi_device *dev, comedi_subdevice *s) |
1862 | static int usbdux_pwm_cancel(comedi_device * dev, comedi_subdevice * s) | ||
1863 | { | 1858 | { |
1864 | usbduxsub_t *this_usbduxsub = dev->private; | 1859 | usbduxsub_t *this_usbduxsub = dev->private; |
1865 | int res = 0; | 1860 | int res = 0; |
1866 | 1861 | ||
1867 | // unlink only if it is really running | 1862 | /* unlink only if it is really running */ |
1868 | res = usbdux_pwm_stop(this_usbduxsub, this_usbduxsub->pwm_cmd_running); | 1863 | res = usbdux_pwm_stop(this_usbduxsub, this_usbduxsub->pwm_cmd_running); |
1869 | 1864 | ||
1870 | #ifdef NOISY_DUX_DEBUGBUG | 1865 | #ifdef NOISY_DUX_DEBUGBUG |
1871 | printk("comedi %d: sending pwm off command to the usb device.\n", | 1866 | printk("comedi %d: sending pwm off command to the usb device.\n", |
1872 | dev->minor); | 1867 | dev->minor); |
1873 | #endif | 1868 | #endif |
1874 | if ((res = send_dux_commands(this_usbduxsub, SENDPWMOFF)) < 0) { | 1869 | if ((res = send_dux_commands(this_usbduxsub, SENDPWMOFF)) < 0) |
1875 | return res; | 1870 | return res; |
1876 | } | ||
1877 | 1871 | ||
1878 | return res; | 1872 | return res; |
1879 | } | 1873 | } |
@@ -1911,19 +1905,21 @@ static void usbduxsub_pwm_irq(struct urb *urb) | |||
1911 | /* success */ | 1905 | /* success */ |
1912 | break; | 1906 | break; |
1913 | 1907 | ||
1914 | // after an unlink command, unplug, ... etc | ||
1915 | // no unlink needed here. Already shutting down. | ||
1916 | case -ECONNRESET: | 1908 | case -ECONNRESET: |
1917 | case -ENOENT: | 1909 | case -ENOENT: |
1918 | case -ESHUTDOWN: | 1910 | case -ESHUTDOWN: |
1919 | case -ECONNABORTED: | 1911 | case -ECONNABORTED: |
1920 | if (this_usbduxsub->pwm_cmd_running) { | 1912 | /* |
1913 | * after an unlink command, unplug, ... etc | ||
1914 | * no unlink needed here. Already shutting down. | ||
1915 | */ | ||
1916 | if (this_usbduxsub->pwm_cmd_running) | ||
1921 | usbdux_pwm_stop(this_usbduxsub, 0); | 1917 | usbdux_pwm_stop(this_usbduxsub, 0); |
1922 | } | 1918 | |
1923 | return; | 1919 | return; |
1924 | 1920 | ||
1925 | // a real error | ||
1926 | default: | 1921 | default: |
1922 | /* a real error */ | ||
1927 | if (this_usbduxsub->pwm_cmd_running) { | 1923 | if (this_usbduxsub->pwm_cmd_running) { |
1928 | printk("comedi_: usbdux_: Non-zero urb status received in pwm intr context: %d\n", urb->status); | 1924 | printk("comedi_: usbdux_: Non-zero urb status received in pwm intr context: %d\n", urb->status); |
1929 | usbdux_pwm_stop(this_usbduxsub, 0); | 1925 | usbdux_pwm_stop(this_usbduxsub, 0); |
@@ -1931,10 +1927,9 @@ static void usbduxsub_pwm_irq(struct urb *urb) | |||
1931 | return; | 1927 | return; |
1932 | } | 1928 | } |
1933 | 1929 | ||
1934 | // are we actually running? | 1930 | /* are we actually running? */ |
1935 | if (!(this_usbduxsub->pwm_cmd_running)) { | 1931 | if (!(this_usbduxsub->pwm_cmd_running)) |
1936 | return; | 1932 | return; |
1937 | } | ||
1938 | 1933 | ||
1939 | urb->transfer_buffer_length = this_usbduxsub->sizePwmBuf; | 1934 | urb->transfer_buffer_length = this_usbduxsub->sizePwmBuf; |
1940 | urb->dev = this_usbduxsub->usbdev; | 1935 | urb->dev = this_usbduxsub->usbdev; |
@@ -1943,24 +1938,24 @@ static void usbduxsub_pwm_irq(struct urb *urb) | |||
1943 | if ((ret = USB_SUBMIT_URB(urb)) < 0) { | 1938 | if ((ret = USB_SUBMIT_URB(urb)) < 0) { |
1944 | printk("comedi_: usbdux_: pwm urb resubm failed in int-cont."); | 1939 | printk("comedi_: usbdux_: pwm urb resubm failed in int-cont."); |
1945 | printk("ret=%d", ret); | 1940 | printk("ret=%d", ret); |
1946 | if (ret == EL2NSYNC) { | 1941 | if (ret == EL2NSYNC) |
1947 | printk("--> buggy USB host controller or bug in IRQ handling!\n"); | 1942 | printk("--> buggy USB host controller or bug in IRQ handling!\n"); |
1948 | } else { | 1943 | else |
1949 | printk("\n"); | 1944 | printk("\n"); |
1950 | } | 1945 | |
1951 | // don't do an unlink here | 1946 | /* don't do an unlink here */ |
1952 | usbdux_pwm_stop(this_usbduxsub, 0); | 1947 | usbdux_pwm_stop(this_usbduxsub, 0); |
1953 | } | 1948 | } |
1954 | } | 1949 | } |
1955 | } | 1950 | } |
1956 | 1951 | ||
1957 | int usbduxsub_submit_PwmURBs(usbduxsub_t * usbduxsub) | 1952 | static int usbduxsub_submit_PwmURBs(usbduxsub_t *usbduxsub) |
1958 | { | 1953 | { |
1959 | int errFlag; | 1954 | int errFlag; |
1960 | 1955 | ||
1961 | if (!usbduxsub) { | 1956 | if (!usbduxsub) |
1962 | return -EFAULT; | 1957 | return -EFAULT; |
1963 | } | 1958 | |
1964 | #ifdef NOISY_DUX_DEBUGBUG | 1959 | #ifdef NOISY_DUX_DEBUGBUG |
1965 | printk("comedi_: usbdux: submitting pwm-urb\n"); | 1960 | printk("comedi_: usbdux: submitting pwm-urb\n"); |
1966 | #endif | 1961 | #endif |
@@ -1982,13 +1977,13 @@ int usbduxsub_submit_PwmURBs(usbduxsub_t * usbduxsub) | |||
1982 | return 0; | 1977 | return 0; |
1983 | } | 1978 | } |
1984 | 1979 | ||
1985 | static int usbdux_pwm_period(comedi_device * dev, comedi_subdevice * s, | 1980 | static int usbdux_pwm_period(comedi_device *dev, comedi_subdevice *s, |
1986 | lsampl_t period) | 1981 | lsampl_t period) |
1987 | { | 1982 | { |
1988 | usbduxsub_t *this_usbduxsub = dev->private; | 1983 | usbduxsub_t *this_usbduxsub = dev->private; |
1989 | int fx2delay=255; | 1984 | int fx2delay = 255; |
1990 | if (period < MIN_PWM_PERIOD) | 1985 | |
1991 | { | 1986 | if (period < MIN_PWM_PERIOD) { |
1992 | printk("comedi%d: illegal period setting for pwm.\n", dev->minor); | 1987 | printk("comedi%d: illegal period setting for pwm.\n", dev->minor); |
1993 | return -EAGAIN; | 1988 | return -EAGAIN; |
1994 | } else { | 1989 | } else { |
@@ -1999,10 +1994,10 @@ static int usbdux_pwm_period(comedi_device * dev, comedi_subdevice * s, | |||
1999 | return -EAGAIN; | 1994 | return -EAGAIN; |
2000 | } | 1995 | } |
2001 | } | 1996 | } |
2002 | this_usbduxsub->pwmDelay=fx2delay; | 1997 | this_usbduxsub->pwmDelay = fx2delay; |
2003 | this_usbduxsub->pwmPeriod=period; | 1998 | this_usbduxsub->pwmPeriod = period; |
2004 | #ifdef NOISY_DUX_DEBUGBUG | 1999 | #ifdef NOISY_DUX_DEBUGBUG |
2005 | printk("usbdux_pwm_period: frequ=%d, period=%d\n",period,fx2delay); | 2000 | printk("usbdux_pwm_period: frequ=%d, period=%d\n", period, fx2delay); |
2006 | #endif | 2001 | #endif |
2007 | return 0; | 2002 | return 0; |
2008 | } | 2003 | } |
@@ -2098,37 +2093,36 @@ static int usbdux_pwm_write(comedi_device * dev, comedi_subdevice * s, | |||
2098 | 2093 | ||
2099 | // the sign is set via a special INSN only, this gives us 8 bits for | 2094 | // the sign is set via a special INSN only, this gives us 8 bits for |
2100 | // normal operation | 2095 | // normal operation |
2101 | return usbdux_pwm_pattern(dev,s, | 2096 | // relay sign 0 by default |
2102 | CR_CHAN(insn->chanspec), | 2097 | return usbdux_pwm_pattern(dev, s, CR_CHAN(insn->chanspec), |
2103 | data[0], | 2098 | data[0], 0); |
2104 | 0); // relay sign 0 by default | ||
2105 | } | 2099 | } |
2106 | 2100 | ||
2107 | 2101 | static int usbdux_pwm_read(comedi_device *x1, comedi_subdevice *x2, | |
2108 | static int usbdux_pwm_read(comedi_device * x1, comedi_subdevice * x2, | 2102 | comedi_insn *x3, lsampl_t *x4) |
2109 | comedi_insn * x3, lsampl_t * x4) | ||
2110 | { | 2103 | { |
2111 | // not needed | 2104 | /* not needed */ |
2112 | return -EINVAL; | 2105 | return -EINVAL; |
2113 | }; | 2106 | }; |
2114 | 2107 | ||
2115 | // switches on/off PWM | 2108 | /* switches on/off PWM */ |
2116 | static int usbdux_pwm_config(comedi_device * dev, comedi_subdevice * s, | 2109 | static int usbdux_pwm_config(comedi_device *dev, comedi_subdevice *s, |
2117 | comedi_insn * insn, lsampl_t * data) | 2110 | comedi_insn *insn, lsampl_t *data) |
2118 | { | 2111 | { |
2119 | usbduxsub_t *this_usbduxsub = dev->private; | 2112 | usbduxsub_t *this_usbduxsub = dev->private; |
2120 | switch (data[0]) { | 2113 | switch (data[0]) { |
2121 | case INSN_CONFIG_ARM: | 2114 | case INSN_CONFIG_ARM: |
2122 | #ifdef NOISY_DUX_DEBUGBUG | 2115 | #ifdef NOISY_DUX_DEBUGBUG |
2123 | // switch it on | 2116 | /* switch it on */ |
2124 | printk("comedi%d: pwm_insn_config: pwm on\n", | 2117 | printk("comedi%d: pwm_insn_config: pwm on\n", |
2125 | dev->minor); | 2118 | dev->minor); |
2126 | #endif | 2119 | #endif |
2127 | // if not zero the PWM is limited to a certain time which is | 2120 | /* |
2128 | // not supported here | 2121 | * if not zero the PWM is limited to a certain time which is |
2129 | if (data[1]!=0) { | 2122 | * not supported here |
2123 | */ | ||
2124 | if (data[1] != 0) | ||
2130 | return -EINVAL; | 2125 | return -EINVAL; |
2131 | } | ||
2132 | return usbdux_pwm_start(dev, s); | 2126 | return usbdux_pwm_start(dev, s); |
2133 | case INSN_CONFIG_DISARM: | 2127 | case INSN_CONFIG_DISARM: |
2134 | #ifdef NOISY_DUX_DEBUGBUG | 2128 | #ifdef NOISY_DUX_DEBUGBUG |
@@ -2137,8 +2131,10 @@ static int usbdux_pwm_config(comedi_device * dev, comedi_subdevice * s, | |||
2137 | #endif | 2131 | #endif |
2138 | return usbdux_pwm_cancel(dev, s); | 2132 | return usbdux_pwm_cancel(dev, s); |
2139 | case INSN_CONFIG_GET_PWM_STATUS: | 2133 | case INSN_CONFIG_GET_PWM_STATUS: |
2140 | // to check if the USB transmission has failed or in case | 2134 | /* |
2141 | // PWM was limited to n cycles to check if it has terminated | 2135 | * to check if the USB transmission has failed or in case PWM |
2136 | * was limited to n cycles to check if it has terminated | ||
2137 | */ | ||
2142 | data[1] = this_usbduxsub->pwm_cmd_running; | 2138 | data[1] = this_usbduxsub->pwm_cmd_running; |
2143 | return 0; | 2139 | return 0; |
2144 | case INSN_CONFIG_PWM_SET_PERIOD: | 2140 | case INSN_CONFIG_PWM_SET_PERIOD: |
@@ -2146,37 +2142,41 @@ static int usbdux_pwm_config(comedi_device * dev, comedi_subdevice * s, | |||
2146 | printk("comedi%d: pwm_insn_config: setting period\n", | 2142 | printk("comedi%d: pwm_insn_config: setting period\n", |
2147 | dev->minor); | 2143 | dev->minor); |
2148 | #endif | 2144 | #endif |
2149 | return usbdux_pwm_period(dev,s,data[1]); | 2145 | return usbdux_pwm_period(dev, s, data[1]); |
2150 | case INSN_CONFIG_PWM_GET_PERIOD: | 2146 | case INSN_CONFIG_PWM_GET_PERIOD: |
2151 | data[1] = this_usbduxsub->pwmPeriod; | 2147 | data[1] = this_usbduxsub->pwmPeriod; |
2152 | return 0; | 2148 | return 0; |
2153 | case INSN_CONFIG_PWM_SET_H_BRIDGE: | 2149 | case INSN_CONFIG_PWM_SET_H_BRIDGE: |
2154 | // value in the first byte and the sign in the second for a relay | 2150 | /* value in the first byte and the sign in the second for a |
2151 | relay */ | ||
2155 | return usbdux_pwm_pattern(dev, s, | 2152 | return usbdux_pwm_pattern(dev, s, |
2156 | CR_CHAN(insn->chanspec), // the channel number | 2153 | /* the channel number */ |
2157 | data[1], // actual PWM data | 2154 | CR_CHAN(insn->chanspec), |
2158 | (data[2]!=0)); // just a sign | 2155 | /* actual PWM data */ |
2156 | data[1], | ||
2157 | /* just a sign */ | ||
2158 | (data[2] != 0)); | ||
2159 | case INSN_CONFIG_PWM_GET_H_BRIDGE: | 2159 | case INSN_CONFIG_PWM_GET_H_BRIDGE: |
2160 | // values are not kept in this driver, nothing to return here | 2160 | /* values are not kept in this driver, nothing to return here */ |
2161 | return -EINVAL; | 2161 | return -EINVAL; |
2162 | } | 2162 | } |
2163 | return -EINVAL; | 2163 | return -EINVAL; |
2164 | } | 2164 | } |
2165 | 2165 | ||
2166 | // end of PWM | 2166 | /* end of PWM */ |
2167 | /////////////////////////////////////////////////////////////////// | 2167 | /*****************************************************************/ |
2168 | 2168 | ||
2169 | static void tidy_up(usbduxsub_t * usbduxsub_tmp) | 2169 | static void tidy_up(usbduxsub_t *usbduxsub_tmp) |
2170 | { | 2170 | { |
2171 | int i; | 2171 | int i; |
2172 | 2172 | ||
2173 | #ifdef CONFIG_COMEDI_DEBUG | 2173 | #ifdef CONFIG_COMEDI_DEBUG |
2174 | printk("comedi_: usbdux: tiding up\n"); | 2174 | printk("comedi_: usbdux: tiding up\n"); |
2175 | #endif | 2175 | #endif |
2176 | if (!usbduxsub_tmp) { | 2176 | if (!usbduxsub_tmp) |
2177 | return; | 2177 | return; |
2178 | } | 2178 | |
2179 | // shows the usb subsystem that the driver is down | 2179 | /* shows the usb subsystem that the driver is down */ |
2180 | if (usbduxsub_tmp->interface) | 2180 | if (usbduxsub_tmp->interface) |
2181 | usb_set_intfdata(usbduxsub_tmp->interface, NULL); | 2181 | usb_set_intfdata(usbduxsub_tmp->interface, NULL); |
2182 | 2182 | ||
@@ -2227,34 +2227,22 @@ static void tidy_up(usbduxsub_t * usbduxsub_tmp) | |||
2227 | usbduxsub_tmp->pwm_cmd_running = 0; | 2227 | usbduxsub_tmp->pwm_cmd_running = 0; |
2228 | usbduxsub_unlink_PwmURBs(usbduxsub_tmp); | 2228 | usbduxsub_unlink_PwmURBs(usbduxsub_tmp); |
2229 | } | 2229 | } |
2230 | if (usbduxsub_tmp->urbPwm->transfer_buffer) { | 2230 | kfree(usbduxsub_tmp->urbPwm->transfer_buffer); |
2231 | kfree(usbduxsub_tmp->urbPwm->transfer_buffer); | 2231 | usbduxsub_tmp->urbPwm->transfer_buffer = NULL; |
2232 | usbduxsub_tmp->urbPwm->transfer_buffer = NULL; | ||
2233 | } | ||
2234 | usb_kill_urb(usbduxsub_tmp->urbPwm); | 2232 | usb_kill_urb(usbduxsub_tmp->urbPwm); |
2235 | usb_free_urb(usbduxsub_tmp->urbPwm); | 2233 | usb_free_urb(usbduxsub_tmp->urbPwm); |
2236 | usbduxsub_tmp->urbPwm = NULL; | 2234 | usbduxsub_tmp->urbPwm = NULL; |
2237 | } | 2235 | } |
2238 | if (usbduxsub_tmp->inBuffer) { | 2236 | kfree(usbduxsub_tmp->inBuffer); |
2239 | kfree(usbduxsub_tmp->inBuffer); | 2237 | usbduxsub_tmp->inBuffer = NULL; |
2240 | usbduxsub_tmp->inBuffer = NULL; | 2238 | kfree(usbduxsub_tmp->insnBuffer); |
2241 | } | 2239 | usbduxsub_tmp->insnBuffer = NULL; |
2242 | if (usbduxsub_tmp->insnBuffer) { | 2240 | kfree(usbduxsub_tmp->inBuffer); |
2243 | kfree(usbduxsub_tmp->insnBuffer); | 2241 | usbduxsub_tmp->inBuffer = NULL; |
2244 | usbduxsub_tmp->insnBuffer = NULL; | 2242 | kfree(usbduxsub_tmp->dac_commands); |
2245 | } | 2243 | usbduxsub_tmp->dac_commands = NULL; |
2246 | if (usbduxsub_tmp->inBuffer) { | 2244 | kfree(usbduxsub_tmp->dux_commands); |
2247 | kfree(usbduxsub_tmp->inBuffer); | 2245 | usbduxsub_tmp->dux_commands = NULL; |
2248 | usbduxsub_tmp->inBuffer = NULL; | ||
2249 | } | ||
2250 | if (usbduxsub_tmp->dac_commands) { | ||
2251 | kfree(usbduxsub_tmp->dac_commands); | ||
2252 | usbduxsub_tmp->dac_commands = NULL; | ||
2253 | } | ||
2254 | if (usbduxsub_tmp->dux_commands) { | ||
2255 | kfree(usbduxsub_tmp->dux_commands); | ||
2256 | usbduxsub_tmp->dux_commands = NULL; | ||
2257 | } | ||
2258 | usbduxsub_tmp->ai_cmd_running = 0; | 2246 | usbduxsub_tmp->ai_cmd_running = 0; |
2259 | usbduxsub_tmp->ao_cmd_running = 0; | 2247 | usbduxsub_tmp->ao_cmd_running = 0; |
2260 | usbduxsub_tmp->pwm_cmd_running = 0; | 2248 | usbduxsub_tmp->pwm_cmd_running = 0; |
@@ -2263,24 +2251,25 @@ static void tidy_up(usbduxsub_t * usbduxsub_tmp) | |||
2263 | static unsigned hex2unsigned(char *h) | 2251 | static unsigned hex2unsigned(char *h) |
2264 | { | 2252 | { |
2265 | unsigned hi, lo; | 2253 | unsigned hi, lo; |
2266 | if (h[0] > '9') { | 2254 | |
2255 | if (h[0] > '9') | ||
2267 | hi = h[0] - 'A' + 0x0a; | 2256 | hi = h[0] - 'A' + 0x0a; |
2268 | } else { | 2257 | else |
2269 | hi = h[0] - '0'; | 2258 | hi = h[0] - '0'; |
2270 | } | 2259 | |
2271 | if (h[1] > '9') { | 2260 | if (h[1] > '9') |
2272 | lo = h[1] - 'A' + 0x0a; | 2261 | lo = h[1] - 'A' + 0x0a; |
2273 | } else { | 2262 | else |
2274 | lo = h[1] - '0'; | 2263 | lo = h[1] - '0'; |
2275 | } | 2264 | |
2276 | return hi * 0x10 + lo; | 2265 | return hi * 0x10 + lo; |
2277 | } | 2266 | } |
2278 | 2267 | ||
2279 | // for FX2 | 2268 | /* for FX2 */ |
2280 | #define FIRMWARE_MAX_LEN 0x2000 | 2269 | #define FIRMWARE_MAX_LEN 0x2000 |
2281 | 2270 | ||
2282 | // taken from David Brownell's fxload and adjusted for this driver | 2271 | /* taken from David Brownell's fxload and adjusted for this driver */ |
2283 | static int read_firmware(usbduxsub_t * usbduxsub, void *firmwarePtr, long size) | 2272 | static int read_firmware(usbduxsub_t *usbduxsub, void *firmwarePtr, long size) |
2284 | { | 2273 | { |
2285 | int i = 0; | 2274 | int i = 0; |
2286 | unsigned char *fp = (char *)firmwarePtr; | 2275 | unsigned char *fp = (char *)firmwarePtr; |
@@ -2335,9 +2324,9 @@ static int read_firmware(usbduxsub_t * usbduxsub, void *firmwarePtr, long size) | |||
2335 | /* Read the target offset */ | 2324 | /* Read the target offset */ |
2336 | off = (hex2unsigned(buf + 3) * 0x0100) + hex2unsigned(buf + 5); | 2325 | off = (hex2unsigned(buf + 3) * 0x0100) + hex2unsigned(buf + 5); |
2337 | 2326 | ||
2338 | if ((off + len) > maxAddr) { | 2327 | if ((off + len) > maxAddr) |
2339 | maxAddr = off + len; | 2328 | maxAddr = off + len; |
2340 | } | 2329 | |
2341 | 2330 | ||
2342 | if (maxAddr >= FIRMWARE_MAX_LEN) { | 2331 | if (maxAddr >= FIRMWARE_MAX_LEN) { |
2343 | printk("comedi_: usbdux: firmware upload goes beyond FX2 RAM boundaries."); | 2332 | printk("comedi_: usbdux: firmware upload goes beyond FX2 RAM boundaries."); |
@@ -2349,9 +2338,9 @@ static int read_firmware(usbduxsub_t * usbduxsub, void *firmwarePtr, long size) | |||
2349 | type = hex2unsigned(buf + 7); | 2338 | type = hex2unsigned(buf + 7); |
2350 | 2339 | ||
2351 | /* If this is an EOF record, then make it so. */ | 2340 | /* If this is an EOF record, then make it so. */ |
2352 | if (type == 1) { | 2341 | if (type == 1) |
2353 | break; | 2342 | break; |
2354 | } | 2343 | |
2355 | 2344 | ||
2356 | if (type != 0) { | 2345 | if (type != 0) { |
2357 | printk("comedi_: usbdux: unsupported record type: %u\n", | 2346 | printk("comedi_: usbdux: unsupported record type: %u\n", |
@@ -2466,20 +2455,20 @@ static int usbduxsub_probe(struct usb_interface *uinterf, | |||
2466 | up(&start_stop_sem); | 2455 | up(&start_stop_sem); |
2467 | return PROBE_ERR_RETURN(-ENOMEM); | 2456 | return PROBE_ERR_RETURN(-ENOMEM); |
2468 | } | 2457 | } |
2469 | // setting to alternate setting 3: enabling iso ep and bulk ep. | 2458 | /* setting to alternate setting 3: enabling iso ep and bulk ep. */ |
2470 | i = usb_set_interface(usbduxsub[index].usbdev, | 2459 | i = usb_set_interface(usbduxsub[index].usbdev, |
2471 | usbduxsub[index].ifnum, 3); | 2460 | usbduxsub[index].ifnum, 3); |
2472 | if (i < 0) { | 2461 | if (i < 0) { |
2473 | printk("comedi_: usbdux%d: could not set alternate setting 3 in high speed.\n", index); | 2462 | printk("comedi_: usbdux%d: could not set alternate setting 3 in high speed.\n", index); |
2474 | tidy_up(&(usbduxsub[index])); | 2463 | tidy_up(&(usbduxsub[index])); |
2475 | up(&start_stop_sem); | 2464 | up(&start_stop_sem); |
2476 | return PROBE_ERR_RETURN(-ENODEV); | 2465 | return PROBE_ERR_RETURN(-ENODEV); |
2477 | } | 2466 | } |
2478 | if (usbduxsub[index].high_speed) { | 2467 | if (usbduxsub[index].high_speed) |
2479 | usbduxsub[index].numOfInBuffers = NUMOFINBUFFERSHIGH; | 2468 | usbduxsub[index].numOfInBuffers = NUMOFINBUFFERSHIGH; |
2480 | } else { | 2469 | else |
2481 | usbduxsub[index].numOfInBuffers = NUMOFINBUFFERSFULL; | 2470 | usbduxsub[index].numOfInBuffers = NUMOFINBUFFERSFULL; |
2482 | } | 2471 | |
2483 | usbduxsub[index].urbIn = | 2472 | usbduxsub[index].urbIn = |
2484 | kzalloc(sizeof(struct urb *) * usbduxsub[index].numOfInBuffers, | 2473 | kzalloc(sizeof(struct urb *) * usbduxsub[index].numOfInBuffers, |
2485 | GFP_KERNEL); | 2474 | GFP_KERNEL); |
@@ -2522,12 +2511,12 @@ static int usbduxsub_probe(struct usb_interface *uinterf, | |||
2522 | usbduxsub[index].urbIn[i]->iso_frame_desc[0].length = SIZEINBUF; | 2511 | usbduxsub[index].urbIn[i]->iso_frame_desc[0].length = SIZEINBUF; |
2523 | } | 2512 | } |
2524 | 2513 | ||
2525 | // out | 2514 | /* out */ |
2526 | if (usbduxsub[index].high_speed) { | 2515 | if (usbduxsub[index].high_speed) |
2527 | usbduxsub[index].numOfOutBuffers = NUMOFOUTBUFFERSHIGH; | 2516 | usbduxsub[index].numOfOutBuffers = NUMOFOUTBUFFERSHIGH; |
2528 | } else { | 2517 | else |
2529 | usbduxsub[index].numOfOutBuffers = NUMOFOUTBUFFERSFULL; | 2518 | usbduxsub[index].numOfOutBuffers = NUMOFOUTBUFFERSFULL; |
2530 | } | 2519 | |
2531 | usbduxsub[index].urbOut = | 2520 | usbduxsub[index].urbOut = |
2532 | kzalloc(sizeof(struct urb *) * usbduxsub[index].numOfOutBuffers, | 2521 | kzalloc(sizeof(struct urb *) * usbduxsub[index].numOfOutBuffers, |
2533 | GFP_KERNEL); | 2522 | GFP_KERNEL); |
@@ -2637,8 +2626,8 @@ static void usbduxsub_disconnect(struct usb_interface *intf) | |||
2637 | #endif | 2626 | #endif |
2638 | } | 2627 | } |
2639 | 2628 | ||
2640 | // is called when comedi-config is called | 2629 | /* is called when comedi-config is called */ |
2641 | static int usbdux_attach(comedi_device * dev, comedi_devconfig * it) | 2630 | static int usbdux_attach(comedi_device *dev, comedi_devconfig *it) |
2642 | { | 2631 | { |
2643 | int ret; | 2632 | int ret; |
2644 | int index; | 2633 | int index; |
@@ -2799,7 +2788,7 @@ static int usbdux_attach(comedi_device * dev, comedi_devconfig * it) | |||
2799 | return 0; | 2788 | return 0; |
2800 | } | 2789 | } |
2801 | 2790 | ||
2802 | static int usbdux_detach(comedi_device * dev) | 2791 | static int usbdux_detach(comedi_device *dev) |
2803 | { | 2792 | { |
2804 | usbduxsub_t *usbduxsub_tmp; | 2793 | usbduxsub_t *usbduxsub_tmp; |
2805 | 2794 | ||
@@ -2833,10 +2822,10 @@ static int usbdux_detach(comedi_device * dev) | |||
2833 | 2822 | ||
2834 | /* main driver struct */ | 2823 | /* main driver struct */ |
2835 | static comedi_driver driver_usbdux = { | 2824 | static comedi_driver driver_usbdux = { |
2836 | driver_name:"usbdux", | 2825 | .driver_name = "usbdux", |
2837 | module:THIS_MODULE, | 2826 | .module = THIS_MODULE, |
2838 | attach:usbdux_attach, | 2827 | .attach = usbdux_attach, |
2839 | detach:usbdux_detach, | 2828 | .detach = usbdux_detach, |
2840 | }; | 2829 | }; |
2841 | 2830 | ||
2842 | static void init_usb_devices(void) | 2831 | static void init_usb_devices(void) |
@@ -2854,26 +2843,21 @@ static void init_usb_devices(void) | |||
2854 | } | 2843 | } |
2855 | } | 2844 | } |
2856 | 2845 | ||
2857 | // Table with the USB-devices: just now only testing IDs | 2846 | /* Table with the USB-devices: just now only testing IDs */ |
2858 | static struct usb_device_id usbduxsub_table[] = { | 2847 | static struct usb_device_id usbduxsub_table[] = { |
2859 | {USB_DEVICE(0x13d8, 0x0001), | 2848 | {USB_DEVICE(0x13d8, 0x0001) }, |
2860 | }, | 2849 | {USB_DEVICE(0x13d8, 0x0002) }, |
2861 | {USB_DEVICE(0x13d8, 0x0002) | ||
2862 | }, | ||
2863 | {} /* Terminating entry */ | 2850 | {} /* Terminating entry */ |
2864 | }; | 2851 | }; |
2865 | 2852 | ||
2866 | MODULE_DEVICE_TABLE(usb, usbduxsub_table); | 2853 | MODULE_DEVICE_TABLE(usb, usbduxsub_table); |
2867 | 2854 | ||
2868 | // The usbduxsub-driver | 2855 | /* The usbduxsub-driver */ |
2869 | static struct usb_driver usbduxsub_driver = { | 2856 | static struct usb_driver usbduxsub_driver = { |
2870 | #ifdef COMEDI_HAVE_USB_DRIVER_OWNER | 2857 | .name = BOARDNAME, |
2871 | owner:THIS_MODULE, | 2858 | .probe = usbduxsub_probe, |
2872 | #endif | 2859 | .disconnect = usbduxsub_disconnect, |
2873 | name:BOARDNAME, | 2860 | .id_table = usbduxsub_table, |
2874 | probe:usbduxsub_probe, | ||
2875 | disconnect:usbduxsub_disconnect, | ||
2876 | id_table:usbduxsub_table, | ||
2877 | }; | 2861 | }; |
2878 | 2862 | ||
2879 | // Can't use the nice macro as I have also to initialise the USB | 2863 | // Can't use the nice macro as I have also to initialise the USB |