aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/sierra.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/sierra.c')
-rw-r--r--drivers/usb/serial/sierra.c69
1 files changed, 38 insertions, 31 deletions
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index 8b9eaf383679..6794e5721df6 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -247,7 +247,7 @@ static int sierra_send_setup(struct tty_struct *tty,
247 struct sierra_port_private *portdata; 247 struct sierra_port_private *portdata;
248 __u16 interface = 0; 248 __u16 interface = 0;
249 249
250 dbg("%s", __func__); 250 dev_dbg(&port->dev, "%s", __func__);
251 251
252 portdata = usb_get_serial_port_data(port); 252 portdata = usb_get_serial_port_data(port);
253 253
@@ -284,7 +284,7 @@ static int sierra_send_setup(struct tty_struct *tty,
284static void sierra_set_termios(struct tty_struct *tty, 284static void sierra_set_termios(struct tty_struct *tty,
285 struct usb_serial_port *port, struct ktermios *old_termios) 285 struct usb_serial_port *port, struct ktermios *old_termios)
286{ 286{
287 dbg("%s", __func__); 287 dev_dbg(&port->dev, "%s", __func__);
288 tty_termios_copy_hw(tty->termios, old_termios); 288 tty_termios_copy_hw(tty->termios, old_termios);
289 sierra_send_setup(tty, port); 289 sierra_send_setup(tty, port);
290} 290}
@@ -295,6 +295,7 @@ static int sierra_tiocmget(struct tty_struct *tty, struct file *file)
295 unsigned int value; 295 unsigned int value;
296 struct sierra_port_private *portdata; 296 struct sierra_port_private *portdata;
297 297
298 dev_dbg(&port->dev, "%s", __func__);
298 portdata = usb_get_serial_port_data(port); 299 portdata = usb_get_serial_port_data(port);
299 300
300 value = ((portdata->rts_state) ? TIOCM_RTS : 0) | 301 value = ((portdata->rts_state) ? TIOCM_RTS : 0) |
@@ -334,14 +335,14 @@ static void sierra_outdat_callback(struct urb *urb)
334 int status = urb->status; 335 int status = urb->status;
335 unsigned long flags; 336 unsigned long flags;
336 337
337 dbg("%s - port %d", __func__, port->number); 338 dev_dbg(&port->dev, "%s - port %d", __func__, port->number);
338 339
339 /* free up the transfer buffer, as usb_free_urb() does not do this */ 340 /* free up the transfer buffer, as usb_free_urb() does not do this */
340 kfree(urb->transfer_buffer); 341 kfree(urb->transfer_buffer);
341 342
342 if (status) 343 if (status)
343 dbg("%s - nonzero write bulk status received: %d", 344 dev_dbg(&port->dev, "%s - nonzero write bulk status "
344 __func__, status); 345 "received: %d", __func__, status);
345 346
346 spin_lock_irqsave(&portdata->lock, flags); 347 spin_lock_irqsave(&portdata->lock, flags);
347 --portdata->outstanding_urbs; 348 --portdata->outstanding_urbs;
@@ -363,12 +364,12 @@ static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port,
363 364
364 portdata = usb_get_serial_port_data(port); 365 portdata = usb_get_serial_port_data(port);
365 366
366 dbg("%s: write (%d chars)", __func__, count); 367 dev_dbg(&port->dev, "%s: write (%d chars)", __func__, count);
367 368
368 spin_lock_irqsave(&portdata->lock, flags); 369 spin_lock_irqsave(&portdata->lock, flags);
369 if (portdata->outstanding_urbs > N_OUT_URB) { 370 if (portdata->outstanding_urbs > N_OUT_URB) {
370 spin_unlock_irqrestore(&portdata->lock, flags); 371 spin_unlock_irqrestore(&portdata->lock, flags);
371 dbg("%s - write limit hit\n", __func__); 372 dev_dbg(&port->dev, "%s - write limit hit\n", __func__);
372 return 0; 373 return 0;
373 } 374 }
374 portdata->outstanding_urbs++; 375 portdata->outstanding_urbs++;
@@ -437,8 +438,8 @@ static void sierra_indat_callback(struct urb *urb)
437 port = urb->context; 438 port = urb->context;
438 439
439 if (status) { 440 if (status) {
440 dbg("%s: nonzero status: %d on endpoint %02x.", 441 dev_dbg(&port->dev, "%s: nonzero status: %d on"
441 __func__, status, endpoint); 442 " endpoint %02x.", __func__, status, endpoint);
442 } else { 443 } else {
443 if (urb->actual_length) { 444 if (urb->actual_length) {
444 tty = tty_port_tty_get(&port->port); 445 tty = tty_port_tty_get(&port->port);
@@ -447,7 +448,8 @@ static void sierra_indat_callback(struct urb *urb)
447 tty_flip_buffer_push(tty); 448 tty_flip_buffer_push(tty);
448 tty_kref_put(tty); 449 tty_kref_put(tty);
449 } else 450 } else
450 dbg("%s: empty read urb received", __func__); 451 dev_dbg(&port->dev, "%s: empty read urb"
452 " received", __func__);
451 453
452 /* Resubmit urb so we continue receiving */ 454 /* Resubmit urb so we continue receiving */
453 if (port->port.count && status != -ESHUTDOWN) { 455 if (port->port.count && status != -ESHUTDOWN) {
@@ -468,15 +470,17 @@ static void sierra_instat_callback(struct urb *urb)
468 struct sierra_port_private *portdata = usb_get_serial_port_data(port); 470 struct sierra_port_private *portdata = usb_get_serial_port_data(port);
469 struct usb_serial *serial = port->serial; 471 struct usb_serial *serial = port->serial;
470 472
471 dbg("%s", __func__); 473 dev_dbg(&port->dev, "%s", __func__);
472 dbg("%s: urb %p port %p has data %p", __func__, urb, port, portdata); 474 dev_dbg(&port->dev, "%s: urb %p port %p has data %p", __func__,
475 urb, port, portdata);
473 476
474 if (status == 0) { 477 if (status == 0) {
475 struct usb_ctrlrequest *req_pkt = 478 struct usb_ctrlrequest *req_pkt =
476 (struct usb_ctrlrequest *)urb->transfer_buffer; 479 (struct usb_ctrlrequest *)urb->transfer_buffer;
477 480
478 if (!req_pkt) { 481 if (!req_pkt) {
479 dbg("%s: NULL req_pkt\n", __func__); 482 dev_dbg(&port->dev, "%s: NULL req_pkt\n",
483 __func__);
480 return; 484 return;
481 } 485 }
482 if ((req_pkt->bRequestType == 0xA1) && 486 if ((req_pkt->bRequestType == 0xA1) &&
@@ -487,7 +491,8 @@ static void sierra_instat_callback(struct urb *urb)
487 sizeof(struct usb_ctrlrequest)); 491 sizeof(struct usb_ctrlrequest));
488 struct tty_struct *tty; 492 struct tty_struct *tty;
489 493
490 dbg("%s: signal x%x", __func__, signals); 494 dev_dbg(&port->dev, "%s: signal x%x", __func__,
495 signals);
491 496
492 old_dcd_state = portdata->dcd_state; 497 old_dcd_state = portdata->dcd_state;
493 portdata->cts_state = 1; 498 portdata->cts_state = 1;
@@ -501,19 +506,20 @@ static void sierra_instat_callback(struct urb *urb)
501 tty_hangup(tty); 506 tty_hangup(tty);
502 tty_kref_put(tty); 507 tty_kref_put(tty);
503 } else { 508 } else {
504 dbg("%s: type %x req %x", __func__, 509 dev_dbg(&port->dev, "%s: type %x req %x",
505 req_pkt->bRequestType, req_pkt->bRequest); 510 __func__, req_pkt->bRequestType,
511 req_pkt->bRequest);
506 } 512 }
507 } else 513 } else
508 dbg("%s: error %d", __func__, status); 514 dev_dbg(&port->dev, "%s: error %d", __func__, status);
509 515
510 /* Resubmit urb so we continue receiving IRQ data */ 516 /* Resubmit urb so we continue receiving IRQ data */
511 if (status != -ESHUTDOWN) { 517 if (status != -ESHUTDOWN) {
512 urb->dev = serial->dev; 518 urb->dev = serial->dev;
513 err = usb_submit_urb(urb, GFP_ATOMIC); 519 err = usb_submit_urb(urb, GFP_ATOMIC);
514 if (err) 520 if (err)
515 dbg("%s: resubmit intr urb failed. (%d)", 521 dev_dbg(&port->dev, "%s: resubmit intr urb "
516 __func__, err); 522 "failed. (%d)", __func__, err);
517 } 523 }
518} 524}
519 525
@@ -523,14 +529,14 @@ static int sierra_write_room(struct tty_struct *tty)
523 struct sierra_port_private *portdata = usb_get_serial_port_data(port); 529 struct sierra_port_private *portdata = usb_get_serial_port_data(port);
524 unsigned long flags; 530 unsigned long flags;
525 531
526 dbg("%s - port %d", __func__, port->number); 532 dev_dbg(&port->dev, "%s - port %d", __func__, port->number);
527 533
528 /* try to give a good number back based on if we have any free urbs at 534 /* try to give a good number back based on if we have any free urbs at
529 * this point in time */ 535 * this point in time */
530 spin_lock_irqsave(&portdata->lock, flags); 536 spin_lock_irqsave(&portdata->lock, flags);
531 if (portdata->outstanding_urbs > N_OUT_URB * 2 / 3) { 537 if (portdata->outstanding_urbs > N_OUT_URB * 2 / 3) {
532 spin_unlock_irqrestore(&portdata->lock, flags); 538 spin_unlock_irqrestore(&portdata->lock, flags);
533 dbg("%s - write limit hit\n", __func__); 539 dev_dbg(&port->dev, "%s - write limit hit\n", __func__);
534 return 0; 540 return 0;
535 } 541 }
536 spin_unlock_irqrestore(&portdata->lock, flags); 542 spin_unlock_irqrestore(&portdata->lock, flags);
@@ -549,7 +555,7 @@ static int sierra_open(struct tty_struct *tty,
549 555
550 portdata = usb_get_serial_port_data(port); 556 portdata = usb_get_serial_port_data(port);
551 557
552 dbg("%s", __func__); 558 dev_dbg(&port->dev, "%s", __func__);
553 559
554 /* Set some sane defaults */ 560 /* Set some sane defaults */
555 portdata->rts_state = 1; 561 portdata->rts_state = 1;
@@ -561,8 +567,8 @@ static int sierra_open(struct tty_struct *tty,
561 if (!urb) 567 if (!urb)
562 continue; 568 continue;
563 if (urb->dev != serial->dev) { 569 if (urb->dev != serial->dev) {
564 dbg("%s: dev %p != %p", __func__, 570 dev_dbg(&port->dev, "%s: dev %p != %p",
565 urb->dev, serial->dev); 571 __func__, urb->dev, serial->dev);
566 continue; 572 continue;
567 } 573 }
568 574
@@ -601,7 +607,7 @@ static void sierra_close(struct tty_struct *tty,
601 struct usb_serial *serial = port->serial; 607 struct usb_serial *serial = port->serial;
602 struct sierra_port_private *portdata; 608 struct sierra_port_private *portdata;
603 609
604 dbg("%s", __func__); 610 dev_dbg(&port->dev, "%s", __func__);
605 portdata = usb_get_serial_port_data(port); 611 portdata = usb_get_serial_port_data(port);
606 612
607 portdata->rts_state = 0; 613 portdata->rts_state = 0;
@@ -630,7 +636,7 @@ static int sierra_startup(struct usb_serial *serial)
630 int i; 636 int i;
631 int j; 637 int j;
632 638
633 dbg("%s", __func__); 639 dev_dbg(&serial->dev->dev, "%s", __func__);
634 640
635 /* Set Device mode to D0 */ 641 /* Set Device mode to D0 */
636 sierra_set_power_state(serial->dev, 0x0000); 642 sierra_set_power_state(serial->dev, 0x0000);
@@ -644,8 +650,9 @@ static int sierra_startup(struct usb_serial *serial)
644 port = serial->port[i]; 650 port = serial->port[i];
645 portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); 651 portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
646 if (!portdata) { 652 if (!portdata) {
647 dbg("%s: kmalloc for sierra_port_private (%d) failed!.", 653 dev_dbg(&port->dev, "%s: kmalloc for "
648 __func__, i); 654 "sierra_port_private (%d) failed!.",
655 __func__, i);
649 return -ENOMEM; 656 return -ENOMEM;
650 } 657 }
651 spin_lock_init(&portdata->lock); 658 spin_lock_init(&portdata->lock);
@@ -665,8 +672,8 @@ static int sierra_startup(struct usb_serial *serial)
665 for (j = 0; j < N_IN_URB; ++j) { 672 for (j = 0; j < N_IN_URB; ++j) {
666 urb = usb_alloc_urb(0, GFP_KERNEL); 673 urb = usb_alloc_urb(0, GFP_KERNEL);
667 if (urb == NULL) { 674 if (urb == NULL) {
668 dbg("%s: alloc for in port failed.", 675 dev_dbg(&port->dev, "%s: alloc for in "
669 __func__); 676 "port failed.", __func__);
670 continue; 677 continue;
671 } 678 }
672 /* Fill URB using supplied data. */ 679 /* Fill URB using supplied data. */
@@ -688,7 +695,7 @@ static void sierra_shutdown(struct usb_serial *serial)
688 struct usb_serial_port *port; 695 struct usb_serial_port *port;
689 struct sierra_port_private *portdata; 696 struct sierra_port_private *portdata;
690 697
691 dbg("%s", __func__); 698 dev_dbg(&serial->dev->dev, "%s", __func__);
692 699
693 for (i = 0; i < serial->num_ports; ++i) { 700 for (i = 0; i < serial->num_ports; ++i) {
694 port = serial->port[i]; 701 port = serial->port[i];