diff options
author | Karsten Keil <kkeil@suse.de> | 2005-09-17 17:52:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-17 18:34:30 -0400 |
commit | 61ffcafafb3d985e1ab8463be0187b421614775c (patch) | |
tree | 0a40902d91a5db72c5fd5d71aa4e1bb625a4faca /drivers/isdn/hisax | |
parent | 27b2f6792f3b482e4636818c7efaf4c43fef32a3 (diff) |
[PATCH] Fix ST 5481 USB driver
The old driver was not fully adapted to new USB ABI and does not
work.
Signed-off-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/hisax')
-rw-r--r-- | drivers/isdn/hisax/st5481.h | 4 | ||||
-rw-r--r-- | drivers/isdn/hisax/st5481_b.c | 22 | ||||
-rw-r--r-- | drivers/isdn/hisax/st5481_d.c | 26 | ||||
-rw-r--r-- | drivers/isdn/hisax/st5481_init.c | 4 | ||||
-rw-r--r-- | drivers/isdn/hisax/st5481_usb.c | 70 |
5 files changed, 76 insertions, 50 deletions
diff --git a/drivers/isdn/hisax/st5481.h b/drivers/isdn/hisax/st5481.h index 0fda5c89429b..9ffaae7c657a 100644 --- a/drivers/isdn/hisax/st5481.h +++ b/drivers/isdn/hisax/st5481.h | |||
@@ -466,10 +466,10 @@ void st5481_stop(struct st5481_adapter *adapter); | |||
466 | #define __debug_variable st5481_debug | 466 | #define __debug_variable st5481_debug |
467 | #include "hisax_debug.h" | 467 | #include "hisax_debug.h" |
468 | 468 | ||
469 | #ifdef CONFIG_HISAX_DEBUG | ||
470 | |||
471 | extern int st5481_debug; | 469 | extern int st5481_debug; |
472 | 470 | ||
471 | #ifdef CONFIG_HISAX_DEBUG | ||
472 | |||
473 | #define DBG_ISO_PACKET(level,urb) \ | 473 | #define DBG_ISO_PACKET(level,urb) \ |
474 | if (level & __debug_variable) dump_iso_packet(__FUNCTION__,urb) | 474 | if (level & __debug_variable) dump_iso_packet(__FUNCTION__,urb) |
475 | 475 | ||
diff --git a/drivers/isdn/hisax/st5481_b.c b/drivers/isdn/hisax/st5481_b.c index 2fcd093921d8..0a2536d62402 100644 --- a/drivers/isdn/hisax/st5481_b.c +++ b/drivers/isdn/hisax/st5481_b.c | |||
@@ -172,14 +172,18 @@ static void usb_b_out_complete(struct urb *urb, struct pt_regs *regs) | |||
172 | test_and_clear_bit(buf_nr, &b_out->busy); | 172 | test_and_clear_bit(buf_nr, &b_out->busy); |
173 | 173 | ||
174 | if (unlikely(urb->status < 0)) { | 174 | if (unlikely(urb->status < 0)) { |
175 | if (urb->status != -ENOENT && urb->status != -ESHUTDOWN) { | 175 | switch (urb->status) { |
176 | WARN("urb status %d",urb->status); | 176 | case -ENOENT: |
177 | if (b_out->busy == 0) { | 177 | case -ESHUTDOWN: |
178 | st5481_usb_pipe_reset(adapter, (bcs->channel+1)*2 | USB_DIR_OUT, NULL, NULL); | 178 | case -ECONNRESET: |
179 | } | 179 | DBG(4,"urb killed status %d", urb->status); |
180 | } else { | 180 | return; // Give up |
181 | DBG(1,"urb killed"); | 181 | default: |
182 | return; // Give up | 182 | WARN("urb status %d",urb->status); |
183 | if (b_out->busy == 0) { | ||
184 | st5481_usb_pipe_reset(adapter, (bcs->channel+1)*2 | USB_DIR_OUT, NULL, NULL); | ||
185 | } | ||
186 | break; | ||
183 | } | 187 | } |
184 | } | 188 | } |
185 | 189 | ||
@@ -205,7 +209,9 @@ static void st5481B_mode(struct st5481_bcs *bcs, int mode) | |||
205 | bcs->mode = mode; | 209 | bcs->mode = mode; |
206 | 210 | ||
207 | // Cancel all USB transfers on this B channel | 211 | // Cancel all USB transfers on this B channel |
212 | b_out->urb[0]->transfer_flags |= URB_ASYNC_UNLINK; | ||
208 | usb_unlink_urb(b_out->urb[0]); | 213 | usb_unlink_urb(b_out->urb[0]); |
214 | b_out->urb[1]->transfer_flags |= URB_ASYNC_UNLINK; | ||
209 | usb_unlink_urb(b_out->urb[1]); | 215 | usb_unlink_urb(b_out->urb[1]); |
210 | b_out->busy = 0; | 216 | b_out->busy = 0; |
211 | 217 | ||
diff --git a/drivers/isdn/hisax/st5481_d.c b/drivers/isdn/hisax/st5481_d.c index 071b1d31999f..941f7022ada1 100644 --- a/drivers/isdn/hisax/st5481_d.c +++ b/drivers/isdn/hisax/st5481_d.c | |||
@@ -382,16 +382,20 @@ static void usb_d_out_complete(struct urb *urb, struct pt_regs *regs) | |||
382 | test_and_clear_bit(buf_nr, &d_out->busy); | 382 | test_and_clear_bit(buf_nr, &d_out->busy); |
383 | 383 | ||
384 | if (unlikely(urb->status < 0)) { | 384 | if (unlikely(urb->status < 0)) { |
385 | if (urb->status != -ENOENT && urb->status != -ESHUTDOWN) { | 385 | switch (urb->status) { |
386 | WARN("urb status %d",urb->status); | 386 | case -ENOENT: |
387 | if (d_out->busy == 0) { | 387 | case -ESHUTDOWN: |
388 | st5481_usb_pipe_reset(adapter, EP_D_OUT | USB_DIR_OUT, fifo_reseted, adapter); | 388 | case -ECONNRESET: |
389 | } | 389 | DBG(1,"urb killed status %d", urb->status); |
390 | return; | 390 | break; |
391 | } else { | 391 | default: |
392 | DBG(1,"urb killed"); | 392 | WARN("urb status %d",urb->status); |
393 | return; // Give up | 393 | if (d_out->busy == 0) { |
394 | st5481_usb_pipe_reset(adapter, EP_D_OUT | USB_DIR_OUT, fifo_reseted, adapter); | ||
395 | } | ||
396 | break; | ||
394 | } | 397 | } |
398 | return; // Give up | ||
395 | } | 399 | } |
396 | 400 | ||
397 | FsmEvent(&adapter->d_out.fsm, EV_DOUT_COMPLETE, (void *) buf_nr); | 401 | FsmEvent(&adapter->d_out.fsm, EV_DOUT_COMPLETE, (void *) buf_nr); |
@@ -709,14 +713,14 @@ int st5481_setup_d(struct st5481_adapter *adapter) | |||
709 | 713 | ||
710 | adapter->l1m.fsm = &l1fsm; | 714 | adapter->l1m.fsm = &l1fsm; |
711 | adapter->l1m.state = ST_L1_F3; | 715 | adapter->l1m.state = ST_L1_F3; |
712 | adapter->l1m.debug = 1; | 716 | adapter->l1m.debug = st5481_debug & 0x100; |
713 | adapter->l1m.userdata = adapter; | 717 | adapter->l1m.userdata = adapter; |
714 | adapter->l1m.printdebug = l1m_debug; | 718 | adapter->l1m.printdebug = l1m_debug; |
715 | FsmInitTimer(&adapter->l1m, &adapter->timer); | 719 | FsmInitTimer(&adapter->l1m, &adapter->timer); |
716 | 720 | ||
717 | adapter->d_out.fsm.fsm = &dout_fsm; | 721 | adapter->d_out.fsm.fsm = &dout_fsm; |
718 | adapter->d_out.fsm.state = ST_DOUT_NONE; | 722 | adapter->d_out.fsm.state = ST_DOUT_NONE; |
719 | adapter->d_out.fsm.debug = 1; | 723 | adapter->d_out.fsm.debug = st5481_debug & 0x100; |
720 | adapter->d_out.fsm.userdata = adapter; | 724 | adapter->d_out.fsm.userdata = adapter; |
721 | adapter->d_out.fsm.printdebug = dout_debug; | 725 | adapter->d_out.fsm.printdebug = dout_debug; |
722 | 726 | ||
diff --git a/drivers/isdn/hisax/st5481_init.c b/drivers/isdn/hisax/st5481_init.c index 7aa810d5d333..2cf5d1a6df6c 100644 --- a/drivers/isdn/hisax/st5481_init.c +++ b/drivers/isdn/hisax/st5481_init.c | |||
@@ -43,10 +43,10 @@ static int number_of_leds = 2; /* 2 LEDs on the adpater default */ | |||
43 | module_param(number_of_leds, int, 0); | 43 | module_param(number_of_leds, int, 0); |
44 | 44 | ||
45 | #ifdef CONFIG_HISAX_DEBUG | 45 | #ifdef CONFIG_HISAX_DEBUG |
46 | static int debug = 0x1; | 46 | static int debug = 0; |
47 | module_param(debug, int, 0); | 47 | module_param(debug, int, 0); |
48 | int st5481_debug; | ||
49 | #endif | 48 | #endif |
49 | int st5481_debug; | ||
50 | 50 | ||
51 | static LIST_HEAD(adapter_list); | 51 | static LIST_HEAD(adapter_list); |
52 | 52 | ||
diff --git a/drivers/isdn/hisax/st5481_usb.c b/drivers/isdn/hisax/st5481_usb.c index ab62223297a5..ffd5b2d45552 100644 --- a/drivers/isdn/hisax/st5481_usb.c +++ b/drivers/isdn/hisax/st5481_usb.c | |||
@@ -132,11 +132,15 @@ static void usb_ctrl_complete(struct urb *urb, struct pt_regs *regs) | |||
132 | struct ctrl_msg *ctrl_msg; | 132 | struct ctrl_msg *ctrl_msg; |
133 | 133 | ||
134 | if (unlikely(urb->status < 0)) { | 134 | if (unlikely(urb->status < 0)) { |
135 | if (urb->status != -ENOENT && urb->status != -ESHUTDOWN) { | 135 | switch (urb->status) { |
136 | WARN("urb status %d",urb->status); | 136 | case -ENOENT: |
137 | } else { | 137 | case -ESHUTDOWN: |
138 | DBG(1,"urb killed"); | 138 | case -ECONNRESET: |
139 | return; // Give up | 139 | DBG(1,"urb killed status %d", urb->status); |
140 | return; // Give up | ||
141 | default: | ||
142 | WARN("urb status %d",urb->status); | ||
143 | break; | ||
140 | } | 144 | } |
141 | } | 145 | } |
142 | 146 | ||
@@ -184,22 +188,22 @@ static void usb_int_complete(struct urb *urb, struct pt_regs *regs) | |||
184 | int status; | 188 | int status; |
185 | 189 | ||
186 | switch (urb->status) { | 190 | switch (urb->status) { |
187 | case 0: | 191 | case 0: |
188 | /* success */ | 192 | /* success */ |
189 | break; | 193 | break; |
190 | case -ECONNRESET: | 194 | case -ECONNRESET: |
191 | case -ENOENT: | 195 | case -ENOENT: |
192 | case -ESHUTDOWN: | 196 | case -ESHUTDOWN: |
193 | /* this urb is terminated, clean up */ | 197 | /* this urb is terminated, clean up */ |
194 | DBG(1, "urb shutting down with status: %d", urb->status); | 198 | DBG(2, "urb shutting down with status: %d", urb->status); |
195 | return; | 199 | return; |
196 | default: | 200 | default: |
197 | WARN("nonzero urb status received: %d", urb->status); | 201 | WARN("nonzero urb status received: %d", urb->status); |
198 | goto exit; | 202 | goto exit; |
199 | } | 203 | } |
200 | 204 | ||
201 | 205 | ||
202 | DBG_PACKET(1, data, INT_PKT_SIZE); | 206 | DBG_PACKET(2, data, INT_PKT_SIZE); |
203 | 207 | ||
204 | if (urb->actual_length == 0) { | 208 | if (urb->actual_length == 0) { |
205 | goto exit; | 209 | goto exit; |
@@ -250,7 +254,7 @@ int st5481_setup_usb(struct st5481_adapter *adapter) | |||
250 | struct urb *urb; | 254 | struct urb *urb; |
251 | u8 *buf; | 255 | u8 *buf; |
252 | 256 | ||
253 | DBG(1,""); | 257 | DBG(2,""); |
254 | 258 | ||
255 | if ((status = usb_reset_configuration (dev)) < 0) { | 259 | if ((status = usb_reset_configuration (dev)) < 0) { |
256 | WARN("reset_configuration failed,status=%d",status); | 260 | WARN("reset_configuration failed,status=%d",status); |
@@ -330,15 +334,17 @@ void st5481_release_usb(struct st5481_adapter *adapter) | |||
330 | DBG(1,""); | 334 | DBG(1,""); |
331 | 335 | ||
332 | // Stop and free Control and Interrupt URBs | 336 | // Stop and free Control and Interrupt URBs |
333 | usb_unlink_urb(ctrl->urb); | 337 | usb_kill_urb(ctrl->urb); |
334 | if (ctrl->urb->transfer_buffer) | 338 | if (ctrl->urb->transfer_buffer) |
335 | kfree(ctrl->urb->transfer_buffer); | 339 | kfree(ctrl->urb->transfer_buffer); |
336 | usb_free_urb(ctrl->urb); | 340 | usb_free_urb(ctrl->urb); |
341 | ctrl->urb = NULL; | ||
337 | 342 | ||
338 | usb_unlink_urb(intr->urb); | 343 | usb_kill_urb(intr->urb); |
339 | if (intr->urb->transfer_buffer) | 344 | if (intr->urb->transfer_buffer) |
340 | kfree(intr->urb->transfer_buffer); | 345 | kfree(intr->urb->transfer_buffer); |
341 | usb_free_urb(intr->urb); | 346 | usb_free_urb(intr->urb); |
347 | ctrl->urb = NULL; | ||
342 | } | 348 | } |
343 | 349 | ||
344 | /* | 350 | /* |
@@ -406,6 +412,7 @@ fill_isoc_urb(struct urb *urb, struct usb_device *dev, | |||
406 | spin_lock_init(&urb->lock); | 412 | spin_lock_init(&urb->lock); |
407 | urb->dev=dev; | 413 | urb->dev=dev; |
408 | urb->pipe=pipe; | 414 | urb->pipe=pipe; |
415 | urb->interval = 1; | ||
409 | urb->transfer_buffer=buf; | 416 | urb->transfer_buffer=buf; |
410 | urb->number_of_packets = num_packets; | 417 | urb->number_of_packets = num_packets; |
411 | urb->transfer_buffer_length=num_packets*packet_size; | 418 | urb->transfer_buffer_length=num_packets*packet_size; |
@@ -452,7 +459,9 @@ st5481_setup_isocpipes(struct urb* urb[2], struct usb_device *dev, | |||
452 | if (urb[j]) { | 459 | if (urb[j]) { |
453 | if (urb[j]->transfer_buffer) | 460 | if (urb[j]->transfer_buffer) |
454 | kfree(urb[j]->transfer_buffer); | 461 | kfree(urb[j]->transfer_buffer); |
462 | urb[j]->transfer_buffer = NULL; | ||
455 | usb_free_urb(urb[j]); | 463 | usb_free_urb(urb[j]); |
464 | urb[j] = NULL; | ||
456 | } | 465 | } |
457 | } | 466 | } |
458 | return retval; | 467 | return retval; |
@@ -463,10 +472,11 @@ void st5481_release_isocpipes(struct urb* urb[2]) | |||
463 | int j; | 472 | int j; |
464 | 473 | ||
465 | for (j = 0; j < 2; j++) { | 474 | for (j = 0; j < 2; j++) { |
466 | usb_unlink_urb(urb[j]); | 475 | usb_kill_urb(urb[j]); |
467 | if (urb[j]->transfer_buffer) | 476 | if (urb[j]->transfer_buffer) |
468 | kfree(urb[j]->transfer_buffer); | 477 | kfree(urb[j]->transfer_buffer); |
469 | usb_free_urb(urb[j]); | 478 | usb_free_urb(urb[j]); |
479 | urb[j] = NULL; | ||
470 | } | 480 | } |
471 | } | 481 | } |
472 | 482 | ||
@@ -485,11 +495,15 @@ static void usb_in_complete(struct urb *urb, struct pt_regs *regs) | |||
485 | int len, count, status; | 495 | int len, count, status; |
486 | 496 | ||
487 | if (unlikely(urb->status < 0)) { | 497 | if (unlikely(urb->status < 0)) { |
488 | if (urb->status != -ENOENT && urb->status != -ESHUTDOWN) { | 498 | switch (urb->status) { |
489 | WARN("urb status %d",urb->status); | 499 | case -ENOENT: |
490 | } else { | 500 | case -ESHUTDOWN: |
491 | DBG(1,"urb killed"); | 501 | case -ECONNRESET: |
492 | return; // Give up | 502 | DBG(1,"urb killed status %d", urb->status); |
503 | return; // Give up | ||
504 | default: | ||
505 | WARN("urb status %d",urb->status); | ||
506 | break; | ||
493 | } | 507 | } |
494 | } | 508 | } |
495 | 509 | ||
@@ -631,7 +645,9 @@ void st5481_in_mode(struct st5481_in *in, int mode) | |||
631 | 645 | ||
632 | in->mode = mode; | 646 | in->mode = mode; |
633 | 647 | ||
648 | in->urb[0]->transfer_flags |= URB_ASYNC_UNLINK; | ||
634 | usb_unlink_urb(in->urb[0]); | 649 | usb_unlink_urb(in->urb[0]); |
650 | in->urb[1]->transfer_flags |= URB_ASYNC_UNLINK; | ||
635 | usb_unlink_urb(in->urb[1]); | 651 | usb_unlink_urb(in->urb[1]); |
636 | 652 | ||
637 | if (in->mode != L1_MODE_NULL) { | 653 | if (in->mode != L1_MODE_NULL) { |