diff options
author | Tilman Schmidt <tilman@imap.cc> | 2006-04-11 01:55:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-11 09:18:49 -0400 |
commit | 784d5858aac58c06608def862d73ae9a32f5ee23 (patch) | |
tree | 992ba2e122df6fc90a935dcc1629186bc7e168ac /drivers/isdn/gigaset/bas-gigaset.c | |
parent | ec81b5e6294088dc4738d0e8c2316c0dc081215c (diff) |
[PATCH] isdn4linux: Siemens Gigaset drivers: logging usage
With Hansjoerg Lipp <hjlipp@web.de>
Improve error reporting of the Gigaset drivers, by using the
dev_err/dev_warn/dev_info macros from device.h instead of err/warn/info from
usb.h whereever possible.
Also rename the private dbg macro to gig_dbg in order to avoid confusion with
the macro of the same name in usb.h.
Signed-off-by: Hansjoerg Lipp <hjlipp@web.de>
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Cc: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/isdn/gigaset/bas-gigaset.c')
-rw-r--r-- | drivers/isdn/gigaset/bas-gigaset.c | 611 |
1 files changed, 339 insertions, 272 deletions
diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c index fb2c13ae7cfd..580831d9dba1 100644 --- a/drivers/isdn/gigaset/bas-gigaset.c +++ b/drivers/isdn/gigaset/bas-gigaset.c | |||
@@ -81,25 +81,25 @@ static void gigaset_disconnect(struct usb_interface *interface); | |||
81 | /*==============================================================================*/ | 81 | /*==============================================================================*/ |
82 | 82 | ||
83 | struct bas_cardstate { | 83 | struct bas_cardstate { |
84 | struct usb_device *udev; /* USB device pointer */ | 84 | struct usb_device *udev; /* USB device pointer */ |
85 | struct usb_interface *interface; /* interface for this device */ | 85 | struct usb_interface *interface; /* interface for this device */ |
86 | unsigned char minor; /* starting minor number */ | 86 | unsigned char minor; /* starting minor number */ |
87 | 87 | ||
88 | struct urb *urb_ctrl; /* control pipe default URB */ | 88 | struct urb *urb_ctrl; /* control pipe default URB */ |
89 | struct usb_ctrlrequest dr_ctrl; | 89 | struct usb_ctrlrequest dr_ctrl; |
90 | struct timer_list timer_ctrl; /* control request timeout */ | 90 | struct timer_list timer_ctrl; /* control request timeout */ |
91 | 91 | ||
92 | struct timer_list timer_atrdy; /* AT command ready timeout */ | 92 | struct timer_list timer_atrdy; /* AT command ready timeout */ |
93 | struct urb *urb_cmd_out; /* for sending AT commands */ | 93 | struct urb *urb_cmd_out; /* for sending AT commands */ |
94 | struct usb_ctrlrequest dr_cmd_out; | 94 | struct usb_ctrlrequest dr_cmd_out; |
95 | int retry_cmd_out; | 95 | int retry_cmd_out; |
96 | 96 | ||
97 | struct urb *urb_cmd_in; /* for receiving AT replies */ | 97 | struct urb *urb_cmd_in; /* for receiving AT replies */ |
98 | struct usb_ctrlrequest dr_cmd_in; | 98 | struct usb_ctrlrequest dr_cmd_in; |
99 | struct timer_list timer_cmd_in; /* receive request timeout */ | 99 | struct timer_list timer_cmd_in; /* receive request timeout */ |
100 | unsigned char *rcvbuf; /* AT reply receive buffer */ | 100 | unsigned char *rcvbuf; /* AT reply receive buffer */ |
101 | 101 | ||
102 | struct urb *urb_int_in; /* URB for interrupt pipe */ | 102 | struct urb *urb_int_in; /* URB for interrupt pipe */ |
103 | unsigned char int_in_buf[3]; | 103 | unsigned char int_in_buf[3]; |
104 | 104 | ||
105 | spinlock_t lock; /* locks all following */ | 105 | spinlock_t lock; /* locks all following */ |
@@ -201,54 +201,55 @@ static inline char *usb_pipetype_str(int pipe) | |||
201 | * write content of URB to syslog for debugging | 201 | * write content of URB to syslog for debugging |
202 | */ | 202 | */ |
203 | static inline void dump_urb(enum debuglevel level, const char *tag, | 203 | static inline void dump_urb(enum debuglevel level, const char *tag, |
204 | struct urb *urb) | 204 | struct urb *urb) |
205 | { | 205 | { |
206 | #ifdef CONFIG_GIGASET_DEBUG | 206 | #ifdef CONFIG_GIGASET_DEBUG |
207 | int i; | 207 | int i; |
208 | IFNULLRET(tag); | 208 | IFNULLRET(tag); |
209 | dbg(level, "%s urb(0x%08lx)->{", tag, (unsigned long) urb); | 209 | gig_dbg(level, "%s urb(0x%08lx)->{", tag, (unsigned long) urb); |
210 | if (urb) { | 210 | if (urb) { |
211 | dbg(level, | 211 | gig_dbg(level, |
212 | " dev=0x%08lx, pipe=%s:EP%d/DV%d:%s, " | 212 | " dev=0x%08lx, pipe=%s:EP%d/DV%d:%s, " |
213 | "status=%d, hcpriv=0x%08lx, transfer_flags=0x%x,", | 213 | "status=%d, hcpriv=0x%08lx, transfer_flags=0x%x,", |
214 | (unsigned long) urb->dev, | 214 | (unsigned long) urb->dev, |
215 | usb_pipetype_str(urb->pipe), | 215 | usb_pipetype_str(urb->pipe), |
216 | usb_pipeendpoint(urb->pipe), usb_pipedevice(urb->pipe), | 216 | usb_pipeendpoint(urb->pipe), usb_pipedevice(urb->pipe), |
217 | usb_pipein(urb->pipe) ? "in" : "out", | 217 | usb_pipein(urb->pipe) ? "in" : "out", |
218 | urb->status, (unsigned long) urb->hcpriv, | 218 | urb->status, (unsigned long) urb->hcpriv, |
219 | urb->transfer_flags); | 219 | urb->transfer_flags); |
220 | dbg(level, | 220 | gig_dbg(level, |
221 | " transfer_buffer=0x%08lx[%d], actual_length=%d, " | 221 | " transfer_buffer=0x%08lx[%d], actual_length=%d, " |
222 | "bandwidth=%d, setup_packet=0x%08lx,", | 222 | "bandwidth=%d, setup_packet=0x%08lx,", |
223 | (unsigned long) urb->transfer_buffer, | 223 | (unsigned long) urb->transfer_buffer, |
224 | urb->transfer_buffer_length, urb->actual_length, | 224 | urb->transfer_buffer_length, urb->actual_length, |
225 | urb->bandwidth, (unsigned long) urb->setup_packet); | 225 | urb->bandwidth, (unsigned long) urb->setup_packet); |
226 | dbg(level, | 226 | gig_dbg(level, |
227 | " start_frame=%d, number_of_packets=%d, interval=%d, " | 227 | " start_frame=%d, number_of_packets=%d, interval=%d, " |
228 | "error_count=%d,", | 228 | "error_count=%d,", |
229 | urb->start_frame, urb->number_of_packets, urb->interval, | 229 | urb->start_frame, urb->number_of_packets, urb->interval, |
230 | urb->error_count); | 230 | urb->error_count); |
231 | dbg(level, | 231 | gig_dbg(level, |
232 | " context=0x%08lx, complete=0x%08lx, iso_frame_desc[]={", | 232 | " context=0x%08lx, complete=0x%08lx, " |
233 | (unsigned long) urb->context, | 233 | "iso_frame_desc[]={", |
234 | (unsigned long) urb->complete); | 234 | (unsigned long) urb->context, |
235 | (unsigned long) urb->complete); | ||
235 | for (i = 0; i < urb->number_of_packets; i++) { | 236 | for (i = 0; i < urb->number_of_packets; i++) { |
236 | struct usb_iso_packet_descriptor *pifd | 237 | struct usb_iso_packet_descriptor *pifd |
237 | = &urb->iso_frame_desc[i]; | 238 | = &urb->iso_frame_desc[i]; |
238 | dbg(level, | 239 | gig_dbg(level, |
239 | " {offset=%u, length=%u, actual_length=%u, " | 240 | " {offset=%u, length=%u, actual_length=%u, " |
240 | "status=%u}", | 241 | "status=%u}", |
241 | pifd->offset, pifd->length, pifd->actual_length, | 242 | pifd->offset, pifd->length, pifd->actual_length, |
242 | pifd->status); | 243 | pifd->status); |
243 | } | 244 | } |
244 | } | 245 | } |
245 | dbg(level, "}}"); | 246 | gig_dbg(level, "}}"); |
246 | #endif | 247 | #endif |
247 | } | 248 | } |
248 | 249 | ||
249 | /* read/set modem control bits etc. (m10x only) */ | 250 | /* read/set modem control bits etc. (m10x only) */ |
250 | static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state, | 251 | static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state, |
251 | unsigned new_state) | 252 | unsigned new_state) |
252 | { | 253 | { |
253 | return -EINVAL; | 254 | return -EINVAL; |
254 | } | 255 | } |
@@ -274,8 +275,8 @@ static inline void error_hangup(struct bc_state *bcs) | |||
274 | { | 275 | { |
275 | struct cardstate *cs = bcs->cs; | 276 | struct cardstate *cs = bcs->cs; |
276 | 277 | ||
277 | dbg(DEBUG_ANY, | 278 | gig_dbg(DEBUG_ANY, "%s: scheduling HUP for channel %d", |
278 | "%s: scheduling HUP for channel %d", __func__, bcs->channel); | 279 | __func__, bcs->channel); |
279 | 280 | ||
280 | if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) { | 281 | if (!gigaset_add_event(cs, &bcs->at_state, EV_HUP, NULL, 0, NULL)) { |
281 | //FIXME what should we do? | 282 | //FIXME what should we do? |
@@ -295,21 +296,20 @@ static inline void error_hangup(struct bc_state *bcs) | |||
295 | static inline void error_reset(struct cardstate *cs) | 296 | static inline void error_reset(struct cardstate *cs) |
296 | { | 297 | { |
297 | //FIXME try to recover without bothering the user | 298 | //FIXME try to recover without bothering the user |
298 | err("unrecoverable error - please disconnect the Gigaset base to reset"); | 299 | dev_err(cs->dev, |
300 | "unrecoverable error - please disconnect Gigaset base to reset\n"); | ||
299 | } | 301 | } |
300 | 302 | ||
301 | /* check_pending | 303 | /* check_pending |
302 | * check for completion of pending control request | 304 | * check for completion of pending control request |
303 | * parameter: | 305 | * parameter: |
304 | * urb USB request block of completed request | 306 | * ucs hardware specific controller state structure |
305 | * urb->context = hardware specific controller state structure | ||
306 | */ | 307 | */ |
307 | static void check_pending(struct bas_cardstate *ucs) | 308 | static void check_pending(struct bas_cardstate *ucs) |
308 | { | 309 | { |
309 | unsigned long flags; | 310 | unsigned long flags; |
310 | 311 | ||
311 | IFNULLRET(ucs); | 312 | IFNULLRET(ucs); |
312 | IFNULLRET(cardstate); | ||
313 | 313 | ||
314 | spin_lock_irqsave(&ucs->lock, flags); | 314 | spin_lock_irqsave(&ucs->lock, flags); |
315 | switch (ucs->pending) { | 315 | switch (ucs->pending) { |
@@ -330,8 +330,6 @@ static void check_pending(struct bas_cardstate *ucs) | |||
330 | case HD_CLOSE_ATCHANNEL: | 330 | case HD_CLOSE_ATCHANNEL: |
331 | if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) | 331 | if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) |
332 | ucs->pending = 0; | 332 | ucs->pending = 0; |
333 | //wake_up_interruptible(cs->initwait); | ||
334 | //FIXME need own wait queue? | ||
335 | break; | 333 | break; |
336 | case HD_CLOSE_B1CHANNEL: | 334 | case HD_CLOSE_B1CHANNEL: |
337 | if (!(atomic_read(&ucs->basstate) & BS_B1OPEN)) | 335 | if (!(atomic_read(&ucs->basstate) & BS_B1OPEN)) |
@@ -348,7 +346,9 @@ static void check_pending(struct bas_cardstate *ucs) | |||
348 | * are handled separately and should never end up here | 346 | * are handled separately and should never end up here |
349 | */ | 347 | */ |
350 | default: | 348 | default: |
351 | warn("unknown pending request 0x%02x cleared", ucs->pending); | 349 | dev_warn(&ucs->interface->dev, |
350 | "unknown pending request 0x%02x cleared\n", | ||
351 | ucs->pending); | ||
352 | ucs->pending = 0; | 352 | ucs->pending = 0; |
353 | } | 353 | } |
354 | 354 | ||
@@ -374,19 +374,19 @@ static void cmd_in_timeout(unsigned long data) | |||
374 | IFNULLRET(ucs); | 374 | IFNULLRET(ucs); |
375 | 375 | ||
376 | spin_lock_irqsave(&cs->lock, flags); | 376 | spin_lock_irqsave(&cs->lock, flags); |
377 | if (!atomic_read(&cs->connected)) { | 377 | if (unlikely(!atomic_read(&cs->connected))) { |
378 | dbg(DEBUG_USBREQ, "%s: disconnected", __func__); | 378 | gig_dbg(DEBUG_USBREQ, "%s: disconnected", __func__); |
379 | spin_unlock_irqrestore(&cs->lock, flags); | 379 | spin_unlock_irqrestore(&cs->lock, flags); |
380 | return; | 380 | return; |
381 | } | 381 | } |
382 | if (!ucs->rcvbuf_size) { | 382 | if (!ucs->rcvbuf_size) { |
383 | dbg(DEBUG_USBREQ, "%s: no receive in progress", __func__); | 383 | gig_dbg(DEBUG_USBREQ, "%s: no receive in progress", __func__); |
384 | spin_unlock_irqrestore(&cs->lock, flags); | 384 | spin_unlock_irqrestore(&cs->lock, flags); |
385 | return; | 385 | return; |
386 | } | 386 | } |
387 | spin_unlock_irqrestore(&cs->lock, flags); | 387 | spin_unlock_irqrestore(&cs->lock, flags); |
388 | 388 | ||
389 | err("timeout reading AT response"); | 389 | dev_err(cs->dev, "timeout reading AT response\n"); |
390 | error_reset(cs); //FIXME retry? | 390 | error_reset(cs); //FIXME retry? |
391 | } | 391 | } |
392 | 392 | ||
@@ -414,10 +414,12 @@ static int atread_submit(struct cardstate *cs, int timeout) | |||
414 | IFNULLRETVAL(ucs, -EINVAL); | 414 | IFNULLRETVAL(ucs, -EINVAL); |
415 | IFNULLRETVAL(ucs->urb_cmd_in, -EINVAL); | 415 | IFNULLRETVAL(ucs->urb_cmd_in, -EINVAL); |
416 | 416 | ||
417 | dbg(DEBUG_USBREQ, "-------> HD_READ_ATMESSAGE (%d)", ucs->rcvbuf_size); | 417 | gig_dbg(DEBUG_USBREQ, "-------> HD_READ_ATMESSAGE (%d)", |
418 | ucs->rcvbuf_size); | ||
418 | 419 | ||
419 | if (ucs->urb_cmd_in->status == -EINPROGRESS) { | 420 | if (ucs->urb_cmd_in->status == -EINPROGRESS) { |
420 | err("could not submit HD_READ_ATMESSAGE: URB busy"); | 421 | dev_err(cs->dev, |
422 | "could not submit HD_READ_ATMESSAGE: URB busy\n"); | ||
421 | return -EBUSY; | 423 | return -EBUSY; |
422 | } | 424 | } |
423 | 425 | ||
@@ -427,19 +429,19 @@ static int atread_submit(struct cardstate *cs, int timeout) | |||
427 | ucs->dr_cmd_in.wIndex = 0; | 429 | ucs->dr_cmd_in.wIndex = 0; |
428 | ucs->dr_cmd_in.wLength = cpu_to_le16(ucs->rcvbuf_size); | 430 | ucs->dr_cmd_in.wLength = cpu_to_le16(ucs->rcvbuf_size); |
429 | usb_fill_control_urb(ucs->urb_cmd_in, ucs->udev, | 431 | usb_fill_control_urb(ucs->urb_cmd_in, ucs->udev, |
430 | usb_rcvctrlpipe(ucs->udev, 0), | 432 | usb_rcvctrlpipe(ucs->udev, 0), |
431 | (unsigned char*) & ucs->dr_cmd_in, | 433 | (unsigned char*) & ucs->dr_cmd_in, |
432 | ucs->rcvbuf, ucs->rcvbuf_size, | 434 | ucs->rcvbuf, ucs->rcvbuf_size, |
433 | read_ctrl_callback, cs->inbuf); | 435 | read_ctrl_callback, cs->inbuf); |
434 | 436 | ||
435 | if ((ret = usb_submit_urb(ucs->urb_cmd_in, SLAB_ATOMIC)) != 0) { | 437 | if ((ret = usb_submit_urb(ucs->urb_cmd_in, SLAB_ATOMIC)) != 0) { |
436 | err("could not submit HD_READ_ATMESSAGE: %s", | 438 | dev_err(cs->dev, "could not submit HD_READ_ATMESSAGE: %s\n", |
437 | get_usb_statmsg(ret)); | 439 | get_usb_statmsg(ret)); |
438 | return ret; | 440 | return ret; |
439 | } | 441 | } |
440 | 442 | ||
441 | if (timeout > 0) { | 443 | if (timeout > 0) { |
442 | dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout); | 444 | gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout); |
443 | ucs->timer_cmd_in.expires = jiffies + timeout * HZ / 10; | 445 | ucs->timer_cmd_in.expires = jiffies + timeout * HZ / 10; |
444 | ucs->timer_cmd_in.data = (unsigned long) cs; | 446 | ucs->timer_cmd_in.data = (unsigned long) cs; |
445 | ucs->timer_cmd_in.function = cmd_in_timeout; | 447 | ucs->timer_cmd_in.function = cmd_in_timeout; |
@@ -503,11 +505,12 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
503 | case -ECONNRESET: /* canceled (async) */ | 505 | case -ECONNRESET: /* canceled (async) */ |
504 | case -EINPROGRESS: /* pending */ | 506 | case -EINPROGRESS: /* pending */ |
505 | /* ignore silently */ | 507 | /* ignore silently */ |
506 | dbg(DEBUG_USBREQ, | 508 | gig_dbg(DEBUG_USBREQ, "%s: %s", |
507 | "%s: %s", __func__, get_usb_statmsg(urb->status)); | 509 | __func__, get_usb_statmsg(urb->status)); |
508 | return; | 510 | return; |
509 | default: /* severe trouble */ | 511 | default: /* severe trouble */ |
510 | warn("interrupt read: %s", get_usb_statmsg(urb->status)); | 512 | dev_warn(cs->dev, "interrupt read: %s\n", |
513 | get_usb_statmsg(urb->status)); | ||
511 | //FIXME corrective action? resubmission always ok? | 514 | //FIXME corrective action? resubmission always ok? |
512 | goto resubmit; | 515 | goto resubmit; |
513 | } | 516 | } |
@@ -515,10 +518,9 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
515 | l = (unsigned) ucs->int_in_buf[1] + | 518 | l = (unsigned) ucs->int_in_buf[1] + |
516 | (((unsigned) ucs->int_in_buf[2]) << 8); | 519 | (((unsigned) ucs->int_in_buf[2]) << 8); |
517 | 520 | ||
518 | dbg(DEBUG_USBREQ, | 521 | gig_dbg(DEBUG_USBREQ, "<-------%d: 0x%02x (%u [0x%02x 0x%02x])", |
519 | "<-------%d: 0x%02x (%u [0x%02x 0x%02x])", urb->actual_length, | 522 | urb->actual_length, (int)ucs->int_in_buf[0], l, |
520 | (int)ucs->int_in_buf[0], l, | 523 | (int)ucs->int_in_buf[1], (int)ucs->int_in_buf[2]); |
521 | (int)ucs->int_in_buf[1], (int)ucs->int_in_buf[2]); | ||
522 | 524 | ||
523 | channel = 0; | 525 | channel = 0; |
524 | 526 | ||
@@ -564,28 +566,30 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
564 | case HD_B1_FLOW_CONTROL: | 566 | case HD_B1_FLOW_CONTROL: |
565 | bcs = cs->bcs + channel; | 567 | bcs = cs->bcs + channel; |
566 | atomic_add((l - BAS_NORMFRAME) * BAS_CORRFRAMES, | 568 | atomic_add((l - BAS_NORMFRAME) * BAS_CORRFRAMES, |
567 | &bcs->hw.bas->corrbytes); | 569 | &bcs->hw.bas->corrbytes); |
568 | dbg(DEBUG_ISO, | 570 | gig_dbg(DEBUG_ISO, |
569 | "Flow control (channel %d, sub %d): 0x%02x => %d", | 571 | "Flow control (channel %d, sub %d): 0x%02x => %d", |
570 | channel, bcs->hw.bas->numsub, l, | 572 | channel, bcs->hw.bas->numsub, l, |
571 | atomic_read(&bcs->hw.bas->corrbytes)); | 573 | atomic_read(&bcs->hw.bas->corrbytes)); |
572 | break; | 574 | break; |
573 | 575 | ||
574 | case HD_RECEIVEATDATA_ACK: /* AT response ready to be received */ | 576 | case HD_RECEIVEATDATA_ACK: /* AT response ready to be received */ |
575 | if (!l) { | 577 | if (!l) { |
576 | warn("HD_RECEIVEATDATA_ACK with length 0 ignored"); | 578 | dev_warn(cs->dev, |
579 | "HD_RECEIVEATDATA_ACK with length 0 ignored\n"); | ||
577 | break; | 580 | break; |
578 | } | 581 | } |
579 | spin_lock_irqsave(&cs->lock, flags); | 582 | spin_lock_irqsave(&cs->lock, flags); |
580 | if (ucs->rcvbuf_size) { | 583 | if (ucs->rcvbuf_size) { |
581 | spin_unlock_irqrestore(&cs->lock, flags); | 584 | spin_unlock_irqrestore(&cs->lock, flags); |
582 | err("receive AT data overrun, %d bytes lost", l); | 585 | dev_err(cs->dev, |
586 | "receive AT data overrun, %d bytes lost\n", l); | ||
583 | error_reset(cs); //FIXME reschedule | 587 | error_reset(cs); //FIXME reschedule |
584 | break; | 588 | break; |
585 | } | 589 | } |
586 | if ((ucs->rcvbuf = kmalloc(l, GFP_ATOMIC)) == NULL) { | 590 | if ((ucs->rcvbuf = kmalloc(l, GFP_ATOMIC)) == NULL) { |
587 | spin_unlock_irqrestore(&cs->lock, flags); | 591 | spin_unlock_irqrestore(&cs->lock, flags); |
588 | err("%s: out of memory, %d bytes lost", __func__, l); | 592 | dev_err(cs->dev, "out of memory, %d bytes lost\n", l); |
589 | error_reset(cs); //FIXME reschedule | 593 | error_reset(cs); //FIXME reschedule |
590 | break; | 594 | break; |
591 | } | 595 | } |
@@ -601,16 +605,17 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
601 | break; | 605 | break; |
602 | 606 | ||
603 | case HD_RESET_INTERRUPT_PIPE_ACK: | 607 | case HD_RESET_INTERRUPT_PIPE_ACK: |
604 | dbg(DEBUG_USBREQ, "HD_RESET_INTERRUPT_PIPE_ACK"); | 608 | gig_dbg(DEBUG_USBREQ, "HD_RESET_INTERRUPT_PIPE_ACK"); |
605 | break; | 609 | break; |
606 | 610 | ||
607 | case HD_SUSPEND_END: | 611 | case HD_SUSPEND_END: |
608 | dbg(DEBUG_USBREQ, "HD_SUSPEND_END"); | 612 | gig_dbg(DEBUG_USBREQ, "HD_SUSPEND_END"); |
609 | break; | 613 | break; |
610 | 614 | ||
611 | default: | 615 | default: |
612 | warn("unknown Gigaset signal 0x%02x (%u) ignored", | 616 | dev_warn(cs->dev, |
613 | (int) ucs->int_in_buf[0], l); | 617 | "unknown Gigaset signal 0x%02x (%u) ignored\n", |
618 | (int) ucs->int_in_buf[0], l); | ||
614 | } | 619 | } |
615 | 620 | ||
616 | check_pending(ucs); | 621 | check_pending(ucs); |
@@ -618,8 +623,8 @@ static void read_int_callback(struct urb *urb, struct pt_regs *regs) | |||
618 | resubmit: | 623 | resubmit: |
619 | status = usb_submit_urb(urb, SLAB_ATOMIC); | 624 | status = usb_submit_urb(urb, SLAB_ATOMIC); |
620 | if (unlikely(status)) { | 625 | if (unlikely(status)) { |
621 | err("could not resubmit interrupt URB: %s", | 626 | dev_err(cs->dev, "could not resubmit interrupt URB: %s\n", |
622 | get_usb_statmsg(status)); | 627 | get_usb_statmsg(status)); |
623 | error_reset(cs); | 628 | error_reset(cs); |
624 | } | 629 | } |
625 | } | 630 | } |
@@ -649,14 +654,14 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) | |||
649 | IFNULLRET(ucs); | 654 | IFNULLRET(ucs); |
650 | 655 | ||
651 | spin_lock_irqsave(&cs->lock, flags); | 656 | spin_lock_irqsave(&cs->lock, flags); |
652 | if (!atomic_read(&cs->connected)) { | 657 | if (unlikely(!atomic_read(&cs->connected))) { |
653 | warn("%s: disconnected", __func__); | 658 | warn("%s: disconnected", __func__); |
654 | spin_unlock_irqrestore(&cs->lock, flags); | 659 | spin_unlock_irqrestore(&cs->lock, flags); |
655 | return; | 660 | return; |
656 | } | 661 | } |
657 | 662 | ||
658 | if (!ucs->rcvbuf_size) { | 663 | if (!ucs->rcvbuf_size) { |
659 | warn("%s: no receive in progress", __func__); | 664 | dev_warn(cs->dev, "%s: no receive in progress\n", __func__); |
660 | spin_unlock_irqrestore(&cs->lock, flags); | 665 | spin_unlock_irqrestore(&cs->lock, flags); |
661 | return; | 666 | return; |
662 | } | 667 | } |
@@ -667,12 +672,14 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) | |||
667 | case 0: /* normal completion */ | 672 | case 0: /* normal completion */ |
668 | numbytes = urb->actual_length; | 673 | numbytes = urb->actual_length; |
669 | if (unlikely(numbytes == 0)) { | 674 | if (unlikely(numbytes == 0)) { |
670 | warn("control read: empty block received"); | 675 | dev_warn(cs->dev, |
676 | "control read: empty block received\n"); | ||
671 | goto retry; | 677 | goto retry; |
672 | } | 678 | } |
673 | if (unlikely(numbytes != ucs->rcvbuf_size)) { | 679 | if (unlikely(numbytes != ucs->rcvbuf_size)) { |
674 | warn("control read: received %d chars, expected %d", | 680 | dev_warn(cs->dev, |
675 | numbytes, ucs->rcvbuf_size); | 681 | "control read: received %d chars, expected %d\n", |
682 | numbytes, ucs->rcvbuf_size); | ||
676 | if (numbytes > ucs->rcvbuf_size) | 683 | if (numbytes > ucs->rcvbuf_size) |
677 | numbytes = ucs->rcvbuf_size; | 684 | numbytes = ucs->rcvbuf_size; |
678 | } | 685 | } |
@@ -692,23 +699,26 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) | |||
692 | case -ECONNRESET: /* canceled (async) */ | 699 | case -ECONNRESET: /* canceled (async) */ |
693 | case -EINPROGRESS: /* pending */ | 700 | case -EINPROGRESS: /* pending */ |
694 | /* no action necessary */ | 701 | /* no action necessary */ |
695 | dbg(DEBUG_USBREQ, | 702 | gig_dbg(DEBUG_USBREQ, "%s: %s", |
696 | "%s: %s", __func__, get_usb_statmsg(urb->status)); | 703 | __func__, get_usb_statmsg(urb->status)); |
697 | break; | 704 | break; |
698 | 705 | ||
699 | default: /* severe trouble */ | 706 | default: /* severe trouble */ |
700 | warn("control read: %s", get_usb_statmsg(urb->status)); | 707 | dev_warn(cs->dev, "control read: %s\n", |
708 | get_usb_statmsg(urb->status)); | ||
701 | retry: | 709 | retry: |
702 | if (ucs->retry_cmd_in++ < BAS_RETRY) { | 710 | if (ucs->retry_cmd_in++ < BAS_RETRY) { |
703 | notice("control read: retry %d", ucs->retry_cmd_in); | 711 | dev_notice(cs->dev, "control read: retry %d\n", |
712 | ucs->retry_cmd_in); | ||
704 | if (atread_submit(cs, BAS_TIMEOUT) >= 0) { | 713 | if (atread_submit(cs, BAS_TIMEOUT) >= 0) { |
705 | /* resubmitted - bypass regular exit block */ | 714 | /* resubmitted - bypass regular exit block */ |
706 | spin_unlock_irqrestore(&cs->lock, flags); | 715 | spin_unlock_irqrestore(&cs->lock, flags); |
707 | return; | 716 | return; |
708 | } | 717 | } |
709 | } else { | 718 | } else { |
710 | err("control read: giving up after %d tries", | 719 | dev_err(cs->dev, |
711 | ucs->retry_cmd_in); | 720 | "control read: giving up after %d tries\n", |
721 | ucs->retry_cmd_in); | ||
712 | } | 722 | } |
713 | error_reset(cs); | 723 | error_reset(cs); |
714 | } | 724 | } |
@@ -718,7 +728,7 @@ static void read_ctrl_callback(struct urb *urb, struct pt_regs *regs) | |||
718 | ucs->rcvbuf_size = 0; | 728 | ucs->rcvbuf_size = 0; |
719 | spin_unlock_irqrestore(&cs->lock, flags); | 729 | spin_unlock_irqrestore(&cs->lock, flags); |
720 | if (have_data) { | 730 | if (have_data) { |
721 | dbg(DEBUG_INTR, "%s-->BH", __func__); | 731 | gig_dbg(DEBUG_INTR, "%s-->BH", __func__); |
722 | gigaset_schedule_event(cs); | 732 | gigaset_schedule_event(cs); |
723 | } | 733 | } |
724 | } | 734 | } |
@@ -743,9 +753,9 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs) | |||
743 | 753 | ||
744 | /* status codes not worth bothering the tasklet with */ | 754 | /* status codes not worth bothering the tasklet with */ |
745 | if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || | 755 | if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || |
746 | urb->status == -EINPROGRESS)) { | 756 | urb->status == -EINPROGRESS)) { |
747 | dbg(DEBUG_ISO, | 757 | gig_dbg(DEBUG_ISO, "%s: %s", |
748 | "%s: %s", __func__, get_usb_statmsg(urb->status)); | 758 | __func__, get_usb_statmsg(urb->status)); |
749 | return; | 759 | return; |
750 | } | 760 | } |
751 | 761 | ||
@@ -771,15 +781,17 @@ static void read_iso_callback(struct urb *urb, struct pt_regs *regs) | |||
771 | urb->iso_frame_desc[i].actual_length = 0; | 781 | urb->iso_frame_desc[i].actual_length = 0; |
772 | } | 782 | } |
773 | if (likely(atomic_read(&ubc->running))) { | 783 | if (likely(atomic_read(&ubc->running))) { |
774 | urb->dev = bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */ | 784 | /* urb->dev is clobbered by USB subsystem */ |
785 | urb->dev = bcs->cs->hw.bas->udev; | ||
775 | urb->transfer_flags = URB_ISO_ASAP; | 786 | urb->transfer_flags = URB_ISO_ASAP; |
776 | urb->number_of_packets = BAS_NUMFRAMES; | 787 | urb->number_of_packets = BAS_NUMFRAMES; |
777 | dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit", | 788 | gig_dbg(DEBUG_ISO, "%s: isoc read overrun/resubmit", |
778 | __func__); | 789 | __func__); |
779 | rc = usb_submit_urb(urb, SLAB_ATOMIC); | 790 | rc = usb_submit_urb(urb, SLAB_ATOMIC); |
780 | if (unlikely(rc != 0)) { | 791 | if (unlikely(rc != 0)) { |
781 | err("could not resubmit isochronous read URB: %s", | 792 | dev_err(bcs->cs->dev, |
782 | get_usb_statmsg(rc)); | 793 | "could not resubmit isochronous read " |
794 | "URB: %s\n", get_usb_statmsg(rc)); | ||
783 | dump_urb(DEBUG_ISO, "isoc read", urb); | 795 | dump_urb(DEBUG_ISO, "isoc read", urb); |
784 | error_hangup(bcs); | 796 | error_hangup(bcs); |
785 | } | 797 | } |
@@ -807,9 +819,9 @@ static void write_iso_callback(struct urb *urb, struct pt_regs *regs) | |||
807 | 819 | ||
808 | /* status codes not worth bothering the tasklet with */ | 820 | /* status codes not worth bothering the tasklet with */ |
809 | if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || | 821 | if (unlikely(urb->status == -ENOENT || urb->status == -ECONNRESET || |
810 | urb->status == -EINPROGRESS)) { | 822 | urb->status == -EINPROGRESS)) { |
811 | dbg(DEBUG_ISO, | 823 | gig_dbg(DEBUG_ISO, "%s: %s", |
812 | "%s: %s", __func__, get_usb_statmsg(urb->status)); | 824 | __func__, get_usb_statmsg(urb->status)); |
813 | return; | 825 | return; |
814 | } | 826 | } |
815 | 827 | ||
@@ -854,7 +866,7 @@ static int starturbs(struct bc_state *bcs) | |||
854 | for (k = 0; k < BAS_INURBS; k++) { | 866 | for (k = 0; k < BAS_INURBS; k++) { |
855 | urb = ubc->isoinurbs[k]; | 867 | urb = ubc->isoinurbs[k]; |
856 | if (!urb) { | 868 | if (!urb) { |
857 | err("isoinurbs[%d]==NULL", k); | 869 | dev_err(bcs->cs->dev, "isoinurbs[%d]==NULL\n", k); |
858 | rc = -EFAULT; | 870 | rc = -EFAULT; |
859 | goto error; | 871 | goto error; |
860 | } | 872 | } |
@@ -877,8 +889,9 @@ static int starturbs(struct bc_state *bcs) | |||
877 | 889 | ||
878 | dump_urb(DEBUG_ISO, "Initial isoc read", urb); | 890 | dump_urb(DEBUG_ISO, "Initial isoc read", urb); |
879 | if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) { | 891 | if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) { |
880 | err("could not submit isochronous read URB %d: %s", | 892 | dev_err(bcs->cs->dev, |
881 | k, get_usb_statmsg(rc)); | 893 | "could not submit isochronous read URB %d: %s\n", |
894 | k, get_usb_statmsg(rc)); | ||
882 | goto error; | 895 | goto error; |
883 | } | 896 | } |
884 | } | 897 | } |
@@ -890,7 +903,7 @@ static int starturbs(struct bc_state *bcs) | |||
890 | for (k = 0; k < BAS_OUTURBS; ++k) { | 903 | for (k = 0; k < BAS_OUTURBS; ++k) { |
891 | urb = ubc->isoouturbs[k].urb; | 904 | urb = ubc->isoouturbs[k].urb; |
892 | if (!urb) { | 905 | if (!urb) { |
893 | err("isoouturbs[%d].urb==NULL", k); | 906 | dev_err(bcs->cs->dev, "isoouturbs[%d].urb==NULL\n", k); |
894 | rc = -EFAULT; | 907 | rc = -EFAULT; |
895 | goto error; | 908 | goto error; |
896 | } | 909 | } |
@@ -917,8 +930,9 @@ static int starturbs(struct bc_state *bcs) | |||
917 | dump_urb(DEBUG_ISO, "Initial isoc write", urb); | 930 | dump_urb(DEBUG_ISO, "Initial isoc write", urb); |
918 | rc = usb_submit_urb(ubc->isoouturbs[k].urb, SLAB_ATOMIC); | 931 | rc = usb_submit_urb(ubc->isoouturbs[k].urb, SLAB_ATOMIC); |
919 | if (rc != 0) { | 932 | if (rc != 0) { |
920 | err("could not submit isochronous write URB %d: %s", | 933 | dev_err(bcs->cs->dev, |
921 | k, get_usb_statmsg(rc)); | 934 | "could not submit isochronous write URB %d: %s\n", |
935 | k, get_usb_statmsg(rc)); | ||
922 | goto error; | 936 | goto error; |
923 | } | 937 | } |
924 | } | 938 | } |
@@ -947,14 +961,16 @@ static void stopurbs(struct bas_bc_state *ubc) | |||
947 | 961 | ||
948 | for (k = 0; k < BAS_INURBS; ++k) { | 962 | for (k = 0; k < BAS_INURBS; ++k) { |
949 | rc = usb_unlink_urb(ubc->isoinurbs[k]); | 963 | rc = usb_unlink_urb(ubc->isoinurbs[k]); |
950 | dbg(DEBUG_ISO, "%s: isoc input URB %d unlinked, result = %d", | 964 | gig_dbg(DEBUG_ISO, |
951 | __func__, k, rc); | 965 | "%s: isoc input URB %d unlinked, result = %d", |
966 | __func__, k, rc); | ||
952 | } | 967 | } |
953 | 968 | ||
954 | for (k = 0; k < BAS_OUTURBS; ++k) { | 969 | for (k = 0; k < BAS_OUTURBS; ++k) { |
955 | rc = usb_unlink_urb(ubc->isoouturbs[k].urb); | 970 | rc = usb_unlink_urb(ubc->isoouturbs[k].urb); |
956 | dbg(DEBUG_ISO, "%s: isoc output URB %d unlinked, result = %d", | 971 | gig_dbg(DEBUG_ISO, |
957 | __func__, k, rc); | 972 | "%s: isoc output URB %d unlinked, result = %d", |
973 | __func__, k, rc); | ||
958 | } | 974 | } |
959 | } | 975 | } |
960 | 976 | ||
@@ -984,7 +1000,8 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx) | |||
984 | ubc = ucx->bcs->hw.bas; | 1000 | ubc = ucx->bcs->hw.bas; |
985 | IFNULLRETVAL(ubc, -EFAULT); | 1001 | IFNULLRETVAL(ubc, -EFAULT); |
986 | 1002 | ||
987 | urb->dev = ucx->bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */ | 1003 | /* urb->dev is clobbered by USB subsystem */ |
1004 | urb->dev = ucx->bcs->cs->hw.bas->udev; | ||
988 | urb->transfer_flags = URB_ISO_ASAP; | 1005 | urb->transfer_flags = URB_ISO_ASAP; |
989 | urb->transfer_buffer = ubc->isooutbuf->data; | 1006 | urb->transfer_buffer = ubc->isooutbuf->data; |
990 | urb->transfer_buffer_length = sizeof(ubc->isooutbuf->data); | 1007 | urb->transfer_buffer_length = sizeof(ubc->isooutbuf->data); |
@@ -995,7 +1012,8 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx) | |||
995 | /* compute frame length according to flow control */ | 1012 | /* compute frame length according to flow control */ |
996 | ifd->length = BAS_NORMFRAME; | 1013 | ifd->length = BAS_NORMFRAME; |
997 | if ((corrbytes = atomic_read(&ubc->corrbytes)) != 0) { | 1014 | if ((corrbytes = atomic_read(&ubc->corrbytes)) != 0) { |
998 | dbg(DEBUG_ISO, "%s: corrbytes=%d", __func__, corrbytes); | 1015 | gig_dbg(DEBUG_ISO, "%s: corrbytes=%d", |
1016 | __func__, corrbytes); | ||
999 | if (corrbytes > BAS_HIGHFRAME - BAS_NORMFRAME) | 1017 | if (corrbytes > BAS_HIGHFRAME - BAS_NORMFRAME) |
1000 | corrbytes = BAS_HIGHFRAME - BAS_NORMFRAME; | 1018 | corrbytes = BAS_HIGHFRAME - BAS_NORMFRAME; |
1001 | else if (corrbytes < BAS_LOWFRAME - BAS_NORMFRAME) | 1019 | else if (corrbytes < BAS_LOWFRAME - BAS_NORMFRAME) |
@@ -1003,19 +1021,21 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx) | |||
1003 | ifd->length += corrbytes; | 1021 | ifd->length += corrbytes; |
1004 | atomic_add(-corrbytes, &ubc->corrbytes); | 1022 | atomic_add(-corrbytes, &ubc->corrbytes); |
1005 | } | 1023 | } |
1006 | //dbg(DEBUG_ISO, "%s: frame %d length=%d", __func__, nframe, ifd->length); | ||
1007 | 1024 | ||
1008 | /* retrieve block of data to send */ | 1025 | /* retrieve block of data to send */ |
1009 | ifd->offset = gigaset_isowbuf_getbytes(ubc->isooutbuf, | 1026 | ifd->offset = gigaset_isowbuf_getbytes(ubc->isooutbuf, |
1010 | ifd->length); | 1027 | ifd->length); |
1011 | if (ifd->offset < 0) { | 1028 | if (ifd->offset < 0) { |
1012 | if (ifd->offset == -EBUSY) { | 1029 | if (ifd->offset == -EBUSY) { |
1013 | dbg(DEBUG_ISO, "%s: buffer busy at frame %d", | 1030 | gig_dbg(DEBUG_ISO, |
1014 | __func__, nframe); | 1031 | "%s: buffer busy at frame %d", |
1015 | /* tasklet will be restarted from gigaset_send_skb() */ | 1032 | __func__, nframe); |
1033 | /* tasklet will be restarted from | ||
1034 | gigaset_send_skb() */ | ||
1016 | } else { | 1035 | } else { |
1017 | err("%s: buffer error %d at frame %d", | 1036 | dev_err(ucx->bcs->cs->dev, |
1018 | __func__, ifd->offset, nframe); | 1037 | "%s: buffer error %d at frame %d\n", |
1038 | __func__, ifd->offset, nframe); | ||
1019 | return ifd->offset; | 1039 | return ifd->offset; |
1020 | } | 1040 | } |
1021 | break; | 1041 | break; |
@@ -1026,8 +1046,9 @@ static int submit_iso_write_urb(struct isow_urbctx_t *ucx) | |||
1026 | } | 1046 | } |
1027 | if ((urb->number_of_packets = nframe) > 0) { | 1047 | if ((urb->number_of_packets = nframe) > 0) { |
1028 | if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) { | 1048 | if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) { |
1029 | err("could not submit isochronous write URB: %s", | 1049 | dev_err(ucx->bcs->cs->dev, |
1030 | get_usb_statmsg(rc)); | 1050 | "could not submit isochronous write URB: %s\n", |
1051 | get_usb_statmsg(rc)); | ||
1031 | dump_urb(DEBUG_ISO, "isoc write", urb); | 1052 | dump_urb(DEBUG_ISO, "isoc write", urb); |
1032 | return rc; | 1053 | return rc; |
1033 | } | 1054 | } |
@@ -1071,7 +1092,7 @@ static void write_iso_tasklet(unsigned long data) | |||
1071 | } | 1092 | } |
1072 | 1093 | ||
1073 | if (unlikely(!(atomic_read(&ubc->running)))) { | 1094 | if (unlikely(!(atomic_read(&ubc->running)))) { |
1074 | dbg(DEBUG_ISO, "%s: not running", __func__); | 1095 | gig_dbg(DEBUG_ISO, "%s: not running", __func__); |
1075 | return; | 1096 | return; |
1076 | } | 1097 | } |
1077 | 1098 | ||
@@ -1083,7 +1104,7 @@ static void write_iso_tasklet(unsigned long data) | |||
1083 | ubc->isooutovfl = NULL; | 1104 | ubc->isooutovfl = NULL; |
1084 | spin_unlock_irqrestore(&ubc->isooutlock, flags); | 1105 | spin_unlock_irqrestore(&ubc->isooutlock, flags); |
1085 | if (ovfl) { | 1106 | if (ovfl) { |
1086 | err("isochronous write buffer underrun - buy a faster machine :-)"); | 1107 | dev_err(cs->dev, "isochronous write buffer underrun\n"); |
1087 | error_hangup(bcs); | 1108 | error_hangup(bcs); |
1088 | break; | 1109 | break; |
1089 | } | 1110 | } |
@@ -1106,7 +1127,8 @@ static void write_iso_tasklet(unsigned long data) | |||
1106 | spin_unlock_irqrestore(&ubc->isooutlock, flags); | 1127 | spin_unlock_irqrestore(&ubc->isooutlock, flags); |
1107 | if (next) { | 1128 | if (next) { |
1108 | /* couldn't put it back */ | 1129 | /* couldn't put it back */ |
1109 | err("losing isochronous write URB"); | 1130 | dev_err(cs->dev, |
1131 | "losing isochronous write URB\n"); | ||
1110 | error_hangup(bcs); | 1132 | error_hangup(bcs); |
1111 | } | 1133 | } |
1112 | } | 1134 | } |
@@ -1123,19 +1145,21 @@ static void write_iso_tasklet(unsigned long data) | |||
1123 | * successfully sent | 1145 | * successfully sent |
1124 | * - all following frames are not sent at all | 1146 | * - all following frames are not sent at all |
1125 | */ | 1147 | */ |
1126 | dbg(DEBUG_ISO, "%s: URB partially completed", __func__); | 1148 | gig_dbg(DEBUG_ISO, "%s: URB partially completed", |
1149 | __func__); | ||
1127 | offset = done->limit; /* just in case */ | 1150 | offset = done->limit; /* just in case */ |
1128 | for (i = 0; i < BAS_NUMFRAMES; i++) { | 1151 | for (i = 0; i < BAS_NUMFRAMES; i++) { |
1129 | ifd = &urb->iso_frame_desc[i]; | 1152 | ifd = &urb->iso_frame_desc[i]; |
1130 | if (ifd->status || | 1153 | if (ifd->status || |
1131 | ifd->actual_length != ifd->length) { | 1154 | ifd->actual_length != ifd->length) { |
1132 | warn("isochronous write: frame %d: %s, " | 1155 | dev_warn(cs->dev, |
1133 | "only %d of %d bytes sent", | 1156 | "isochronous write: frame %d: %s, " |
1157 | "only %d of %d bytes sent\n", | ||
1134 | i, get_usb_statmsg(ifd->status), | 1158 | i, get_usb_statmsg(ifd->status), |
1135 | ifd->actual_length, ifd->length); | 1159 | ifd->actual_length, ifd->length); |
1136 | offset = (ifd->offset + | 1160 | offset = (ifd->offset + |
1137 | ifd->actual_length) | 1161 | ifd->actual_length) |
1138 | % BAS_OUTBUFSIZE; | 1162 | % BAS_OUTBUFSIZE; |
1139 | break; | 1163 | break; |
1140 | } | 1164 | } |
1141 | } | 1165 | } |
@@ -1145,25 +1169,26 @@ static void write_iso_tasklet(unsigned long data) | |||
1145 | ifd = &urb->iso_frame_desc[i]; | 1169 | ifd = &urb->iso_frame_desc[i]; |
1146 | if (ifd->status != -EINPROGRESS | 1170 | if (ifd->status != -EINPROGRESS |
1147 | || ifd->actual_length != 0) { | 1171 | || ifd->actual_length != 0) { |
1148 | warn("isochronous write: frame %d: %s, " | 1172 | dev_warn(cs->dev, |
1149 | "%d of %d bytes sent", | 1173 | "isochronous write: frame %d: %s, " |
1174 | "%d of %d bytes sent\n", | ||
1150 | i, get_usb_statmsg(ifd->status), | 1175 | i, get_usb_statmsg(ifd->status), |
1151 | ifd->actual_length, ifd->length); | 1176 | ifd->actual_length, ifd->length); |
1152 | offset = (ifd->offset + | 1177 | offset = (ifd->offset + |
1153 | ifd->actual_length) | 1178 | ifd->actual_length) |
1154 | % BAS_OUTBUFSIZE; | 1179 | % BAS_OUTBUFSIZE; |
1155 | break; | 1180 | break; |
1156 | } | 1181 | } |
1157 | } | 1182 | } |
1158 | #endif | 1183 | #endif |
1159 | break; | 1184 | break; |
1160 | case -EPIPE: //FIXME is this the code for "underrun"? | 1185 | case -EPIPE: //FIXME is this the code for "underrun"? |
1161 | err("isochronous write stalled"); | 1186 | dev_err(cs->dev, "isochronous write stalled\n"); |
1162 | error_hangup(bcs); | 1187 | error_hangup(bcs); |
1163 | break; | 1188 | break; |
1164 | default: /* severe trouble */ | 1189 | default: /* severe trouble */ |
1165 | warn("isochronous write: %s", | 1190 | dev_warn(cs->dev, "isochronous write: %s\n", |
1166 | get_usb_statmsg(urb->status)); | 1191 | get_usb_statmsg(urb->status)); |
1167 | } | 1192 | } |
1168 | 1193 | ||
1169 | /* mark the write buffer area covered by this URB as free */ | 1194 | /* mark the write buffer area covered by this URB as free */ |
@@ -1191,8 +1216,8 @@ static void write_iso_tasklet(unsigned long data) | |||
1191 | if (gigaset_isoc_buildframe(bcs, skb->data, len) == -EAGAIN) { | 1216 | if (gigaset_isoc_buildframe(bcs, skb->data, len) == -EAGAIN) { |
1192 | /* insufficient buffer space, push back onto queue */ | 1217 | /* insufficient buffer space, push back onto queue */ |
1193 | skb_queue_head(&bcs->squeue, skb); | 1218 | skb_queue_head(&bcs->squeue, skb); |
1194 | dbg(DEBUG_ISO, "%s: skb requeued, qlen=%d", | 1219 | gig_dbg(DEBUG_ISO, "%s: skb requeued, qlen=%d", |
1195 | __func__, skb_queue_len(&bcs->squeue)); | 1220 | __func__, skb_queue_len(&bcs->squeue)); |
1196 | break; | 1221 | break; |
1197 | } | 1222 | } |
1198 | skb_pull(skb, len); | 1223 | skb_pull(skb, len); |
@@ -1229,7 +1254,7 @@ static void read_iso_tasklet(unsigned long data) | |||
1229 | 1254 | ||
1230 | /* loop while more completed URBs arrive in the meantime */ | 1255 | /* loop while more completed URBs arrive in the meantime */ |
1231 | for (;;) { | 1256 | for (;;) { |
1232 | if (!atomic_read(&cs->connected)) { | 1257 | if (unlikely(!atomic_read(&cs->connected))) { |
1233 | warn("%s: disconnected", __func__); | 1258 | warn("%s: disconnected", __func__); |
1234 | return; | 1259 | return; |
1235 | } | 1260 | } |
@@ -1242,15 +1267,20 @@ static void read_iso_tasklet(unsigned long data) | |||
1242 | } | 1267 | } |
1243 | ubc->isoindone = NULL; | 1268 | ubc->isoindone = NULL; |
1244 | if (unlikely(ubc->loststatus != -EINPROGRESS)) { | 1269 | if (unlikely(ubc->loststatus != -EINPROGRESS)) { |
1245 | warn("isochronous read overrun, dropped URB with status: %s, %d bytes lost", | 1270 | dev_warn(cs->dev, |
1246 | get_usb_statmsg(ubc->loststatus), ubc->isoinlost); | 1271 | "isochronous read overrun, " |
1272 | "dropped URB with status: %s, %d bytes lost\n", | ||
1273 | get_usb_statmsg(ubc->loststatus), | ||
1274 | ubc->isoinlost); | ||
1247 | ubc->loststatus = -EINPROGRESS; | 1275 | ubc->loststatus = -EINPROGRESS; |
1248 | } | 1276 | } |
1249 | spin_unlock_irqrestore(&ubc->isoinlock, flags); | 1277 | spin_unlock_irqrestore(&ubc->isoinlock, flags); |
1250 | 1278 | ||
1251 | if (unlikely(!(atomic_read(&ubc->running)))) { | 1279 | if (unlikely(!(atomic_read(&ubc->running)))) { |
1252 | dbg(DEBUG_ISO, "%s: channel not running, dropped URB with status: %s", | 1280 | gig_dbg(DEBUG_ISO, |
1253 | __func__, get_usb_statmsg(urb->status)); | 1281 | "%s: channel not running, " |
1282 | "dropped URB with status: %s", | ||
1283 | __func__, get_usb_statmsg(urb->status)); | ||
1254 | return; | 1284 | return; |
1255 | } | 1285 | } |
1256 | 1286 | ||
@@ -1259,22 +1289,23 @@ static void read_iso_tasklet(unsigned long data) | |||
1259 | break; | 1289 | break; |
1260 | case -EXDEV: /* inspect individual frames | 1290 | case -EXDEV: /* inspect individual frames |
1261 | (we do that anyway) */ | 1291 | (we do that anyway) */ |
1262 | dbg(DEBUG_ISO, "%s: URB partially completed", __func__); | 1292 | gig_dbg(DEBUG_ISO, "%s: URB partially completed", |
1293 | __func__); | ||
1263 | break; | 1294 | break; |
1264 | case -ENOENT: | 1295 | case -ENOENT: |
1265 | case -ECONNRESET: | 1296 | case -ECONNRESET: |
1266 | dbg(DEBUG_ISO, "%s: URB canceled", __func__); | 1297 | gig_dbg(DEBUG_ISO, "%s: URB canceled", __func__); |
1267 | continue; /* -> skip */ | 1298 | continue; /* -> skip */ |
1268 | case -EINPROGRESS: /* huh? */ | 1299 | case -EINPROGRESS: /* huh? */ |
1269 | dbg(DEBUG_ISO, "%s: URB still pending", __func__); | 1300 | gig_dbg(DEBUG_ISO, "%s: URB still pending", __func__); |
1270 | continue; /* -> skip */ | 1301 | continue; /* -> skip */ |
1271 | case -EPIPE: | 1302 | case -EPIPE: |
1272 | err("isochronous read stalled"); | 1303 | dev_err(cs->dev, "isochronous read stalled\n"); |
1273 | error_hangup(bcs); | 1304 | error_hangup(bcs); |
1274 | continue; /* -> skip */ | 1305 | continue; /* -> skip */ |
1275 | default: /* severe trouble */ | 1306 | default: /* severe trouble */ |
1276 | warn("isochronous read: %s", | 1307 | dev_warn(cs->dev, "isochronous read: %s\n", |
1277 | get_usb_statmsg(urb->status)); | 1308 | get_usb_statmsg(urb->status)); |
1278 | goto error; | 1309 | goto error; |
1279 | } | 1310 | } |
1280 | 1311 | ||
@@ -1282,33 +1313,44 @@ static void read_iso_tasklet(unsigned long data) | |||
1282 | totleft = urb->actual_length; | 1313 | totleft = urb->actual_length; |
1283 | for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) { | 1314 | for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) { |
1284 | if (unlikely(urb->iso_frame_desc[frame].status)) { | 1315 | if (unlikely(urb->iso_frame_desc[frame].status)) { |
1285 | warn("isochronous read: frame %d: %s", frame, | 1316 | dev_warn(cs->dev, |
1286 | get_usb_statmsg(urb->iso_frame_desc[frame].status)); | 1317 | "isochronous read: frame %d: %s\n", |
1318 | frame, | ||
1319 | get_usb_statmsg( | ||
1320 | urb->iso_frame_desc[frame].status)); | ||
1287 | break; | 1321 | break; |
1288 | } | 1322 | } |
1289 | numbytes = urb->iso_frame_desc[frame].actual_length; | 1323 | numbytes = urb->iso_frame_desc[frame].actual_length; |
1290 | if (unlikely(numbytes > BAS_MAXFRAME)) { | 1324 | if (unlikely(numbytes > BAS_MAXFRAME)) { |
1291 | warn("isochronous read: frame %d: numbytes (%d) > BAS_MAXFRAME", | 1325 | dev_warn(cs->dev, |
1292 | frame, numbytes); | 1326 | "isochronous read: frame %d: " |
1327 | "numbytes (%d) > BAS_MAXFRAME\n", | ||
1328 | frame, numbytes); | ||
1293 | break; | 1329 | break; |
1294 | } | 1330 | } |
1295 | if (unlikely(numbytes > totleft)) { | 1331 | if (unlikely(numbytes > totleft)) { |
1296 | warn("isochronous read: frame %d: numbytes (%d) > totleft (%d)", | 1332 | dev_warn(cs->dev, |
1297 | frame, numbytes, totleft); | 1333 | "isochronous read: frame %d: " |
1334 | "numbytes (%d) > totleft (%d)\n", | ||
1335 | frame, numbytes, totleft); | ||
1298 | break; | 1336 | break; |
1299 | } | 1337 | } |
1300 | offset = urb->iso_frame_desc[frame].offset; | 1338 | offset = urb->iso_frame_desc[frame].offset; |
1301 | if (unlikely(offset + numbytes > BAS_INBUFSIZE)) { | 1339 | if (unlikely(offset + numbytes > BAS_INBUFSIZE)) { |
1302 | warn("isochronous read: frame %d: offset (%d) + numbytes (%d) > BAS_INBUFSIZE", | 1340 | dev_warn(cs->dev, |
1303 | frame, offset, numbytes); | 1341 | "isochronous read: frame %d: " |
1342 | "offset (%d) + numbytes (%d) " | ||
1343 | "> BAS_INBUFSIZE\n", | ||
1344 | frame, offset, numbytes); | ||
1304 | break; | 1345 | break; |
1305 | } | 1346 | } |
1306 | gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs); | 1347 | gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs); |
1307 | totleft -= numbytes; | 1348 | totleft -= numbytes; |
1308 | } | 1349 | } |
1309 | if (unlikely(totleft > 0)) | 1350 | if (unlikely(totleft > 0)) |
1310 | warn("isochronous read: %d data bytes missing", | 1351 | dev_warn(cs->dev, |
1311 | totleft); | 1352 | "isochronous read: %d data bytes missing\n", |
1353 | totleft); | ||
1312 | 1354 | ||
1313 | error: | 1355 | error: |
1314 | /* URB processed, resubmit */ | 1356 | /* URB processed, resubmit */ |
@@ -1316,12 +1358,14 @@ static void read_iso_tasklet(unsigned long data) | |||
1316 | urb->iso_frame_desc[frame].status = 0; | 1358 | urb->iso_frame_desc[frame].status = 0; |
1317 | urb->iso_frame_desc[frame].actual_length = 0; | 1359 | urb->iso_frame_desc[frame].actual_length = 0; |
1318 | } | 1360 | } |
1319 | urb->dev = bcs->cs->hw.bas->udev; /* clobbered by USB subsystem */ | 1361 | /* urb->dev is clobbered by USB subsystem */ |
1362 | urb->dev = bcs->cs->hw.bas->udev; | ||
1320 | urb->transfer_flags = URB_ISO_ASAP; | 1363 | urb->transfer_flags = URB_ISO_ASAP; |
1321 | urb->number_of_packets = BAS_NUMFRAMES; | 1364 | urb->number_of_packets = BAS_NUMFRAMES; |
1322 | if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) { | 1365 | if ((rc = usb_submit_urb(urb, SLAB_ATOMIC)) != 0) { |
1323 | err("could not resubmit isochronous read URB: %s", | 1366 | dev_err(cs->dev, |
1324 | get_usb_statmsg(rc)); | 1367 | "could not resubmit isochronous read URB: %s\n", |
1368 | get_usb_statmsg(rc)); | ||
1325 | dump_urb(DEBUG_ISO, "resubmit iso read", urb); | 1369 | dump_urb(DEBUG_ISO, "resubmit iso read", urb); |
1326 | error_hangup(bcs); | 1370 | error_hangup(bcs); |
1327 | } | 1371 | } |
@@ -1357,33 +1401,34 @@ static void req_timeout(unsigned long data) | |||
1357 | 1401 | ||
1358 | switch (pending) { | 1402 | switch (pending) { |
1359 | case 0: /* no pending request */ | 1403 | case 0: /* no pending request */ |
1360 | dbg(DEBUG_USBREQ, "%s: no request pending", __func__); | 1404 | gig_dbg(DEBUG_USBREQ, "%s: no request pending", __func__); |
1361 | break; | 1405 | break; |
1362 | 1406 | ||
1363 | case HD_OPEN_ATCHANNEL: | 1407 | case HD_OPEN_ATCHANNEL: |
1364 | err("timeout opening AT channel"); | 1408 | dev_err(bcs->cs->dev, "timeout opening AT channel\n"); |
1365 | error_reset(bcs->cs); | 1409 | error_reset(bcs->cs); |
1366 | break; | 1410 | break; |
1367 | 1411 | ||
1368 | case HD_OPEN_B2CHANNEL: | 1412 | case HD_OPEN_B2CHANNEL: |
1369 | case HD_OPEN_B1CHANNEL: | 1413 | case HD_OPEN_B1CHANNEL: |
1370 | err("timeout opening channel %d", bcs->channel + 1); | 1414 | dev_err(bcs->cs->dev, "timeout opening channel %d\n", |
1415 | bcs->channel + 1); | ||
1371 | error_hangup(bcs); | 1416 | error_hangup(bcs); |
1372 | break; | 1417 | break; |
1373 | 1418 | ||
1374 | case HD_CLOSE_ATCHANNEL: | 1419 | case HD_CLOSE_ATCHANNEL: |
1375 | err("timeout closing AT channel"); | 1420 | dev_err(bcs->cs->dev, "timeout closing AT channel\n"); |
1376 | //wake_up_interruptible(cs->initwait); | ||
1377 | //FIXME need own wait queue? | ||
1378 | break; | 1421 | break; |
1379 | 1422 | ||
1380 | case HD_CLOSE_B2CHANNEL: | 1423 | case HD_CLOSE_B2CHANNEL: |
1381 | case HD_CLOSE_B1CHANNEL: | 1424 | case HD_CLOSE_B1CHANNEL: |
1382 | err("timeout closing channel %d", bcs->channel + 1); | 1425 | dev_err(bcs->cs->dev, "timeout closing channel %d\n", |
1426 | bcs->channel + 1); | ||
1383 | break; | 1427 | break; |
1384 | 1428 | ||
1385 | default: | 1429 | default: |
1386 | warn("request 0x%02x timed out, clearing", pending); | 1430 | dev_warn(bcs->cs->dev, "request 0x%02x timed out, clearing\n", |
1431 | pending); | ||
1387 | } | 1432 | } |
1388 | } | 1433 | } |
1389 | 1434 | ||
@@ -1406,8 +1451,9 @@ static void write_ctrl_callback(struct urb *urb, struct pt_regs *regs) | |||
1406 | ucs = (struct bas_cardstate *) urb->context; | 1451 | ucs = (struct bas_cardstate *) urb->context; |
1407 | spin_lock_irqsave(&ucs->lock, flags); | 1452 | spin_lock_irqsave(&ucs->lock, flags); |
1408 | if (urb->status && ucs->pending) { | 1453 | if (urb->status && ucs->pending) { |
1409 | err("control request 0x%02x failed: %s", | 1454 | dev_err(&ucs->interface->dev, |
1410 | ucs->pending, get_usb_statmsg(urb->status)); | 1455 | "control request 0x%02x failed: %s\n", |
1456 | ucs->pending, get_usb_statmsg(urb->status)); | ||
1411 | del_timer(&ucs->timer_ctrl); | 1457 | del_timer(&ucs->timer_ctrl); |
1412 | ucs->pending = 0; | 1458 | ucs->pending = 0; |
1413 | } | 1459 | } |
@@ -1446,18 +1492,21 @@ static int req_submit(struct bc_state *bcs, int req, int val, int timeout) | |||
1446 | IFNULLRETVAL(ucs, -EINVAL); | 1492 | IFNULLRETVAL(ucs, -EINVAL); |
1447 | IFNULLRETVAL(ucs->urb_ctrl, -EINVAL); | 1493 | IFNULLRETVAL(ucs->urb_ctrl, -EINVAL); |
1448 | 1494 | ||
1449 | dbg(DEBUG_USBREQ, "-------> 0x%02x (%d)", req, val); | 1495 | gig_dbg(DEBUG_USBREQ, "-------> 0x%02x (%d)", req, val); |
1450 | 1496 | ||
1451 | spin_lock_irqsave(&ucs->lock, flags); | 1497 | spin_lock_irqsave(&ucs->lock, flags); |
1452 | if (ucs->pending) { | 1498 | if (ucs->pending) { |
1453 | spin_unlock_irqrestore(&ucs->lock, flags); | 1499 | spin_unlock_irqrestore(&ucs->lock, flags); |
1454 | err("submission of request 0x%02x failed: request 0x%02x still pending", | 1500 | dev_err(bcs->cs->dev, |
1455 | req, ucs->pending); | 1501 | "submission of request 0x%02x failed: " |
1502 | "request 0x%02x still pending\n", | ||
1503 | req, ucs->pending); | ||
1456 | return -EBUSY; | 1504 | return -EBUSY; |
1457 | } | 1505 | } |
1458 | if (ucs->urb_ctrl->status == -EINPROGRESS) { | 1506 | if (ucs->urb_ctrl->status == -EINPROGRESS) { |
1459 | spin_unlock_irqrestore(&ucs->lock, flags); | 1507 | spin_unlock_irqrestore(&ucs->lock, flags); |
1460 | err("could not submit request 0x%02x: URB busy", req); | 1508 | dev_err(bcs->cs->dev, |
1509 | "could not submit request 0x%02x: URB busy\n", req); | ||
1461 | return -EBUSY; | 1510 | return -EBUSY; |
1462 | } | 1511 | } |
1463 | 1512 | ||
@@ -1467,19 +1516,19 @@ static int req_submit(struct bc_state *bcs, int req, int val, int timeout) | |||
1467 | ucs->dr_ctrl.wIndex = 0; | 1516 | ucs->dr_ctrl.wIndex = 0; |
1468 | ucs->dr_ctrl.wLength = 0; | 1517 | ucs->dr_ctrl.wLength = 0; |
1469 | usb_fill_control_urb(ucs->urb_ctrl, ucs->udev, | 1518 | usb_fill_control_urb(ucs->urb_ctrl, ucs->udev, |
1470 | usb_sndctrlpipe(ucs->udev, 0), | 1519 | usb_sndctrlpipe(ucs->udev, 0), |
1471 | (unsigned char*) &ucs->dr_ctrl, NULL, 0, | 1520 | (unsigned char*) &ucs->dr_ctrl, NULL, 0, |
1472 | write_ctrl_callback, ucs); | 1521 | write_ctrl_callback, ucs); |
1473 | if ((ret = usb_submit_urb(ucs->urb_ctrl, SLAB_ATOMIC)) != 0) { | 1522 | if ((ret = usb_submit_urb(ucs->urb_ctrl, SLAB_ATOMIC)) != 0) { |
1474 | err("could not submit request 0x%02x: %s", | 1523 | dev_err(bcs->cs->dev, "could not submit request 0x%02x: %s\n", |
1475 | req, get_usb_statmsg(ret)); | 1524 | req, get_usb_statmsg(ret)); |
1476 | spin_unlock_irqrestore(&ucs->lock, flags); | 1525 | spin_unlock_irqrestore(&ucs->lock, flags); |
1477 | return ret; | 1526 | return ret; |
1478 | } | 1527 | } |
1479 | ucs->pending = req; | 1528 | ucs->pending = req; |
1480 | 1529 | ||
1481 | if (timeout > 0) { | 1530 | if (timeout > 0) { |
1482 | dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout); | 1531 | gig_dbg(DEBUG_USBREQ, "setting timeout of %d/10 secs", timeout); |
1483 | ucs->timer_ctrl.expires = jiffies + timeout * HZ / 10; | 1532 | ucs->timer_ctrl.expires = jiffies + timeout * HZ / 10; |
1484 | ucs->timer_ctrl.data = (unsigned long) bcs; | 1533 | ucs->timer_ctrl.data = (unsigned long) bcs; |
1485 | ucs->timer_ctrl.function = req_timeout; | 1534 | ucs->timer_ctrl.function = req_timeout; |
@@ -1505,16 +1554,17 @@ static int gigaset_init_bchannel(struct bc_state *bcs) | |||
1505 | IFNULLRETVAL(bcs, -EINVAL); | 1554 | IFNULLRETVAL(bcs, -EINVAL); |
1506 | 1555 | ||
1507 | if ((ret = starturbs(bcs)) < 0) { | 1556 | if ((ret = starturbs(bcs)) < 0) { |
1508 | err("could not start isochronous I/O for channel %d", | 1557 | dev_err(bcs->cs->dev, |
1509 | bcs->channel + 1); | 1558 | "could not start isochronous I/O for channel %d\n", |
1559 | bcs->channel + 1); | ||
1510 | error_hangup(bcs); | 1560 | error_hangup(bcs); |
1511 | return ret; | 1561 | return ret; |
1512 | } | 1562 | } |
1513 | 1563 | ||
1514 | req = bcs->channel ? HD_OPEN_B2CHANNEL : HD_OPEN_B1CHANNEL; | 1564 | req = bcs->channel ? HD_OPEN_B2CHANNEL : HD_OPEN_B1CHANNEL; |
1515 | if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) { | 1565 | if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) { |
1516 | err("could not open channel %d: %s", | 1566 | dev_err(bcs->cs->dev, "could not open channel %d: %s\n", |
1517 | bcs->channel + 1, get_usb_statmsg(ret)); | 1567 | bcs->channel + 1, get_usb_statmsg(ret)); |
1518 | stopurbs(bcs->hw.bas); | 1568 | stopurbs(bcs->hw.bas); |
1519 | error_hangup(bcs); | 1569 | error_hangup(bcs); |
1520 | } | 1570 | } |
@@ -1546,8 +1596,9 @@ static int gigaset_close_bchannel(struct bc_state *bcs) | |||
1546 | 1596 | ||
1547 | req = bcs->channel ? HD_CLOSE_B2CHANNEL : HD_CLOSE_B1CHANNEL; | 1597 | req = bcs->channel ? HD_CLOSE_B2CHANNEL : HD_CLOSE_B1CHANNEL; |
1548 | if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) | 1598 | if ((ret = req_submit(bcs, req, 0, BAS_TIMEOUT)) < 0) |
1549 | err("could not submit HD_CLOSE_BxCHANNEL request: %s", | 1599 | dev_err(bcs->cs->dev, |
1550 | get_usb_statmsg(ret)); | 1600 | "could not submit HD_CLOSE_BxCHANNEL request: %s\n", |
1601 | get_usb_statmsg(ret)); | ||
1551 | return ret; | 1602 | return ret; |
1552 | } | 1603 | } |
1553 | 1604 | ||
@@ -1570,9 +1621,9 @@ static void complete_cb(struct cardstate *cs) | |||
1570 | 1621 | ||
1571 | /* unqueue completed buffer */ | 1622 | /* unqueue completed buffer */ |
1572 | cs->cmdbytes -= cs->curlen; | 1623 | cs->cmdbytes -= cs->curlen; |
1573 | dbg(DEBUG_TRANSCMD | DEBUG_LOCKCMD, | 1624 | gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, |
1574 | "write_command: sent %u bytes, %u left", | 1625 | "write_command: sent %u bytes, %u left", |
1575 | cs->curlen, cs->cmdbytes); | 1626 | cs->curlen, cs->cmdbytes); |
1576 | if ((cs->cmdbuf = cb->next) != NULL) { | 1627 | if ((cs->cmdbuf = cb->next) != NULL) { |
1577 | cs->cmdbuf->prev = NULL; | 1628 | cs->cmdbuf->prev = NULL; |
1578 | cs->curlen = cs->cmdbuf->len; | 1629 | cs->curlen = cs->cmdbuf->len; |
@@ -1616,22 +1667,27 @@ static void write_command_callback(struct urb *urb, struct pt_regs *regs) | |||
1616 | case -ECONNRESET: /* canceled (async) */ | 1667 | case -ECONNRESET: /* canceled (async) */ |
1617 | case -EINPROGRESS: /* pending */ | 1668 | case -EINPROGRESS: /* pending */ |
1618 | /* ignore silently */ | 1669 | /* ignore silently */ |
1619 | dbg(DEBUG_USBREQ, | 1670 | gig_dbg(DEBUG_USBREQ, "%s: %s", |
1620 | "%s: %s", __func__, get_usb_statmsg(urb->status)); | 1671 | __func__, get_usb_statmsg(urb->status)); |
1621 | return; | 1672 | return; |
1622 | default: /* any failure */ | 1673 | default: /* any failure */ |
1623 | if (++ucs->retry_cmd_out > BAS_RETRY) { | 1674 | if (++ucs->retry_cmd_out > BAS_RETRY) { |
1624 | warn("command write: %s, giving up after %d retries", | 1675 | dev_warn(cs->dev, |
1625 | get_usb_statmsg(urb->status), ucs->retry_cmd_out); | 1676 | "command write: %s, " |
1677 | "giving up after %d retries\n", | ||
1678 | get_usb_statmsg(urb->status), | ||
1679 | ucs->retry_cmd_out); | ||
1626 | break; | 1680 | break; |
1627 | } | 1681 | } |
1628 | if (cs->cmdbuf == NULL) { | 1682 | if (cs->cmdbuf == NULL) { |
1629 | warn("command write: %s, cannot retry - cmdbuf gone", | 1683 | dev_warn(cs->dev, |
1630 | get_usb_statmsg(urb->status)); | 1684 | "command write: %s, " |
1685 | "cannot retry - cmdbuf gone\n", | ||
1686 | get_usb_statmsg(urb->status)); | ||
1631 | break; | 1687 | break; |
1632 | } | 1688 | } |
1633 | notice("command write: %s, retry %d", | 1689 | dev_notice(cs->dev, "command write: %s, retry %d\n", |
1634 | get_usb_statmsg(urb->status), ucs->retry_cmd_out); | 1690 | get_usb_statmsg(urb->status), ucs->retry_cmd_out); |
1635 | if (atwrite_submit(cs, cs->cmdbuf->buf, cs->cmdbuf->len) >= 0) | 1691 | if (atwrite_submit(cs, cs->cmdbuf->buf, cs->cmdbuf->len) >= 0) |
1636 | /* resubmitted - bypass regular exit block */ | 1692 | /* resubmitted - bypass regular exit block */ |
1637 | return; | 1693 | return; |
@@ -1659,7 +1715,7 @@ static void atrdy_timeout(unsigned long data) | |||
1659 | ucs = cs->hw.bas; | 1715 | ucs = cs->hw.bas; |
1660 | IFNULLRET(ucs); | 1716 | IFNULLRET(ucs); |
1661 | 1717 | ||
1662 | warn("timeout waiting for HD_READY_SEND_ATDATA"); | 1718 | dev_warn(cs->dev, "timeout waiting for HD_READY_SEND_ATDATA\n"); |
1663 | 1719 | ||
1664 | /* fake the missing signal - what else can I do? */ | 1720 | /* fake the missing signal - what else can I do? */ |
1665 | update_basstate(ucs, BS_ATREADY, BS_ATTIMER); | 1721 | update_basstate(ucs, BS_ATREADY, BS_ATTIMER); |
@@ -1688,10 +1744,11 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) | |||
1688 | IFNULLRETVAL(ucs, -EFAULT); | 1744 | IFNULLRETVAL(ucs, -EFAULT); |
1689 | IFNULLRETVAL(ucs->urb_cmd_out, -EFAULT); | 1745 | IFNULLRETVAL(ucs->urb_cmd_out, -EFAULT); |
1690 | 1746 | ||
1691 | dbg(DEBUG_USBREQ, "-------> HD_WRITE_ATMESSAGE (%d)", len); | 1747 | gig_dbg(DEBUG_USBREQ, "-------> HD_WRITE_ATMESSAGE (%d)", len); |
1692 | 1748 | ||
1693 | if (ucs->urb_cmd_out->status == -EINPROGRESS) { | 1749 | if (ucs->urb_cmd_out->status == -EINPROGRESS) { |
1694 | err("could not submit HD_WRITE_ATMESSAGE: URB busy"); | 1750 | dev_err(cs->dev, |
1751 | "could not submit HD_WRITE_ATMESSAGE: URB busy\n"); | ||
1695 | return -EBUSY; | 1752 | return -EBUSY; |
1696 | } | 1753 | } |
1697 | 1754 | ||
@@ -1706,8 +1763,8 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) | |||
1706 | write_command_callback, cs); | 1763 | write_command_callback, cs); |
1707 | 1764 | ||
1708 | if ((ret = usb_submit_urb(ucs->urb_cmd_out, SLAB_ATOMIC)) != 0) { | 1765 | if ((ret = usb_submit_urb(ucs->urb_cmd_out, SLAB_ATOMIC)) != 0) { |
1709 | err("could not submit HD_WRITE_ATMESSAGE: %s", | 1766 | dev_err(cs->dev, "could not submit HD_WRITE_ATMESSAGE: %s\n", |
1710 | get_usb_statmsg(ret)); | 1767 | get_usb_statmsg(ret)); |
1711 | return ret; | 1768 | return ret; |
1712 | } | 1769 | } |
1713 | 1770 | ||
@@ -1716,8 +1773,8 @@ static int atwrite_submit(struct cardstate *cs, unsigned char *buf, int len) | |||
1716 | 1773 | ||
1717 | /* start timeout if necessary */ | 1774 | /* start timeout if necessary */ |
1718 | if (!(atomic_read(&ucs->basstate) & BS_ATTIMER)) { | 1775 | if (!(atomic_read(&ucs->basstate) & BS_ATTIMER)) { |
1719 | dbg(DEBUG_OUTPUT, | 1776 | gig_dbg(DEBUG_OUTPUT, "setting ATREADY timeout of %d/10 secs", |
1720 | "setting ATREADY timeout of %d/10 secs", ATRDY_TIMEOUT); | 1777 | ATRDY_TIMEOUT); |
1721 | ucs->timer_atrdy.expires = jiffies + ATRDY_TIMEOUT * HZ / 10; | 1778 | ucs->timer_atrdy.expires = jiffies + ATRDY_TIMEOUT * HZ / 10; |
1722 | ucs->timer_atrdy.data = (unsigned long) cs; | 1779 | ucs->timer_atrdy.data = (unsigned long) cs; |
1723 | ucs->timer_atrdy.function = atrdy_timeout; | 1780 | ucs->timer_atrdy.function = atrdy_timeout; |
@@ -1749,10 +1806,10 @@ static int start_cbsend(struct cardstate *cs) | |||
1749 | 1806 | ||
1750 | /* check if AT channel is open */ | 1807 | /* check if AT channel is open */ |
1751 | if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) { | 1808 | if (!(atomic_read(&ucs->basstate) & BS_ATOPEN)) { |
1752 | dbg(DEBUG_TRANSCMD | DEBUG_LOCKCMD, "AT channel not open"); | 1809 | gig_dbg(DEBUG_TRANSCMD|DEBUG_LOCKCMD, "AT channel not open"); |
1753 | rc = req_submit(cs->bcs, HD_OPEN_ATCHANNEL, 0, BAS_TIMEOUT); | 1810 | rc = req_submit(cs->bcs, HD_OPEN_ATCHANNEL, 0, BAS_TIMEOUT); |
1754 | if (rc < 0) { | 1811 | if (rc < 0) { |
1755 | err("could not open AT channel"); | 1812 | dev_err(cs->dev, "could not open AT channel\n"); |
1756 | /* flush command queue */ | 1813 | /* flush command queue */ |
1757 | spin_lock_irqsave(&cs->cmdlock, flags); | 1814 | spin_lock_irqsave(&cs->cmdlock, flags); |
1758 | while (cs->cmdbuf != NULL) | 1815 | while (cs->cmdbuf != NULL) |
@@ -1797,19 +1854,19 @@ static int start_cbsend(struct cardstate *cs) | |||
1797 | * error code < 0 on error | 1854 | * error code < 0 on error |
1798 | */ | 1855 | */ |
1799 | static int gigaset_write_cmd(struct cardstate *cs, | 1856 | static int gigaset_write_cmd(struct cardstate *cs, |
1800 | const unsigned char *buf, int len, | 1857 | const unsigned char *buf, int len, |
1801 | struct tasklet_struct *wake_tasklet) | 1858 | struct tasklet_struct *wake_tasklet) |
1802 | { | 1859 | { |
1803 | struct cmdbuf_t *cb; | 1860 | struct cmdbuf_t *cb; |
1804 | unsigned long flags; | 1861 | unsigned long flags; |
1805 | int status; | 1862 | int status; |
1806 | 1863 | ||
1807 | gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ? | 1864 | gigaset_dbg_buffer(atomic_read(&cs->mstate) != MS_LOCKED ? |
1808 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, | 1865 | DEBUG_TRANSCMD : DEBUG_LOCKCMD, |
1809 | "CMD Transmit", len, buf, 0); | 1866 | "CMD Transmit", len, buf, 0); |
1810 | 1867 | ||
1811 | if (!atomic_read(&cs->connected)) { | 1868 | if (unlikely(!atomic_read(&cs->connected))) { |
1812 | err("%s: not connected", __func__); | 1869 | err("%s: disconnected", __func__); |
1813 | return -ENODEV; | 1870 | return -ENODEV; |
1814 | } | 1871 | } |
1815 | 1872 | ||
@@ -1819,7 +1876,7 @@ static int gigaset_write_cmd(struct cardstate *cs, | |||
1819 | if (len > IF_WRITEBUF) | 1876 | if (len > IF_WRITEBUF) |
1820 | len = IF_WRITEBUF; | 1877 | len = IF_WRITEBUF; |
1821 | if (!(cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC))) { | 1878 | if (!(cb = kmalloc(sizeof(struct cmdbuf_t) + len, GFP_ATOMIC))) { |
1822 | err("%s: out of memory", __func__); | 1879 | dev_err(cs->dev, "%s: out of memory\n", __func__); |
1823 | return -ENOMEM; | 1880 | return -ENOMEM; |
1824 | } | 1881 | } |
1825 | 1882 | ||
@@ -1947,7 +2004,7 @@ static int gigaset_initbcshw(struct bc_state *bcs) | |||
1947 | return 0; | 2004 | return 0; |
1948 | } | 2005 | } |
1949 | tasklet_init(&ubc->sent_tasklet, | 2006 | tasklet_init(&ubc->sent_tasklet, |
1950 | &write_iso_tasklet, (unsigned long) bcs); | 2007 | &write_iso_tasklet, (unsigned long) bcs); |
1951 | 2008 | ||
1952 | spin_lock_init(&ubc->isoinlock); | 2009 | spin_lock_init(&ubc->isoinlock); |
1953 | for (i = 0; i < BAS_INURBS; ++i) | 2010 | for (i = 0; i < BAS_INURBS; ++i) |
@@ -1968,7 +2025,7 @@ static int gigaset_initbcshw(struct bc_state *bcs) | |||
1968 | ubc->shared0s = 0; | 2025 | ubc->shared0s = 0; |
1969 | ubc->stolen0s = 0; | 2026 | ubc->stolen0s = 0; |
1970 | tasklet_init(&ubc->rcvd_tasklet, | 2027 | tasklet_init(&ubc->rcvd_tasklet, |
1971 | &read_iso_tasklet, (unsigned long) bcs); | 2028 | &read_iso_tasklet, (unsigned long) bcs); |
1972 | return 1; | 2029 | return 1; |
1973 | } | 2030 | } |
1974 | 2031 | ||
@@ -2041,43 +2098,47 @@ static void freeurbs(struct cardstate *cs) | |||
2041 | for (i = 0; i < BAS_OUTURBS; ++i) | 2098 | for (i = 0; i < BAS_OUTURBS; ++i) |
2042 | if (ubc->isoouturbs[i].urb) { | 2099 | if (ubc->isoouturbs[i].urb) { |
2043 | usb_kill_urb(ubc->isoouturbs[i].urb); | 2100 | usb_kill_urb(ubc->isoouturbs[i].urb); |
2044 | dbg(DEBUG_INIT, | 2101 | gig_dbg(DEBUG_INIT, |
2045 | "%s: isoc output URB %d/%d unlinked", | 2102 | "%s: isoc output URB %d/%d unlinked", |
2046 | __func__, j, i); | 2103 | __func__, j, i); |
2047 | usb_free_urb(ubc->isoouturbs[i].urb); | 2104 | usb_free_urb(ubc->isoouturbs[i].urb); |
2048 | ubc->isoouturbs[i].urb = NULL; | 2105 | ubc->isoouturbs[i].urb = NULL; |
2049 | } | 2106 | } |
2050 | for (i = 0; i < BAS_INURBS; ++i) | 2107 | for (i = 0; i < BAS_INURBS; ++i) |
2051 | if (ubc->isoinurbs[i]) { | 2108 | if (ubc->isoinurbs[i]) { |
2052 | usb_kill_urb(ubc->isoinurbs[i]); | 2109 | usb_kill_urb(ubc->isoinurbs[i]); |
2053 | dbg(DEBUG_INIT, | 2110 | gig_dbg(DEBUG_INIT, |
2054 | "%s: isoc input URB %d/%d unlinked", | 2111 | "%s: isoc input URB %d/%d unlinked", |
2055 | __func__, j, i); | 2112 | __func__, j, i); |
2056 | usb_free_urb(ubc->isoinurbs[i]); | 2113 | usb_free_urb(ubc->isoinurbs[i]); |
2057 | ubc->isoinurbs[i] = NULL; | 2114 | ubc->isoinurbs[i] = NULL; |
2058 | } | 2115 | } |
2059 | } | 2116 | } |
2060 | if (ucs->urb_int_in) { | 2117 | if (ucs->urb_int_in) { |
2061 | usb_kill_urb(ucs->urb_int_in); | 2118 | usb_kill_urb(ucs->urb_int_in); |
2062 | dbg(DEBUG_INIT, "%s: interrupt input URB unlinked", __func__); | 2119 | gig_dbg(DEBUG_INIT, "%s: interrupt input URB unlinked", |
2120 | __func__); | ||
2063 | usb_free_urb(ucs->urb_int_in); | 2121 | usb_free_urb(ucs->urb_int_in); |
2064 | ucs->urb_int_in = NULL; | 2122 | ucs->urb_int_in = NULL; |
2065 | } | 2123 | } |
2066 | if (ucs->urb_cmd_out) { | 2124 | if (ucs->urb_cmd_out) { |
2067 | usb_kill_urb(ucs->urb_cmd_out); | 2125 | usb_kill_urb(ucs->urb_cmd_out); |
2068 | dbg(DEBUG_INIT, "%s: command output URB unlinked", __func__); | 2126 | gig_dbg(DEBUG_INIT, "%s: command output URB unlinked", |
2127 | __func__); | ||
2069 | usb_free_urb(ucs->urb_cmd_out); | 2128 | usb_free_urb(ucs->urb_cmd_out); |
2070 | ucs->urb_cmd_out = NULL; | 2129 | ucs->urb_cmd_out = NULL; |
2071 | } | 2130 | } |
2072 | if (ucs->urb_cmd_in) { | 2131 | if (ucs->urb_cmd_in) { |
2073 | usb_kill_urb(ucs->urb_cmd_in); | 2132 | usb_kill_urb(ucs->urb_cmd_in); |
2074 | dbg(DEBUG_INIT, "%s: command input URB unlinked", __func__); | 2133 | gig_dbg(DEBUG_INIT, "%s: command input URB unlinked", |
2134 | __func__); | ||
2075 | usb_free_urb(ucs->urb_cmd_in); | 2135 | usb_free_urb(ucs->urb_cmd_in); |
2076 | ucs->urb_cmd_in = NULL; | 2136 | ucs->urb_cmd_in = NULL; |
2077 | } | 2137 | } |
2078 | if (ucs->urb_ctrl) { | 2138 | if (ucs->urb_ctrl) { |
2079 | usb_kill_urb(ucs->urb_ctrl); | 2139 | usb_kill_urb(ucs->urb_ctrl); |
2080 | dbg(DEBUG_INIT, "%s: control output URB unlinked", __func__); | 2140 | gig_dbg(DEBUG_INIT, "%s: control output URB unlinked", |
2141 | __func__); | ||
2081 | usb_free_urb(ucs->urb_ctrl); | 2142 | usb_free_urb(ucs->urb_ctrl); |
2082 | ucs->urb_ctrl = NULL; | 2143 | ucs->urb_ctrl = NULL; |
2083 | } | 2144 | } |
@@ -2101,10 +2162,10 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2101 | 2162 | ||
2102 | IFNULLRETVAL(udev, -ENODEV); | 2163 | IFNULLRETVAL(udev, -ENODEV); |
2103 | 2164 | ||
2104 | dbg(DEBUG_ANY, | 2165 | gig_dbg(DEBUG_ANY, |
2105 | "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", | 2166 | "%s: Check if device matches .. (Vendor: 0x%x, Product: 0x%x)", |
2106 | __func__, le16_to_cpu(udev->descriptor.idVendor), | 2167 | __func__, le16_to_cpu(udev->descriptor.idVendor), |
2107 | le16_to_cpu(udev->descriptor.idProduct)); | 2168 | le16_to_cpu(udev->descriptor.idProduct)); |
2108 | 2169 | ||
2109 | /* See if the device offered us matches what we can accept */ | 2170 | /* See if the device offered us matches what we can accept */ |
2110 | if ((le16_to_cpu(udev->descriptor.idVendor) != USB_GIGA_VENDOR_ID) || | 2171 | if ((le16_to_cpu(udev->descriptor.idVendor) != USB_GIGA_VENDOR_ID) || |
@@ -2112,20 +2173,21 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2112 | le16_to_cpu(udev->descriptor.idProduct) != USB_4175_PRODUCT_ID && | 2173 | le16_to_cpu(udev->descriptor.idProduct) != USB_4175_PRODUCT_ID && |
2113 | le16_to_cpu(udev->descriptor.idProduct) != USB_SX303_PRODUCT_ID && | 2174 | le16_to_cpu(udev->descriptor.idProduct) != USB_SX303_PRODUCT_ID && |
2114 | le16_to_cpu(udev->descriptor.idProduct) != USB_SX353_PRODUCT_ID)) { | 2175 | le16_to_cpu(udev->descriptor.idProduct) != USB_SX353_PRODUCT_ID)) { |
2115 | dbg(DEBUG_ANY, "%s: unmatched ID - exiting", __func__); | 2176 | gig_dbg(DEBUG_ANY, "%s: unmatched ID - exiting", __func__); |
2116 | return -ENODEV; | 2177 | return -ENODEV; |
2117 | } | 2178 | } |
2118 | 2179 | ||
2119 | /* set required alternate setting */ | 2180 | /* set required alternate setting */ |
2120 | hostif = interface->cur_altsetting; | 2181 | hostif = interface->cur_altsetting; |
2121 | if (hostif->desc.bAlternateSetting != 3) { | 2182 | if (hostif->desc.bAlternateSetting != 3) { |
2122 | dbg(DEBUG_ANY, | 2183 | gig_dbg(DEBUG_ANY, |
2123 | "%s: wrong alternate setting %d - trying to switch", | 2184 | "%s: wrong alternate setting %d - trying to switch", |
2124 | __func__, hostif->desc.bAlternateSetting); | 2185 | __func__, hostif->desc.bAlternateSetting); |
2125 | if (usb_set_interface(udev, hostif->desc.bInterfaceNumber, 3) < 0) { | 2186 | if (usb_set_interface(udev, hostif->desc.bInterfaceNumber, 3) < 0) { |
2126 | warn("usb_set_interface failed, device %d interface %d altsetting %d", | 2187 | dev_warn(&udev->dev, "usb_set_interface failed, " |
2127 | udev->devnum, hostif->desc.bInterfaceNumber, | 2188 | "device %d interface %d altsetting %d\n", |
2128 | hostif->desc.bAlternateSetting); | 2189 | udev->devnum, hostif->desc.bInterfaceNumber, |
2190 | hostif->desc.bAlternateSetting); | ||
2129 | return -ENODEV; | 2191 | return -ENODEV; |
2130 | } | 2192 | } |
2131 | hostif = interface->cur_altsetting; | 2193 | hostif = interface->cur_altsetting; |
@@ -2134,23 +2196,28 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2134 | /* Reject application specific interfaces | 2196 | /* Reject application specific interfaces |
2135 | */ | 2197 | */ |
2136 | if (hostif->desc.bInterfaceClass != 255) { | 2198 | if (hostif->desc.bInterfaceClass != 255) { |
2137 | warn("%s: bInterfaceClass == %d", | 2199 | dev_warn(&udev->dev, "%s: bInterfaceClass == %d\n", |
2138 | __func__, hostif->desc.bInterfaceClass); | 2200 | __func__, hostif->desc.bInterfaceClass); |
2139 | return -ENODEV; | 2201 | return -ENODEV; |
2140 | } | 2202 | } |
2141 | 2203 | ||
2142 | info("%s: Device matched (Vendor: 0x%x, Product: 0x%x)", | 2204 | dev_info(&udev->dev, |
2143 | __func__, le16_to_cpu(udev->descriptor.idVendor), | 2205 | "%s: Device matched (Vendor: 0x%x, Product: 0x%x)\n", |
2144 | le16_to_cpu(udev->descriptor.idProduct)); | 2206 | __func__, le16_to_cpu(udev->descriptor.idVendor), |
2207 | le16_to_cpu(udev->descriptor.idProduct)); | ||
2145 | 2208 | ||
2146 | cs = gigaset_getunassignedcs(driver); | 2209 | cs = gigaset_getunassignedcs(driver); |
2147 | if (!cs) { | 2210 | if (!cs) { |
2148 | err("%s: no free cardstate", __func__); | 2211 | dev_err(&udev->dev, "no free cardstate\n"); |
2149 | return -ENODEV; | 2212 | return -ENODEV; |
2150 | } | 2213 | } |
2151 | ucs = cs->hw.bas; | 2214 | ucs = cs->hw.bas; |
2215 | |||
2216 | /* save off device structure ptrs for later use */ | ||
2217 | usb_get_dev(udev); | ||
2152 | ucs->udev = udev; | 2218 | ucs->udev = udev; |
2153 | ucs->interface = interface; | 2219 | ucs->interface = interface; |
2220 | cs->dev = &udev->dev; | ||
2154 | 2221 | ||
2155 | /* allocate URBs: | 2222 | /* allocate URBs: |
2156 | * - one for the interrupt pipe | 2223 | * - one for the interrupt pipe |
@@ -2159,22 +2226,22 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2159 | */ | 2226 | */ |
2160 | ucs->urb_int_in = usb_alloc_urb(0, SLAB_KERNEL); | 2227 | ucs->urb_int_in = usb_alloc_urb(0, SLAB_KERNEL); |
2161 | if (!ucs->urb_int_in) { | 2228 | if (!ucs->urb_int_in) { |
2162 | err("No free urbs available"); | 2229 | dev_err(cs->dev, "no free urbs available\n"); |
2163 | goto error; | 2230 | goto error; |
2164 | } | 2231 | } |
2165 | ucs->urb_cmd_in = usb_alloc_urb(0, SLAB_KERNEL); | 2232 | ucs->urb_cmd_in = usb_alloc_urb(0, SLAB_KERNEL); |
2166 | if (!ucs->urb_cmd_in) { | 2233 | if (!ucs->urb_cmd_in) { |
2167 | err("No free urbs available"); | 2234 | dev_err(cs->dev, "no free urbs available\n"); |
2168 | goto error; | 2235 | goto error; |
2169 | } | 2236 | } |
2170 | ucs->urb_cmd_out = usb_alloc_urb(0, SLAB_KERNEL); | 2237 | ucs->urb_cmd_out = usb_alloc_urb(0, SLAB_KERNEL); |
2171 | if (!ucs->urb_cmd_out) { | 2238 | if (!ucs->urb_cmd_out) { |
2172 | err("No free urbs available"); | 2239 | dev_err(cs->dev, "no free urbs available\n"); |
2173 | goto error; | 2240 | goto error; |
2174 | } | 2241 | } |
2175 | ucs->urb_ctrl = usb_alloc_urb(0, SLAB_KERNEL); | 2242 | ucs->urb_ctrl = usb_alloc_urb(0, SLAB_KERNEL); |
2176 | if (!ucs->urb_ctrl) { | 2243 | if (!ucs->urb_ctrl) { |
2177 | err("No free urbs available"); | 2244 | dev_err(cs->dev, "no free urbs available\n"); |
2178 | goto error; | 2245 | goto error; |
2179 | } | 2246 | } |
2180 | 2247 | ||
@@ -2184,7 +2251,7 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2184 | ubc->isoouturbs[i].urb = | 2251 | ubc->isoouturbs[i].urb = |
2185 | usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL); | 2252 | usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL); |
2186 | if (!ubc->isoouturbs[i].urb) { | 2253 | if (!ubc->isoouturbs[i].urb) { |
2187 | err("No free urbs available"); | 2254 | dev_err(cs->dev, "no free urbs available\n"); |
2188 | goto error; | 2255 | goto error; |
2189 | } | 2256 | } |
2190 | } | 2257 | } |
@@ -2192,7 +2259,7 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2192 | ubc->isoinurbs[i] = | 2259 | ubc->isoinurbs[i] = |
2193 | usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL); | 2260 | usb_alloc_urb(BAS_NUMFRAMES, SLAB_KERNEL); |
2194 | if (!ubc->isoinurbs[i]) { | 2261 | if (!ubc->isoinurbs[i]) { |
2195 | err("No free urbs available"); | 2262 | dev_err(cs->dev, "no free urbs available\n"); |
2196 | goto error; | 2263 | goto error; |
2197 | } | 2264 | } |
2198 | } | 2265 | } |
@@ -2204,13 +2271,14 @@ static int gigaset_probe(struct usb_interface *interface, | |||
2204 | /* Fill the interrupt urb and send it to the core */ | 2271 | /* Fill the interrupt urb and send it to the core */ |
2205 | endpoint = &hostif->endpoint[0].desc; | 2272 | endpoint = &hostif->endpoint[0].desc; |
2206 | usb_fill_int_urb(ucs->urb_int_in, udev, | 2273 | usb_fill_int_urb(ucs->urb_int_in, udev, |
2207 | usb_rcvintpipe(udev, | 2274 | usb_rcvintpipe(udev, |
2208 | (endpoint->bEndpointAddress) & 0x0f), | 2275 | (endpoint->bEndpointAddress) & 0x0f), |
2209 | ucs->int_in_buf, 3, read_int_callback, cs, | 2276 | ucs->int_in_buf, 3, read_int_callback, cs, |
2210 | endpoint->bInterval); | 2277 | endpoint->bInterval); |
2211 | ret = usb_submit_urb(ucs->urb_int_in, SLAB_KERNEL); | 2278 | ret = usb_submit_urb(ucs->urb_int_in, SLAB_KERNEL); |
2212 | if (ret) { | 2279 | if (ret) { |
2213 | err("could not submit interrupt URB: %s", get_usb_statmsg(ret)); | 2280 | dev_err(cs->dev, "could not submit interrupt URB: %s\n", |
2281 | get_usb_statmsg(ret)); | ||
2214 | goto error; | 2282 | goto error; |
2215 | } | 2283 | } |
2216 | 2284 | ||
@@ -2255,7 +2323,7 @@ static void gigaset_disconnect(struct usb_interface *interface) | |||
2255 | ucs = cs->hw.bas; | 2323 | ucs = cs->hw.bas; |
2256 | IFNULLRET(ucs); | 2324 | IFNULLRET(ucs); |
2257 | 2325 | ||
2258 | info("disconnecting GigaSet base"); | 2326 | dev_info(cs->dev, "disconnecting GigaSet base"); |
2259 | gigaset_stop(cs); | 2327 | gigaset_stop(cs); |
2260 | freeurbs(cs); | 2328 | freeurbs(cs); |
2261 | kfree(ucs->rcvbuf); | 2329 | kfree(ucs->rcvbuf); |
@@ -2293,9 +2361,9 @@ static int __init bas_gigaset_init(void) | |||
2293 | 2361 | ||
2294 | /* allocate memory for our driver state and intialize it */ | 2362 | /* allocate memory for our driver state and intialize it */ |
2295 | if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, | 2363 | if ((driver = gigaset_initdriver(GIGASET_MINOR, GIGASET_MINORS, |
2296 | GIGASET_MODULENAME, GIGASET_DEVNAME, | 2364 | GIGASET_MODULENAME, GIGASET_DEVNAME, |
2297 | GIGASET_DEVFSNAME, &gigops, | 2365 | GIGASET_DEVFSNAME, &gigops, |
2298 | THIS_MODULE)) == NULL) | 2366 | THIS_MODULE)) == NULL) |
2299 | goto error; | 2367 | goto error; |
2300 | 2368 | ||
2301 | /* allocate memory for our device state and intialize it */ | 2369 | /* allocate memory for our device state and intialize it */ |
@@ -2330,19 +2398,18 @@ error: if (cardstate) | |||
2330 | static void __exit bas_gigaset_exit(void) | 2398 | static void __exit bas_gigaset_exit(void) |
2331 | { | 2399 | { |
2332 | gigaset_blockdriver(driver); /* => probe will fail | 2400 | gigaset_blockdriver(driver); /* => probe will fail |
2333 | * => no gigaset_start any more | 2401 | * => no gigaset_start any more |
2334 | */ | 2402 | */ |
2335 | 2403 | ||
2336 | gigaset_shutdown(cardstate); | 2404 | gigaset_shutdown(cardstate); |
2337 | /* from now on, no isdn callback should be possible */ | 2405 | /* from now on, no isdn callback should be possible */ |
2338 | 2406 | ||
2339 | if (atomic_read(&cardstate->hw.bas->basstate) & BS_ATOPEN) { | 2407 | if (atomic_read(&cardstate->hw.bas->basstate) & BS_ATOPEN) { |
2340 | dbg(DEBUG_ANY, "closing AT channel"); | 2408 | gig_dbg(DEBUG_ANY, "closing AT channel"); |
2341 | if (req_submit(cardstate->bcs, | 2409 | if (req_submit(cardstate->bcs, |
2342 | HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT) >= 0) { | 2410 | HD_CLOSE_ATCHANNEL, 0, BAS_TIMEOUT) >= 0) { |
2343 | /* successfully submitted - wait for completion */ | 2411 | /* successfully submitted */ |
2344 | //wait_event_interruptible(cs->initwait, !cs->hw.bas->pending); | 2412 | //FIXME wait for completion? |
2345 | //FIXME need own wait queue? wakeup? | ||
2346 | } | 2413 | } |
2347 | } | 2414 | } |
2348 | 2415 | ||