aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-14 19:30:23 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-14 19:30:23 -0400
commit049c6b4e8f85d9ef5f26c8a974e5e9fb084f8ce0 (patch)
treeeb8ed1608f26242f8af733a267b68c3de2e1ab87
parent9c134a14f2da1631d583090a898a8b9d40930472 (diff)
USB: serial: keyspan: remove dbg() usage
dbg() was a very old USB-serial-specific macro. This patch removes it from being used in the keyspan driver and uses dev_dbg() instead. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/serial/keyspan.c290
-rw-r--r--drivers/usb/serial/keyspan.h17
2 files changed, 159 insertions, 148 deletions
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index f0d4f3fcf4f7..0d37581fabb1 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -165,7 +165,7 @@ static void keyspan_set_termios(struct tty_struct *tty,
165 so other rates can be generated if desired. */ 165 so other rates can be generated if desired. */
166 baud_rate = tty_get_baud_rate(tty); 166 baud_rate = tty_get_baud_rate(tty);
167 /* If no match or invalid, don't change */ 167 /* If no match or invalid, don't change */
168 if (d_details->calculate_baud_rate(baud_rate, d_details->baudclk, 168 if (d_details->calculate_baud_rate(port, baud_rate, d_details->baudclk,
169 NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { 169 NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
170 /* FIXME - more to do here to ensure rate changes cleanly */ 170 /* FIXME - more to do here to ensure rate changes cleanly */
171 /* FIXME - calcuate exact rate from divisor ? */ 171 /* FIXME - calcuate exact rate from divisor ? */
@@ -241,8 +241,8 @@ static int keyspan_write(struct tty_struct *tty,
241 dataOffset = 1; 241 dataOffset = 1;
242 } 242 }
243 243
244 dbg("%s - for port %d (%d chars), flip=%d", 244 dev_dbg(&port->dev, "%s - for port %d (%d chars), flip=%d\n",
245 __func__, port->number, count, p_priv->out_flip); 245 __func__, port->number, count, p_priv->out_flip);
246 246
247 for (left = count; left > 0; left -= todo) { 247 for (left = count; left > 0; left -= todo) {
248 todo = left; 248 todo = left;
@@ -255,11 +255,11 @@ static int keyspan_write(struct tty_struct *tty,
255 this_urb = p_priv->out_urbs[flip]; 255 this_urb = p_priv->out_urbs[flip];
256 if (this_urb == NULL) { 256 if (this_urb == NULL) {
257 /* no bulk out, so return 0 bytes written */ 257 /* no bulk out, so return 0 bytes written */
258 dbg("%s - no output urb :(", __func__); 258 dev_dbg(&port->dev, "%s - no output urb :(\n", __func__);
259 return count; 259 return count;
260 } 260 }
261 261
262 dbg("%s - endpoint %d flip %d", 262 dev_dbg(&port->dev, "%s - endpoint %d flip %d\n",
263 __func__, usb_pipeendpoint(this_urb->pipe), flip); 263 __func__, usb_pipeendpoint(this_urb->pipe), flip);
264 264
265 if (this_urb->status == -EINPROGRESS) { 265 if (this_urb->status == -EINPROGRESS) {
@@ -282,7 +282,7 @@ static int keyspan_write(struct tty_struct *tty,
282 282
283 err = usb_submit_urb(this_urb, GFP_ATOMIC); 283 err = usb_submit_urb(this_urb, GFP_ATOMIC);
284 if (err != 0) 284 if (err != 0)
285 dbg("usb_submit_urb(write bulk) failed (%d)", err); 285 dev_dbg(&port->dev, "usb_submit_urb(write bulk) failed (%d)\n", err);
286 p_priv->tx_start_time[flip] = jiffies; 286 p_priv->tx_start_time[flip] = jiffies;
287 287
288 /* Flip for next time if usa26 or usa28 interface 288 /* Flip for next time if usa26 or usa28 interface
@@ -305,8 +305,8 @@ static void usa26_indat_callback(struct urb *urb)
305 endpoint = usb_pipeendpoint(urb->pipe); 305 endpoint = usb_pipeendpoint(urb->pipe);
306 306
307 if (status) { 307 if (status) {
308 dbg("%s - nonzero status: %x on endpoint %d.", 308 dev_dbg(&urb->dev->dev,"%s - nonzero status: %x on endpoint %d.\n",
309 __func__, status, endpoint); 309 __func__, status, endpoint);
310 return; 310 return;
311 } 311 }
312 312
@@ -325,7 +325,7 @@ static void usa26_indat_callback(struct urb *urb)
325 tty_insert_flip_char(tty, data[i], err); 325 tty_insert_flip_char(tty, data[i], err);
326 } else { 326 } else {
327 /* some bytes had errors, every byte has status */ 327 /* some bytes had errors, every byte has status */
328 dbg("%s - RX error!!!!", __func__); 328 dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__);
329 for (i = 0; i + 1 < urb->actual_length; i += 2) { 329 for (i = 0; i + 1 < urb->actual_length; i += 2) {
330 int stat = data[i], flag = 0; 330 int stat = data[i], flag = 0;
331 if (stat & RXERROR_OVERRUN) 331 if (stat & RXERROR_OVERRUN)
@@ -345,7 +345,7 @@ static void usa26_indat_callback(struct urb *urb)
345 /* Resubmit urb so we continue receiving */ 345 /* Resubmit urb so we continue receiving */
346 err = usb_submit_urb(urb, GFP_ATOMIC); 346 err = usb_submit_urb(urb, GFP_ATOMIC);
347 if (err != 0) 347 if (err != 0)
348 dbg("%s - resubmit read urb failed. (%d)", __func__, err); 348 dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
349} 349}
350 350
351/* Outdat handling is common for all devices */ 351/* Outdat handling is common for all devices */
@@ -356,7 +356,7 @@ static void usa2x_outdat_callback(struct urb *urb)
356 356
357 port = urb->context; 357 port = urb->context;
358 p_priv = usb_get_serial_port_data(port); 358 p_priv = usb_get_serial_port_data(port);
359 dbg("%s - urb %d", __func__, urb == p_priv->out_urbs[1]); 359 dev_dbg(&port->dev, "%s - urb %d\n", __func__, urb == p_priv->out_urbs[1]);
360 360
361 usb_serial_port_softint(port); 361 usb_serial_port_softint(port);
362} 362}
@@ -374,7 +374,7 @@ static void usa26_outcont_callback(struct urb *urb)
374 p_priv = usb_get_serial_port_data(port); 374 p_priv = usb_get_serial_port_data(port);
375 375
376 if (p_priv->resend_cont) { 376 if (p_priv->resend_cont) {
377 dbg("%s - sending setup", __func__); 377 dev_dbg(&port->dev, "%s - sending setup\n", __func__);
378 keyspan_usa26_send_setup(port->serial, port, 378 keyspan_usa26_send_setup(port->serial, port,
379 p_priv->resend_cont - 1); 379 p_priv->resend_cont - 1);
380 } 380 }
@@ -394,20 +394,22 @@ static void usa26_instat_callback(struct urb *urb)
394 serial = urb->context; 394 serial = urb->context;
395 395
396 if (status) { 396 if (status) {
397 dbg("%s - nonzero status: %x", __func__, status); 397 dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
398 return; 398 return;
399 } 399 }
400 if (urb->actual_length != 9) { 400 if (urb->actual_length != 9) {
401 dbg("%s - %d byte report??", __func__, urb->actual_length); 401 dev_dbg(&urb->dev->dev, "%s - %d byte report??\n", __func__, urb->actual_length);
402 goto exit; 402 goto exit;
403 } 403 }
404 404
405 msg = (struct keyspan_usa26_portStatusMessage *)data; 405 msg = (struct keyspan_usa26_portStatusMessage *)data;
406 406
407#if 0 407#if 0
408 dbg("%s - port status: port %d cts %d dcd %d dsr %d ri %d toff %d txoff %d rxen %d cr %d", 408 dev_dbg(&urb->dev->dev,
409 __func__, msg->port, msg->hskia_cts, msg->gpia_dcd, msg->dsr, msg->ri, msg->_txOff, 409 "%s - port status: port %d cts %d dcd %d dsr %d ri %d toff %d txoff %d rxen %d cr %d",
410 msg->_txXoff, msg->rxEnabled, msg->controlResponse); 410 __func__, msg->port, msg->hskia_cts, msg->gpia_dcd, msg->dsr,
411 msg->ri, msg->_txOff, msg->_txXoff, msg->rxEnabled,
412 msg->controlResponse);
411#endif 413#endif
412 414
413 /* Now do something useful with the data */ 415 /* Now do something useful with the data */
@@ -415,7 +417,7 @@ static void usa26_instat_callback(struct urb *urb)
415 417
416 /* Check port number from message and retrieve private data */ 418 /* Check port number from message and retrieve private data */
417 if (msg->port >= serial->num_ports) { 419 if (msg->port >= serial->num_ports) {
418 dbg("%s - Unexpected port number %d", __func__, msg->port); 420 dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n", __func__, msg->port);
419 goto exit; 421 goto exit;
420 } 422 }
421 port = serial->port[msg->port]; 423 port = serial->port[msg->port];
@@ -438,7 +440,7 @@ static void usa26_instat_callback(struct urb *urb)
438 /* Resubmit urb so we continue receiving */ 440 /* Resubmit urb so we continue receiving */
439 err = usb_submit_urb(urb, GFP_ATOMIC); 441 err = usb_submit_urb(urb, GFP_ATOMIC);
440 if (err != 0) 442 if (err != 0)
441 dbg("%s - resubmit read urb failed. (%d)", __func__, err); 443 dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
442exit: ; 444exit: ;
443} 445}
444 446
@@ -465,8 +467,8 @@ static void usa28_indat_callback(struct urb *urb)
465 467
466 do { 468 do {
467 if (status) { 469 if (status) {
468 dbg("%s - nonzero status: %x on endpoint %d.", 470 dev_dbg(&urb->dev->dev, "%s - nonzero status: %x on endpoint %d.\n",
469 __func__, status, usb_pipeendpoint(urb->pipe)); 471 __func__, status, usb_pipeendpoint(urb->pipe));
470 return; 472 return;
471 } 473 }
472 474
@@ -484,7 +486,7 @@ static void usa28_indat_callback(struct urb *urb)
484 /* Resubmit urb so we continue receiving */ 486 /* Resubmit urb so we continue receiving */
485 err = usb_submit_urb(urb, GFP_ATOMIC); 487 err = usb_submit_urb(urb, GFP_ATOMIC);
486 if (err != 0) 488 if (err != 0)
487 dbg("%s - resubmit read urb failed. (%d)", 489 dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n",
488 __func__, err); 490 __func__, err);
489 p_priv->in_flip ^= 1; 491 p_priv->in_flip ^= 1;
490 492
@@ -505,7 +507,7 @@ static void usa28_outcont_callback(struct urb *urb)
505 p_priv = usb_get_serial_port_data(port); 507 p_priv = usb_get_serial_port_data(port);
506 508
507 if (p_priv->resend_cont) { 509 if (p_priv->resend_cont) {
508 dbg("%s - sending setup", __func__); 510 dev_dbg(&port->dev, "%s - sending setup\n", __func__);
509 keyspan_usa28_send_setup(port->serial, port, 511 keyspan_usa28_send_setup(port->serial, port,
510 p_priv->resend_cont - 1); 512 p_priv->resend_cont - 1);
511 } 513 }
@@ -526,25 +528,28 @@ static void usa28_instat_callback(struct urb *urb)
526 serial = urb->context; 528 serial = urb->context;
527 529
528 if (status) { 530 if (status) {
529 dbg("%s - nonzero status: %x", __func__, status); 531 dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
530 return; 532 return;
531 } 533 }
532 534
533 if (urb->actual_length != sizeof(struct keyspan_usa28_portStatusMessage)) { 535 if (urb->actual_length != sizeof(struct keyspan_usa28_portStatusMessage)) {
534 dbg("%s - bad length %d", __func__, urb->actual_length); 536 dev_dbg(&urb->dev->dev, "%s - bad length %d\n", __func__, urb->actual_length);
535 goto exit; 537 goto exit;
536 } 538 }
537 539
538 /*dbg("%s %x %x %x %x %x %x %x %x %x %x %x %x", __func__ 540 /*
539 data[0], data[1], data[2], data[3], data[4], data[5], 541 dev_dbg(&urb->dev->dev,
540 data[6], data[7], data[8], data[9], data[10], data[11]);*/ 542 "%s %x %x %x %x %x %x %x %x %x %x %x %x", __func__,
543 data[0], data[1], data[2], data[3], data[4], data[5],
544 data[6], data[7], data[8], data[9], data[10], data[11]);
545 */
541 546
542 /* Now do something useful with the data */ 547 /* Now do something useful with the data */
543 msg = (struct keyspan_usa28_portStatusMessage *)data; 548 msg = (struct keyspan_usa28_portStatusMessage *)data;
544 549
545 /* Check port number from message and retrieve private data */ 550 /* Check port number from message and retrieve private data */
546 if (msg->port >= serial->num_ports) { 551 if (msg->port >= serial->num_ports) {
547 dbg("%s - Unexpected port number %d", __func__, msg->port); 552 dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n", __func__, msg->port);
548 goto exit; 553 goto exit;
549 } 554 }
550 port = serial->port[msg->port]; 555 port = serial->port[msg->port];
@@ -567,7 +572,7 @@ static void usa28_instat_callback(struct urb *urb)
567 /* Resubmit urb so we continue receiving */ 572 /* Resubmit urb so we continue receiving */
568 err = usb_submit_urb(urb, GFP_ATOMIC); 573 err = usb_submit_urb(urb, GFP_ATOMIC);
569 if (err != 0) 574 if (err != 0)
570 dbg("%s - resubmit read urb failed. (%d)", __func__, err); 575 dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
571exit: ; 576exit: ;
572} 577}
573 578
@@ -589,7 +594,7 @@ static void usa49_glocont_callback(struct urb *urb)
589 p_priv = usb_get_serial_port_data(port); 594 p_priv = usb_get_serial_port_data(port);
590 595
591 if (p_priv->resend_cont) { 596 if (p_priv->resend_cont) {
592 dbg("%s - sending setup", __func__); 597 dev_dbg(&port->dev, "%s - sending setup\n", __func__);
593 keyspan_usa49_send_setup(serial, port, 598 keyspan_usa49_send_setup(serial, port,
594 p_priv->resend_cont - 1); 599 p_priv->resend_cont - 1);
595 break; 600 break;
@@ -613,27 +618,29 @@ static void usa49_instat_callback(struct urb *urb)
613 serial = urb->context; 618 serial = urb->context;
614 619
615 if (status) { 620 if (status) {
616 dbg("%s - nonzero status: %x", __func__, status); 621 dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
617 return; 622 return;
618 } 623 }
619 624
620 if (urb->actual_length != 625 if (urb->actual_length !=
621 sizeof(struct keyspan_usa49_portStatusMessage)) { 626 sizeof(struct keyspan_usa49_portStatusMessage)) {
622 dbg("%s - bad length %d", __func__, urb->actual_length); 627 dev_dbg(&urb->dev->dev, "%s - bad length %d\n", __func__, urb->actual_length);
623 goto exit; 628 goto exit;
624 } 629 }
625 630
626 /*dbg(" %x %x %x %x %x %x %x %x %x %x %x", __func__, 631 /*
627 data[0], data[1], data[2], data[3], data[4], data[5], 632 dev_dbg(&urb->dev->dev, "%s: %x %x %x %x %x %x %x %x %x %x %x",
628 data[6], data[7], data[8], data[9], data[10]);*/ 633 __func__, data[0], data[1], data[2], data[3], data[4],
634 data[5], data[6], data[7], data[8], data[9], data[10]);
635 */
629 636
630 /* Now do something useful with the data */ 637 /* Now do something useful with the data */
631 msg = (struct keyspan_usa49_portStatusMessage *)data; 638 msg = (struct keyspan_usa49_portStatusMessage *)data;
632 639
633 /* Check port number from message and retrieve private data */ 640 /* Check port number from message and retrieve private data */
634 if (msg->portNumber >= serial->num_ports) { 641 if (msg->portNumber >= serial->num_ports) {
635 dbg("%s - Unexpected port number %d", 642 dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n",
636 __func__, msg->portNumber); 643 __func__, msg->portNumber);
637 goto exit; 644 goto exit;
638 } 645 }
639 port = serial->port[msg->portNumber]; 646 port = serial->port[msg->portNumber];
@@ -656,7 +663,7 @@ static void usa49_instat_callback(struct urb *urb)
656 /* Resubmit urb so we continue receiving */ 663 /* Resubmit urb so we continue receiving */
657 err = usb_submit_urb(urb, GFP_ATOMIC); 664 err = usb_submit_urb(urb, GFP_ATOMIC);
658 if (err != 0) 665 if (err != 0)
659 dbg("%s - resubmit read urb failed. (%d)", __func__, err); 666 dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
660exit: ; 667exit: ;
661} 668}
662 669
@@ -676,8 +683,8 @@ static void usa49_indat_callback(struct urb *urb)
676 endpoint = usb_pipeendpoint(urb->pipe); 683 endpoint = usb_pipeendpoint(urb->pipe);
677 684
678 if (status) { 685 if (status) {
679 dbg("%s - nonzero status: %x on endpoint %d.", __func__, 686 dev_dbg(&urb->dev->dev, "%s - nonzero status: %x on endpoint %d.\n",
680 status, endpoint); 687 __func__, status, endpoint);
681 return; 688 return;
682 } 689 }
683 690
@@ -710,7 +717,7 @@ static void usa49_indat_callback(struct urb *urb)
710 /* Resubmit urb so we continue receiving */ 717 /* Resubmit urb so we continue receiving */
711 err = usb_submit_urb(urb, GFP_ATOMIC); 718 err = usb_submit_urb(urb, GFP_ATOMIC);
712 if (err != 0) 719 if (err != 0)
713 dbg("%s - resubmit read urb failed. (%d)", __func__, err); 720 dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
714} 721}
715 722
716static void usa49wg_indat_callback(struct urb *urb) 723static void usa49wg_indat_callback(struct urb *urb)
@@ -725,7 +732,7 @@ static void usa49wg_indat_callback(struct urb *urb)
725 serial = urb->context; 732 serial = urb->context;
726 733
727 if (status) { 734 if (status) {
728 dbg("%s - nonzero status: %x", __func__, status); 735 dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
729 return; 736 return;
730 } 737 }
731 738
@@ -738,7 +745,7 @@ static void usa49wg_indat_callback(struct urb *urb)
738 745
739 /* Check port number from message*/ 746 /* Check port number from message*/
740 if (data[i] >= serial->num_ports) { 747 if (data[i] >= serial->num_ports) {
741 dbg("%s - Unexpected port number %d", 748 dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n",
742 __func__, data[i]); 749 __func__, data[i]);
743 return; 750 return;
744 } 751 }
@@ -778,7 +785,7 @@ static void usa49wg_indat_callback(struct urb *urb)
778 /* Resubmit urb so we continue receiving */ 785 /* Resubmit urb so we continue receiving */
779 err = usb_submit_urb(urb, GFP_ATOMIC); 786 err = usb_submit_urb(urb, GFP_ATOMIC);
780 if (err != 0) 787 if (err != 0)
781 dbg("%s - resubmit read urb failed. (%d)", __func__, err); 788 dev_dbg(&urb->dev->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
782} 789}
783 790
784/* not used, usa-49 doesn't have per-port control endpoints */ 791/* not used, usa-49 doesn't have per-port control endpoints */
@@ -799,7 +806,7 @@ static void usa90_indat_callback(struct urb *urb)
799 endpoint = usb_pipeendpoint(urb->pipe); 806 endpoint = usb_pipeendpoint(urb->pipe);
800 807
801 if (status) { 808 if (status) {
802 dbg("%s - nonzero status: %x on endpoint %d.", 809 dev_dbg(&urb->dev->dev, "%s - nonzero status: %x on endpoint %d.\n",
803 __func__, status, endpoint); 810 __func__, status, endpoint);
804 return; 811 return;
805 } 812 }
@@ -828,7 +835,7 @@ static void usa90_indat_callback(struct urb *urb)
828 err); 835 err);
829 } else { 836 } else {
830 /* some bytes had errors, every byte has status */ 837 /* some bytes had errors, every byte has status */
831 dbg("%s - RX error!!!!", __func__); 838 dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__);
832 for (i = 0; i + 1 < urb->actual_length; i += 2) { 839 for (i = 0; i + 1 < urb->actual_length; i += 2) {
833 int stat = data[i], flag = 0; 840 int stat = data[i], flag = 0;
834 if (stat & RXERROR_OVERRUN) 841 if (stat & RXERROR_OVERRUN)
@@ -850,7 +857,7 @@ static void usa90_indat_callback(struct urb *urb)
850 /* Resubmit urb so we continue receiving */ 857 /* Resubmit urb so we continue receiving */
851 err = usb_submit_urb(urb, GFP_ATOMIC); 858 err = usb_submit_urb(urb, GFP_ATOMIC);
852 if (err != 0) 859 if (err != 0)
853 dbg("%s - resubmit read urb failed. (%d)", __func__, err); 860 dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
854} 861}
855 862
856 863
@@ -868,11 +875,11 @@ static void usa90_instat_callback(struct urb *urb)
868 serial = urb->context; 875 serial = urb->context;
869 876
870 if (status) { 877 if (status) {
871 dbg("%s - nonzero status: %x", __func__, status); 878 dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
872 return; 879 return;
873 } 880 }
874 if (urb->actual_length < 14) { 881 if (urb->actual_length < 14) {
875 dbg("%s - %d byte report??", __func__, urb->actual_length); 882 dev_dbg(&urb->dev->dev, "%s - %d byte report??\n", __func__, urb->actual_length);
876 goto exit; 883 goto exit;
877 } 884 }
878 885
@@ -900,7 +907,7 @@ static void usa90_instat_callback(struct urb *urb)
900 /* Resubmit urb so we continue receiving */ 907 /* Resubmit urb so we continue receiving */
901 err = usb_submit_urb(urb, GFP_ATOMIC); 908 err = usb_submit_urb(urb, GFP_ATOMIC);
902 if (err != 0) 909 if (err != 0)
903 dbg("%s - resubmit read urb failed. (%d)", __func__, err); 910 dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
904exit: 911exit:
905 ; 912 ;
906} 913}
@@ -914,7 +921,7 @@ static void usa90_outcont_callback(struct urb *urb)
914 p_priv = usb_get_serial_port_data(port); 921 p_priv = usb_get_serial_port_data(port);
915 922
916 if (p_priv->resend_cont) { 923 if (p_priv->resend_cont) {
917 dbg("%s - sending setup", __func__); 924 dev_dbg(&urb->dev->dev, "%s - sending setup\n", __func__);
918 keyspan_usa90_send_setup(port->serial, port, 925 keyspan_usa90_send_setup(port->serial, port,
919 p_priv->resend_cont - 1); 926 p_priv->resend_cont - 1);
920 } 927 }
@@ -935,13 +942,13 @@ static void usa67_instat_callback(struct urb *urb)
935 serial = urb->context; 942 serial = urb->context;
936 943
937 if (status) { 944 if (status) {
938 dbg("%s - nonzero status: %x", __func__, status); 945 dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
939 return; 946 return;
940 } 947 }
941 948
942 if (urb->actual_length != 949 if (urb->actual_length !=
943 sizeof(struct keyspan_usa67_portStatusMessage)) { 950 sizeof(struct keyspan_usa67_portStatusMessage)) {
944 dbg("%s - bad length %d", __func__, urb->actual_length); 951 dev_dbg(&urb->dev->dev, "%s - bad length %d\n", __func__, urb->actual_length);
945 return; 952 return;
946 } 953 }
947 954
@@ -951,7 +958,7 @@ static void usa67_instat_callback(struct urb *urb)
951 958
952 /* Check port number from message and retrieve private data */ 959 /* Check port number from message and retrieve private data */
953 if (msg->port >= serial->num_ports) { 960 if (msg->port >= serial->num_ports) {
954 dbg("%s - Unexpected port number %d", __func__, msg->port); 961 dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n", __func__, msg->port);
955 return; 962 return;
956 } 963 }
957 964
@@ -973,7 +980,7 @@ static void usa67_instat_callback(struct urb *urb)
973 /* Resubmit urb so we continue receiving */ 980 /* Resubmit urb so we continue receiving */
974 err = usb_submit_urb(urb, GFP_ATOMIC); 981 err = usb_submit_urb(urb, GFP_ATOMIC);
975 if (err != 0) 982 if (err != 0)
976 dbg("%s - resubmit read urb failed. (%d)", __func__, err); 983 dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
977} 984}
978 985
979static void usa67_glocont_callback(struct urb *urb) 986static void usa67_glocont_callback(struct urb *urb)
@@ -989,7 +996,7 @@ static void usa67_glocont_callback(struct urb *urb)
989 p_priv = usb_get_serial_port_data(port); 996 p_priv = usb_get_serial_port_data(port);
990 997
991 if (p_priv->resend_cont) { 998 if (p_priv->resend_cont) {
992 dbg("%s - sending setup", __func__); 999 dev_dbg(&port->dev, "%s - sending setup\n", __func__);
993 keyspan_usa67_send_setup(serial, port, 1000 keyspan_usa67_send_setup(serial, port,
994 p_priv->resend_cont - 1); 1001 p_priv->resend_cont - 1);
995 break; 1002 break;
@@ -1068,8 +1075,7 @@ static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port)
1068 usb_clear_halt(urb->dev, urb->pipe); 1075 usb_clear_halt(urb->dev, urb->pipe);
1069 err = usb_submit_urb(urb, GFP_KERNEL); 1076 err = usb_submit_urb(urb, GFP_KERNEL);
1070 if (err != 0) 1077 if (err != 0)
1071 dbg("%s - submit urb %d failed (%d)", 1078 dev_dbg(&port->dev, "%s - submit urb %d failed (%d)\n", __func__, i, err);
1072 __func__, i, err);
1073 } 1079 }
1074 1080
1075 /* Reset low level data toggle on out endpoints */ 1081 /* Reset low level data toggle on out endpoints */
@@ -1092,7 +1098,7 @@ static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port)
1092 baud_rate = tty_get_baud_rate(tty); 1098 baud_rate = tty_get_baud_rate(tty);
1093 /* If no match or invalid, leave as default */ 1099 /* If no match or invalid, leave as default */
1094 if (baud_rate >= 0 1100 if (baud_rate >= 0
1095 && d_details->calculate_baud_rate(baud_rate, d_details->baudclk, 1101 && d_details->calculate_baud_rate(port, baud_rate, d_details->baudclk,
1096 NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { 1102 NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
1097 p_priv->baud = baud_rate; 1103 p_priv->baud = baud_rate;
1098 } 1104 }
@@ -1142,7 +1148,7 @@ static void keyspan_close(struct usb_serial_port *port)
1142 } 1148 }
1143 1149
1144 /*while (p_priv->outcont_urb->status == -EINPROGRESS) { 1150 /*while (p_priv->outcont_urb->status == -EINPROGRESS) {
1145 dbg("%s - urb in progress", __func__); 1151 dev_dbg(&port->dev, "%s - urb in progress\n", __func__);
1146 }*/ 1152 }*/
1147 1153
1148 p_priv->out_flip = 0; 1154 p_priv->out_flip = 0;
@@ -1167,13 +1173,13 @@ static int keyspan_fake_startup(struct usb_serial *serial)
1167 char *fw_name; 1173 char *fw_name;
1168 const struct firmware *fw; 1174 const struct firmware *fw;
1169 1175
1170 dbg("Keyspan startup version %04x product %04x", 1176 dev_dbg(&serial->dev->dev, "Keyspan startup version %04x product %04x\n",
1171 le16_to_cpu(serial->dev->descriptor.bcdDevice), 1177 le16_to_cpu(serial->dev->descriptor.bcdDevice),
1172 le16_to_cpu(serial->dev->descriptor.idProduct)); 1178 le16_to_cpu(serial->dev->descriptor.idProduct));
1173 1179
1174 if ((le16_to_cpu(serial->dev->descriptor.bcdDevice) & 0x8000) 1180 if ((le16_to_cpu(serial->dev->descriptor.bcdDevice) & 0x8000)
1175 != 0x8000) { 1181 != 0x8000) {
1176 dbg("Firmware already loaded. Quitting."); 1182 dev_dbg(&serial->dev->dev, "Firmware already loaded. Quitting.\n");
1177 return 1; 1183 return 1;
1178 } 1184 }
1179 1185
@@ -1238,7 +1244,7 @@ static int keyspan_fake_startup(struct usb_serial *serial)
1238 return 1; 1244 return 1;
1239 } 1245 }
1240 1246
1241 dbg("Uploading Keyspan %s firmware.", fw_name); 1247 dev_dbg(&serial->dev->dev, "Uploading Keyspan %s firmware.\n", fw_name);
1242 1248
1243 /* download the firmware image */ 1249 /* download the firmware image */
1244 response = ezusb_set_reset(serial->dev, 1); 1250 response = ezusb_set_reset(serial->dev, 1);
@@ -1296,10 +1302,10 @@ static struct urb *keyspan_setup_urb(struct usb_serial *serial, int endpoint,
1296 if (endpoint == -1) 1302 if (endpoint == -1)
1297 return NULL; /* endpoint not needed */ 1303 return NULL; /* endpoint not needed */
1298 1304
1299 dbg("%s - alloc for endpoint %d.", __func__, endpoint); 1305 dev_dbg(&serial->interface->dev, "%s - alloc for endpoint %d.\n", __func__, endpoint);
1300 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ 1306 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
1301 if (urb == NULL) { 1307 if (urb == NULL) {
1302 dbg("%s - alloc for endpoint %d failed.", __func__, endpoint); 1308 dev_dbg(&serial->interface->dev, "%s - alloc for endpoint %d failed.\n", __func__, endpoint);
1303 return NULL; 1309 return NULL;
1304 } 1310 }
1305 1311
@@ -1332,7 +1338,7 @@ static struct urb *keyspan_setup_urb(struct usb_serial *serial, int endpoint,
1332 return NULL; 1338 return NULL;
1333 } 1339 }
1334 1340
1335 dbg("%s - using urb %p for %s endpoint %x", 1341 dev_dbg(&serial->interface->dev, "%s - using urb %p for %s endpoint %x\n",
1336 __func__, urb, ep_type_name, endpoint); 1342 __func__, urb, ep_type_name, endpoint);
1337 return urb; 1343 return urb;
1338} 1344}
@@ -1464,14 +1470,15 @@ static void keyspan_setup_urbs(struct usb_serial *serial)
1464} 1470}
1465 1471
1466/* usa19 function doesn't require prescaler */ 1472/* usa19 function doesn't require prescaler */
1467static int keyspan_usa19_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, 1473static int keyspan_usa19_calc_baud(struct usb_serial_port *port,
1474 u32 baud_rate, u32 baudclk, u8 *rate_hi,
1468 u8 *rate_low, u8 *prescaler, int portnum) 1475 u8 *rate_low, u8 *prescaler, int portnum)
1469{ 1476{
1470 u32 b16, /* baud rate times 16 (actual rate used internally) */ 1477 u32 b16, /* baud rate times 16 (actual rate used internally) */
1471 div, /* divisor */ 1478 div, /* divisor */
1472 cnt; /* inverse of divisor (programmed into 8051) */ 1479 cnt; /* inverse of divisor (programmed into 8051) */
1473 1480
1474 dbg("%s - %d.", __func__, baud_rate); 1481 dev_dbg(&port->dev, "%s - %d.\n", __func__, baud_rate);
1475 1482
1476 /* prevent divide by zero... */ 1483 /* prevent divide by zero... */
1477 b16 = baud_rate * 16L; 1484 b16 = baud_rate * 16L;
@@ -1498,19 +1505,20 @@ static int keyspan_usa19_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
1498 if (rate_hi) 1505 if (rate_hi)
1499 *rate_hi = (u8) ((cnt >> 8) & 0xff); 1506 *rate_hi = (u8) ((cnt >> 8) & 0xff);
1500 if (rate_low && rate_hi) 1507 if (rate_low && rate_hi)
1501 dbg("%s - %d %02x %02x.", 1508 dev_dbg(&port->dev, "%s - %d %02x %02x.\n",
1502 __func__, baud_rate, *rate_hi, *rate_low); 1509 __func__, baud_rate, *rate_hi, *rate_low);
1503 return KEYSPAN_BAUD_RATE_OK; 1510 return KEYSPAN_BAUD_RATE_OK;
1504} 1511}
1505 1512
1506/* usa19hs function doesn't require prescaler */ 1513/* usa19hs function doesn't require prescaler */
1507static int keyspan_usa19hs_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, 1514static int keyspan_usa19hs_calc_baud(struct usb_serial_port *port,
1508 u8 *rate_low, u8 *prescaler, int portnum) 1515 u32 baud_rate, u32 baudclk, u8 *rate_hi,
1516 u8 *rate_low, u8 *prescaler, int portnum)
1509{ 1517{
1510 u32 b16, /* baud rate times 16 (actual rate used internally) */ 1518 u32 b16, /* baud rate times 16 (actual rate used internally) */
1511 div; /* divisor */ 1519 div; /* divisor */
1512 1520
1513 dbg("%s - %d.", __func__, baud_rate); 1521 dev_dbg(&port->dev, "%s - %d.\n", __func__, baud_rate);
1514 1522
1515 /* prevent divide by zero... */ 1523 /* prevent divide by zero... */
1516 b16 = baud_rate * 16L; 1524 b16 = baud_rate * 16L;
@@ -1533,13 +1541,14 @@ static int keyspan_usa19hs_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
1533 *rate_hi = (u8) ((div >> 8) & 0xff); 1541 *rate_hi = (u8) ((div >> 8) & 0xff);
1534 1542
1535 if (rate_low && rate_hi) 1543 if (rate_low && rate_hi)
1536 dbg("%s - %d %02x %02x.", 1544 dev_dbg(&port->dev, "%s - %d %02x %02x.\n",
1537 __func__, baud_rate, *rate_hi, *rate_low); 1545 __func__, baud_rate, *rate_hi, *rate_low);
1538 1546
1539 return KEYSPAN_BAUD_RATE_OK; 1547 return KEYSPAN_BAUD_RATE_OK;
1540} 1548}
1541 1549
1542static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, 1550static int keyspan_usa19w_calc_baud(struct usb_serial_port *port,
1551 u32 baud_rate, u32 baudclk, u8 *rate_hi,
1543 u8 *rate_low, u8 *prescaler, int portnum) 1552 u8 *rate_low, u8 *prescaler, int portnum)
1544{ 1553{
1545 u32 b16, /* baud rate times 16 (actual rate used internally) */ 1554 u32 b16, /* baud rate times 16 (actual rate used internally) */
@@ -1551,7 +1560,7 @@ static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
1551 u8 best_prescaler; 1560 u8 best_prescaler;
1552 int i; 1561 int i;
1553 1562
1554 dbg("%s - %d.", __func__, baud_rate); 1563 dev_dbg(&port->dev, "%s - %d.\n", __func__, baud_rate);
1555 1564
1556 /* prevent divide by zero */ 1565 /* prevent divide by zero */
1557 b16 = baud_rate * 16L; 1566 b16 = baud_rate * 16L;
@@ -1596,20 +1605,21 @@ static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
1596 *rate_hi = (u8) ((div >> 8) & 0xff); 1605 *rate_hi = (u8) ((div >> 8) & 0xff);
1597 if (prescaler) { 1606 if (prescaler) {
1598 *prescaler = best_prescaler; 1607 *prescaler = best_prescaler;
1599 /* dbg("%s - %d %d", __func__, *prescaler, div); */ 1608 /* dev_dbg(&port->dev, "%s - %d %d\n", __func__, *prescaler, div); */
1600 } 1609 }
1601 return KEYSPAN_BAUD_RATE_OK; 1610 return KEYSPAN_BAUD_RATE_OK;
1602} 1611}
1603 1612
1604 /* USA-28 supports different maximum baud rates on each port */ 1613 /* USA-28 supports different maximum baud rates on each port */
1605static int keyspan_usa28_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, 1614static int keyspan_usa28_calc_baud(struct usb_serial_port *port,
1606 u8 *rate_low, u8 *prescaler, int portnum) 1615 u32 baud_rate, u32 baudclk, u8 *rate_hi,
1616 u8 *rate_low, u8 *prescaler, int portnum)
1607{ 1617{
1608 u32 b16, /* baud rate times 16 (actual rate used internally) */ 1618 u32 b16, /* baud rate times 16 (actual rate used internally) */
1609 div, /* divisor */ 1619 div, /* divisor */
1610 cnt; /* inverse of divisor (programmed into 8051) */ 1620 cnt; /* inverse of divisor (programmed into 8051) */
1611 1621
1612 dbg("%s - %d.", __func__, baud_rate); 1622 dev_dbg(&port->dev, "%s - %d.\n", __func__, baud_rate);
1613 1623
1614 /* prevent divide by zero */ 1624 /* prevent divide by zero */
1615 b16 = baud_rate * 16L; 1625 b16 = baud_rate * 16L;
@@ -1642,7 +1652,7 @@ static int keyspan_usa28_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
1642 *rate_low = (u8) (cnt & 0xff); 1652 *rate_low = (u8) (cnt & 0xff);
1643 if (rate_hi) 1653 if (rate_hi)
1644 *rate_hi = (u8) ((cnt >> 8) & 0xff); 1654 *rate_hi = (u8) ((cnt >> 8) & 0xff);
1645 dbg("%s - %d OK.", __func__, baud_rate); 1655 dev_dbg(&port->dev, "%s - %d OK.\n", __func__, baud_rate);
1646 return KEYSPAN_BAUD_RATE_OK; 1656 return KEYSPAN_BAUD_RATE_OK;
1647} 1657}
1648 1658
@@ -1658,7 +1668,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1658 struct urb *this_urb; 1668 struct urb *this_urb;
1659 int device_port, err; 1669 int device_port, err;
1660 1670
1661 dbg("%s reset=%d", __func__, reset_port); 1671 dev_dbg(&port->dev, "%s reset=%d\n", __func__, reset_port);
1662 1672
1663 s_priv = usb_get_serial_data(serial); 1673 s_priv = usb_get_serial_data(serial);
1664 p_priv = usb_get_serial_port_data(port); 1674 p_priv = usb_get_serial_port_data(port);
@@ -1668,11 +1678,11 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1668 outcont_urb = d_details->outcont_endpoints[port->number]; 1678 outcont_urb = d_details->outcont_endpoints[port->number];
1669 this_urb = p_priv->outcont_urb; 1679 this_urb = p_priv->outcont_urb;
1670 1680
1671 dbg("%s - endpoint %d", __func__, usb_pipeendpoint(this_urb->pipe)); 1681 dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe));
1672 1682
1673 /* Make sure we have an urb then send the message */ 1683 /* Make sure we have an urb then send the message */
1674 if (this_urb == NULL) { 1684 if (this_urb == NULL) {
1675 dbg("%s - oops no urb.", __func__); 1685 dev_dbg(&port->dev, "%s - oops no urb.\n", __func__);
1676 return -1; 1686 return -1;
1677 } 1687 }
1678 1688
@@ -1681,7 +1691,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1681 if ((reset_port + 1) > p_priv->resend_cont) 1691 if ((reset_port + 1) > p_priv->resend_cont)
1682 p_priv->resend_cont = reset_port + 1; 1692 p_priv->resend_cont = reset_port + 1;
1683 if (this_urb->status == -EINPROGRESS) { 1693 if (this_urb->status == -EINPROGRESS) {
1684 /* dbg("%s - already writing", __func__); */ 1694 /* dev_dbg(&port->dev, "%s - already writing\n", __func__); */
1685 mdelay(5); 1695 mdelay(5);
1686 return -1; 1696 return -1;
1687 } 1697 }
@@ -1692,11 +1702,11 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1692 if (p_priv->old_baud != p_priv->baud) { 1702 if (p_priv->old_baud != p_priv->baud) {
1693 p_priv->old_baud = p_priv->baud; 1703 p_priv->old_baud = p_priv->baud;
1694 msg.setClocking = 0xff; 1704 msg.setClocking = 0xff;
1695 if (d_details->calculate_baud_rate 1705 if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
1696 (p_priv->baud, d_details->baudclk, &msg.baudHi, 1706 &msg.baudHi, &msg.baudLo, &msg.prescaler,
1697 &msg.baudLo, &msg.prescaler, device_port) == KEYSPAN_INVALID_BAUD_RATE) { 1707 device_port) == KEYSPAN_INVALID_BAUD_RATE) {
1698 dbg("%s - Invalid baud rate %d requested, using 9600.", 1708 dev_dbg(&port->dev, "%s - Invalid baud rate %d requested, using 9600.\n",
1699 __func__, p_priv->baud); 1709 __func__, p_priv->baud);
1700 msg.baudLo = 0; 1710 msg.baudLo = 0;
1701 msg.baudHi = 125; /* Values for 9600 baud */ 1711 msg.baudHi = 125; /* Values for 9600 baud */
1702 msg.prescaler = 10; 1712 msg.prescaler = 10;
@@ -1790,12 +1800,12 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
1790 1800
1791 err = usb_submit_urb(this_urb, GFP_ATOMIC); 1801 err = usb_submit_urb(this_urb, GFP_ATOMIC);
1792 if (err != 0) 1802 if (err != 0)
1793 dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); 1803 dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
1794#if 0 1804#if 0
1795 else { 1805 else {
1796 dbg("%s - usb_submit_urb(%d) OK %d bytes (end %d)", __func__ 1806 dev_dbg(&port->dev, "%s - usb_submit_urb(%d) OK %d bytes (end %d)\n", __func__
1797 outcont_urb, this_urb->transfer_buffer_length, 1807 outcont_urb, this_urb->transfer_buffer_length,
1798 usb_pipeendpoint(this_urb->pipe)); 1808 usb_pipeendpoint(this_urb->pipe));
1799 } 1809 }
1800#endif 1810#endif
1801 1811
@@ -1821,7 +1831,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
1821 /* only do something if we have a bulk out endpoint */ 1831 /* only do something if we have a bulk out endpoint */
1822 this_urb = p_priv->outcont_urb; 1832 this_urb = p_priv->outcont_urb;
1823 if (this_urb == NULL) { 1833 if (this_urb == NULL) {
1824 dbg("%s - oops no urb.", __func__); 1834 dev_dbg(&port->dev, "%s - oops no urb.\n", __func__);
1825 return -1; 1835 return -1;
1826 } 1836 }
1827 1837
@@ -1830,7 +1840,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
1830 if ((reset_port + 1) > p_priv->resend_cont) 1840 if ((reset_port + 1) > p_priv->resend_cont)
1831 p_priv->resend_cont = reset_port + 1; 1841 p_priv->resend_cont = reset_port + 1;
1832 if (this_urb->status == -EINPROGRESS) { 1842 if (this_urb->status == -EINPROGRESS) {
1833 dbg("%s already writing", __func__); 1843 dev_dbg(&port->dev, "%s already writing\n", __func__);
1834 mdelay(5); 1844 mdelay(5);
1835 return -1; 1845 return -1;
1836 } 1846 }
@@ -1838,9 +1848,10 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
1838 memset(&msg, 0, sizeof(struct keyspan_usa28_portControlMessage)); 1848 memset(&msg, 0, sizeof(struct keyspan_usa28_portControlMessage));
1839 1849
1840 msg.setBaudRate = 1; 1850 msg.setBaudRate = 1;
1841 if (d_details->calculate_baud_rate(p_priv->baud, d_details->baudclk, 1851 if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
1842 &msg.baudHi, &msg.baudLo, NULL, device_port) == KEYSPAN_INVALID_BAUD_RATE) { 1852 &msg.baudHi, &msg.baudLo, NULL,
1843 dbg("%s - Invalid baud rate requested %d.", 1853 device_port) == KEYSPAN_INVALID_BAUD_RATE) {
1854 dev_dbg(&port->dev, "%s - Invalid baud rate requested %d.\n",
1844 __func__, p_priv->baud); 1855 __func__, p_priv->baud);
1845 msg.baudLo = 0xff; 1856 msg.baudLo = 0xff;
1846 msg.baudHi = 0xb2; /* Values for 9600 baud */ 1857 msg.baudHi = 0xb2; /* Values for 9600 baud */
@@ -1915,10 +1926,10 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
1915 1926
1916 err = usb_submit_urb(this_urb, GFP_ATOMIC); 1927 err = usb_submit_urb(this_urb, GFP_ATOMIC);
1917 if (err != 0) 1928 if (err != 0)
1918 dbg("%s - usb_submit_urb(setup) failed", __func__); 1929 dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed\n", __func__);
1919#if 0 1930#if 0
1920 else { 1931 else {
1921 dbg("%s - usb_submit_urb(setup) OK %d bytes", __func__, 1932 dev_dbg(&port->dev, "%s - usb_submit_urb(setup) OK %d bytes\n", __func__,
1922 this_urb->transfer_buffer_length); 1933 this_urb->transfer_buffer_length);
1923 } 1934 }
1924#endif 1935#endif
@@ -1949,13 +1960,13 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
1949 1960
1950 /* Make sure we have an urb then send the message */ 1961 /* Make sure we have an urb then send the message */
1951 if (this_urb == NULL) { 1962 if (this_urb == NULL) {
1952 dbg("%s - oops no urb for port %d.", __func__, port->number); 1963 dev_dbg(&port->dev, "%s - oops no urb for port %d.\n", __func__, port->number);
1953 return -1; 1964 return -1;
1954 } 1965 }
1955 1966
1956 dbg("%s - endpoint %d port %d (%d)", 1967 dev_dbg(&port->dev, "%s - endpoint %d port %d (%d)\n",
1957 __func__, usb_pipeendpoint(this_urb->pipe), 1968 __func__, usb_pipeendpoint(this_urb->pipe),
1958 port->number, device_port); 1969 port->number, device_port);
1959 1970
1960 /* Save reset port val for resend. 1971 /* Save reset port val for resend.
1961 Don't overwrite resend for open/close condition. */ 1972 Don't overwrite resend for open/close condition. */
@@ -1963,7 +1974,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
1963 p_priv->resend_cont = reset_port + 1; 1974 p_priv->resend_cont = reset_port + 1;
1964 1975
1965 if (this_urb->status == -EINPROGRESS) { 1976 if (this_urb->status == -EINPROGRESS) {
1966 /* dbg("%s - already writing", __func__); */ 1977 /* dev_dbg(&port->dev, "%s - already writing\n", __func__); */
1967 mdelay(5); 1978 mdelay(5);
1968 return -1; 1979 return -1;
1969 } 1980 }
@@ -1977,11 +1988,11 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
1977 if (p_priv->old_baud != p_priv->baud) { 1988 if (p_priv->old_baud != p_priv->baud) {
1978 p_priv->old_baud = p_priv->baud; 1989 p_priv->old_baud = p_priv->baud;
1979 msg.setClocking = 0xff; 1990 msg.setClocking = 0xff;
1980 if (d_details->calculate_baud_rate 1991 if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
1981 (p_priv->baud, d_details->baudclk, &msg.baudHi, 1992 &msg.baudHi, &msg.baudLo, &msg.prescaler,
1982 &msg.baudLo, &msg.prescaler, device_port) == KEYSPAN_INVALID_BAUD_RATE) { 1993 device_port) == KEYSPAN_INVALID_BAUD_RATE) {
1983 dbg("%s - Invalid baud rate %d requested, using 9600.", 1994 dev_dbg(&port->dev, "%s - Invalid baud rate %d requested, using 9600.\n",
1984 __func__, p_priv->baud); 1995 __func__, p_priv->baud);
1985 msg.baudLo = 0; 1996 msg.baudLo = 0;
1986 msg.baudHi = 125; /* Values for 9600 baud */ 1997 msg.baudHi = 125; /* Values for 9600 baud */
1987 msg.prescaler = 10; 1998 msg.prescaler = 10;
@@ -2100,12 +2111,12 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
2100 } 2111 }
2101 err = usb_submit_urb(this_urb, GFP_ATOMIC); 2112 err = usb_submit_urb(this_urb, GFP_ATOMIC);
2102 if (err != 0) 2113 if (err != 0)
2103 dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); 2114 dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
2104#if 0 2115#if 0
2105 else { 2116 else {
2106 dbg("%s - usb_submit_urb(%d) OK %d bytes (end %d)", __func__, 2117 dev_dbg(&port->dev, "%s - usb_submit_urb(%d) OK %d bytes (end %d)\n", __func__,
2107 outcont_urb, this_urb->transfer_buffer_length, 2118 outcont_urb, this_urb->transfer_buffer_length,
2108 usb_pipeendpoint(this_urb->pipe)); 2119 usb_pipeendpoint(this_urb->pipe));
2109 } 2120 }
2110#endif 2121#endif
2111 2122
@@ -2131,7 +2142,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
2131 /* only do something if we have a bulk out endpoint */ 2142 /* only do something if we have a bulk out endpoint */
2132 this_urb = p_priv->outcont_urb; 2143 this_urb = p_priv->outcont_urb;
2133 if (this_urb == NULL) { 2144 if (this_urb == NULL) {
2134 dbg("%s - oops no urb.", __func__); 2145 dev_dbg(&port->dev, "%s - oops no urb.\n", __func__);
2135 return -1; 2146 return -1;
2136 } 2147 }
2137 2148
@@ -2140,7 +2151,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
2140 if ((reset_port + 1) > p_priv->resend_cont) 2151 if ((reset_port + 1) > p_priv->resend_cont)
2141 p_priv->resend_cont = reset_port + 1; 2152 p_priv->resend_cont = reset_port + 1;
2142 if (this_urb->status == -EINPROGRESS) { 2153 if (this_urb->status == -EINPROGRESS) {
2143 dbg("%s already writing", __func__); 2154 dev_dbg(&port->dev, "%s already writing\n", __func__);
2144 mdelay(5); 2155 mdelay(5);
2145 return -1; 2156 return -1;
2146 } 2157 }
@@ -2151,13 +2162,12 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
2151 if (p_priv->old_baud != p_priv->baud) { 2162 if (p_priv->old_baud != p_priv->baud) {
2152 p_priv->old_baud = p_priv->baud; 2163 p_priv->old_baud = p_priv->baud;
2153 msg.setClocking = 0x01; 2164 msg.setClocking = 0x01;
2154 if (d_details->calculate_baud_rate 2165 if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
2155 (p_priv->baud, d_details->baudclk, &msg.baudHi, 2166 &msg.baudHi, &msg.baudLo, &prescaler, 0) == KEYSPAN_INVALID_BAUD_RATE) {
2156 &msg.baudLo, &prescaler, 0) == KEYSPAN_INVALID_BAUD_RATE) { 2167 dev_dbg(&port->dev, "%s - Invalid baud rate %d requested, using 9600.\n",
2157 dbg("%s - Invalid baud rate %d requested, using 9600.", 2168 __func__, p_priv->baud);
2158 __func__, p_priv->baud);
2159 p_priv->baud = 9600; 2169 p_priv->baud = 9600;
2160 d_details->calculate_baud_rate(p_priv->baud, d_details->baudclk, 2170 d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
2161 &msg.baudHi, &msg.baudLo, &prescaler, 0); 2171 &msg.baudHi, &msg.baudLo, &prescaler, 0);
2162 } 2172 }
2163 msg.setRxMode = 1; 2173 msg.setRxMode = 1;
@@ -2239,7 +2249,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
2239 2249
2240 err = usb_submit_urb(this_urb, GFP_ATOMIC); 2250 err = usb_submit_urb(this_urb, GFP_ATOMIC);
2241 if (err != 0) 2251 if (err != 0)
2242 dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); 2252 dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
2243 return 0; 2253 return 0;
2244} 2254}
2245 2255
@@ -2265,7 +2275,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial,
2265 2275
2266 /* Make sure we have an urb then send the message */ 2276 /* Make sure we have an urb then send the message */
2267 if (this_urb == NULL) { 2277 if (this_urb == NULL) {
2268 dbg("%s - oops no urb for port %d.", __func__, 2278 dev_dbg(&port->dev, "%s - oops no urb for port %d.\n", __func__,
2269 port->number); 2279 port->number);
2270 return -1; 2280 return -1;
2271 } 2281 }
@@ -2275,7 +2285,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial,
2275 if ((reset_port + 1) > p_priv->resend_cont) 2285 if ((reset_port + 1) > p_priv->resend_cont)
2276 p_priv->resend_cont = reset_port + 1; 2286 p_priv->resend_cont = reset_port + 1;
2277 if (this_urb->status == -EINPROGRESS) { 2287 if (this_urb->status == -EINPROGRESS) {
2278 /* dbg("%s - already writing", __func__); */ 2288 /* dev_dbg(&port->dev, "%s - already writing\n", __func__); */
2279 mdelay(5); 2289 mdelay(5);
2280 return -1; 2290 return -1;
2281 } 2291 }
@@ -2288,11 +2298,11 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial,
2288 if (p_priv->old_baud != p_priv->baud) { 2298 if (p_priv->old_baud != p_priv->baud) {
2289 p_priv->old_baud = p_priv->baud; 2299 p_priv->old_baud = p_priv->baud;
2290 msg.setClocking = 0xff; 2300 msg.setClocking = 0xff;
2291 if (d_details->calculate_baud_rate 2301 if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
2292 (p_priv->baud, d_details->baudclk, &msg.baudHi, 2302 &msg.baudHi, &msg.baudLo, &msg.prescaler,
2293 &msg.baudLo, &msg.prescaler, device_port) == KEYSPAN_INVALID_BAUD_RATE) { 2303 device_port) == KEYSPAN_INVALID_BAUD_RATE) {
2294 dbg("%s - Invalid baud rate %d requested, using 9600.", 2304 dev_dbg(&port->dev, "%s - Invalid baud rate %d requested, using 9600.\n",
2295 __func__, p_priv->baud); 2305 __func__, p_priv->baud);
2296 msg.baudLo = 0; 2306 msg.baudLo = 0;
2297 msg.baudHi = 125; /* Values for 9600 baud */ 2307 msg.baudHi = 125; /* Values for 9600 baud */
2298 msg.prescaler = 10; 2308 msg.prescaler = 10;
@@ -2383,8 +2393,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial,
2383 2393
2384 err = usb_submit_urb(this_urb, GFP_ATOMIC); 2394 err = usb_submit_urb(this_urb, GFP_ATOMIC);
2385 if (err != 0) 2395 if (err != 0)
2386 dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, 2396 dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
2387 err);
2388 return 0; 2397 return 0;
2389} 2398}
2390 2399
@@ -2440,8 +2449,7 @@ static int keyspan_startup(struct usb_serial *serial)
2440 /* Setup private data for serial driver */ 2449 /* Setup private data for serial driver */
2441 s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL); 2450 s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL);
2442 if (!s_priv) { 2451 if (!s_priv) {
2443 dbg("%s - kmalloc for keyspan_serial_private failed.", 2452 dev_dbg(&serial->dev->dev, "%s - kmalloc for keyspan_serial_private failed.\n", __func__);
2444 __func__);
2445 return -ENOMEM; 2453 return -ENOMEM;
2446 } 2454 }
2447 2455
@@ -2454,7 +2462,7 @@ static int keyspan_startup(struct usb_serial *serial)
2454 p_priv = kzalloc(sizeof(struct keyspan_port_private), 2462 p_priv = kzalloc(sizeof(struct keyspan_port_private),
2455 GFP_KERNEL); 2463 GFP_KERNEL);
2456 if (!p_priv) { 2464 if (!p_priv) {
2457 dbg("%s - kmalloc for keyspan_port_private (%d) failed!.", __func__, i); 2465 dev_dbg(&port->dev, "%s - kmalloc for keyspan_port_private (%d) failed!.\n", __func__, i);
2458 return 1; 2466 return 1;
2459 } 2467 }
2460 p_priv->device_details = d_details; 2468 p_priv->device_details = d_details;
@@ -2466,13 +2474,13 @@ static int keyspan_startup(struct usb_serial *serial)
2466 if (s_priv->instat_urb != NULL) { 2474 if (s_priv->instat_urb != NULL) {
2467 err = usb_submit_urb(s_priv->instat_urb, GFP_KERNEL); 2475 err = usb_submit_urb(s_priv->instat_urb, GFP_KERNEL);
2468 if (err != 0) 2476 if (err != 0)
2469 dbg("%s - submit instat urb failed %d", __func__, 2477 dev_dbg(&port->dev, "%s - submit instat urb failed %d\n", __func__,
2470 err); 2478 err);
2471 } 2479 }
2472 if (s_priv->indat_urb != NULL) { 2480 if (s_priv->indat_urb != NULL) {
2473 err = usb_submit_urb(s_priv->indat_urb, GFP_KERNEL); 2481 err = usb_submit_urb(s_priv->indat_urb, GFP_KERNEL);
2474 if (err != 0) 2482 if (err != 0)
2475 dbg("%s - submit indat urb failed %d", __func__, 2483 dev_dbg(&port->dev, "%s - submit indat urb failed %d\n", __func__,
2476 err); 2484 err);
2477 } 2485 }
2478 2486
@@ -2527,10 +2535,8 @@ static void keyspan_release(struct usb_serial *serial)
2527 2535
2528 s_priv = usb_get_serial_data(serial); 2536 s_priv = usb_get_serial_data(serial);
2529 2537
2530 /* dbg("Freeing serial->private."); */
2531 kfree(s_priv); 2538 kfree(s_priv);
2532 2539
2533 /* dbg("Freeing port->private."); */
2534 /* Now free per port private data */ 2540 /* Now free per port private data */
2535 for (i = 0; i < serial->num_ports; i++) { 2541 for (i = 0; i < serial->num_ports; i++) {
2536 port = serial->port[i]; 2542 port = serial->port[i];
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
index fe1c5d91692c..0a8a40b5711e 100644
--- a/drivers/usb/serial/keyspan.h
+++ b/drivers/usb/serial/keyspan.h
@@ -64,19 +64,23 @@ static int keyspan_tiocmset (struct tty_struct *tty,
64 unsigned int clear); 64 unsigned int clear);
65static int keyspan_fake_startup (struct usb_serial *serial); 65static int keyspan_fake_startup (struct usb_serial *serial);
66 66
67static int keyspan_usa19_calc_baud (u32 baud_rate, u32 baudclk, 67static int keyspan_usa19_calc_baud (struct usb_serial_port *port,
68 u32 baud_rate, u32 baudclk,
68 u8 *rate_hi, u8 *rate_low, 69 u8 *rate_hi, u8 *rate_low,
69 u8 *prescaler, int portnum); 70 u8 *prescaler, int portnum);
70 71
71static int keyspan_usa19w_calc_baud (u32 baud_rate, u32 baudclk, 72static int keyspan_usa19w_calc_baud (struct usb_serial_port *port,
73 u32 baud_rate, u32 baudclk,
72 u8 *rate_hi, u8 *rate_low, 74 u8 *rate_hi, u8 *rate_low,
73 u8 *prescaler, int portnum); 75 u8 *prescaler, int portnum);
74 76
75static int keyspan_usa28_calc_baud (u32 baud_rate, u32 baudclk, 77static int keyspan_usa28_calc_baud (struct usb_serial_port *port,
78 u32 baud_rate, u32 baudclk,
76 u8 *rate_hi, u8 *rate_low, 79 u8 *rate_hi, u8 *rate_low,
77 u8 *prescaler, int portnum); 80 u8 *prescaler, int portnum);
78 81
79static int keyspan_usa19hs_calc_baud (u32 baud_rate, u32 baudclk, 82static int keyspan_usa19hs_calc_baud (struct usb_serial_port *port,
83 u32 baud_rate, u32 baudclk,
80 u8 *rate_hi, u8 *rate_low, 84 u8 *rate_hi, u8 *rate_low,
81 u8 *prescaler, int portnum); 85 u8 *prescaler, int portnum);
82 86
@@ -188,8 +192,9 @@ struct keyspan_device_details {
188 /* Endpoint used for global control functions */ 192 /* Endpoint used for global control functions */
189 int glocont_endpoint; 193 int glocont_endpoint;
190 194
191 int (*calculate_baud_rate) (u32 baud_rate, u32 baudclk, 195 int (*calculate_baud_rate) (struct usb_serial_port *port,
192 u8 *rate_hi, u8 *rate_low, u8 *prescaler, int portnum); 196 u32 baud_rate, u32 baudclk,
197 u8 *rate_hi, u8 *rate_low, u8 *prescaler, int portnum);
193 u32 baudclk; 198 u32 baudclk;
194}; 199};
195 200