aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/early/ehci-dbgp.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/usb/early/ehci-dbgp.c b/drivers/usb/early/ehci-dbgp.c
index 821b7b21c29c..8de709ac0f55 100644
--- a/drivers/usb/early/ehci-dbgp.c
+++ b/drivers/usb/early/ehci-dbgp.c
@@ -700,17 +700,27 @@ int __init early_dbgp_init(char *s)
700static void early_dbgp_write(struct console *con, const char *str, u32 n) 700static void early_dbgp_write(struct console *con, const char *str, u32 n)
701{ 701{
702 int chunk, ret; 702 int chunk, ret;
703 char buf[DBGP_MAX_PACKET];
704 int use_cr = 0;
703 705
704 if (!ehci_debug) 706 if (!ehci_debug)
705 return; 707 return;
706 while (n > 0) { 708 while (n > 0) {
707 chunk = n; 709 for (chunk = 0; chunk < DBGP_MAX_PACKET && n > 0;
708 if (chunk > DBGP_MAX_PACKET) 710 str++, chunk++, n--) {
709 chunk = DBGP_MAX_PACKET; 711 if (!use_cr && *str == '\n') {
712 use_cr = 1;
713 buf[chunk] = '\r';
714 str--;
715 n++;
716 continue;
717 }
718 if (use_cr)
719 use_cr = 0;
720 buf[chunk] = *str;
721 }
710 ret = dbgp_bulk_write(USB_DEBUG_DEVNUM, 722 ret = dbgp_bulk_write(USB_DEBUG_DEVNUM,
711 dbgp_endpoint_out, str, chunk); 723 dbgp_endpoint_out, buf, chunk);
712 str += chunk;
713 n -= chunk;
714 } 724 }
715} 725}
716 726