Someone left us a big fat warning in USB device code

        /* Don't ever put [serial] debugging in non-error codepaths here, it
         * will violate the tight timing constraints of this USB Device
         * controller (and lead to bus enumeration failures) */

these "non-error codepaths" go all over the shop, this patch nukes some
serial printf()s that can do what we must never do.

Signed-off-by: Andy Green <[EMAIL PROTECTED]>
---

 board/neo1973/gta02/gta02.c    |    4 ++--
 drivers/serial/usbtty.c        |   16 ++++++++++++++--
 drivers/usb/usbdcore.c         |    6 ++++++
 drivers/usb/usbdcore_s3c2410.c |    4 ++--
 4 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/board/neo1973/gta02/gta02.c b/board/neo1973/gta02/gta02.c
index c4766b0..84eb8c5 100644
--- a/board/neo1973/gta02/gta02.c
+++ b/board/neo1973/gta02/gta02.c
@@ -398,8 +398,8 @@ static void wait_for_power(void)
                poll_charger();
 
                /* track what the time-critical udc callback allows us */
-               if (pcf50633_usb_last_maxcurrent != udc_usb_maxcurrent)
-                       pcf50633_usb_maxcurrent(udc_usb_maxcurrent);
+//             if (pcf50633_usb_last_maxcurrent != udc_usb_maxcurrent)
+//                     pcf50633_usb_maxcurrent(udc_usb_maxcurrent);
 
                /* we have plenty of external power -> try to boot */
                if (pcf50633_usb_last_maxcurrent >= 500)
diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
index b6c0403..7ef7eb5 100644
--- a/drivers/serial/usbtty.c
+++ b/drivers/serial/usbtty.c
@@ -1162,7 +1162,13 @@ static void usbtty_event_handler (struct 
usb_device_instance *device,
                usbtty_configured_flag = 0;
                break;
        case DEVICE_CONFIGURED:
-               printf("DEVICE_CONFIGURED: %u\n", device->configuration);
+#if 0
+       /* we can't afford sitting here and printing stuff.  This code runs
+        * in a time-critical context and printing stuff is a synchronous
+        * serial activity... bad things can happen to USB peripheral
+        */
+       printf("DEVICE_CONFIGURED: %u\n", device->configuration);
+#endif
                if (device->configuration == 1)
                        udc_ctrl(UDC_CTRL_500mA_ENABLE, 1);
                else
@@ -1170,7 +1176,13 @@ static void usbtty_event_handler (struct 
usb_device_instance *device,
                usbtty_configured_flag = 1;
                break;
        case DEVICE_DE_CONFIGURED:
-               printf("DEVICE_DE_CONFIGURED\n");
+#if 0
+       /* we can't afford sitting here and printing stuff.  This code runs
+        * in a time-critical context and printing stuff is a synchronous
+        * serial activity... bad things can happen to USB peripheral
+        */
+               printf("DEVICE_DECONFIGURED: %u\n", device->configuration);
+#endif
                udc_ctrl(UDC_CTRL_500mA_ENABLE, 0);
                break;
        case DEVICE_ADDRESS_ASSIGNED:
diff --git a/drivers/usb/usbdcore.c b/drivers/usb/usbdcore.c
index a2e6711..28b1a9a 100644
--- a/drivers/usb/usbdcore.c
+++ b/drivers/usb/usbdcore.c
@@ -616,7 +616,13 @@ void usbd_device_event_irq (struct usb_device_instance 
*device, usb_device_event
 
        state = device->device_state;
 
+#if 0
+       /* we can't afford sitting here and printing stuff.  This code can run
+        * in a time-critical context and printing stuff is a synchronous
+        * serial activity... bad things can happen to USB peripheral
+        */
        usbinfo("%s", usbd_device_events[event]);
+#endif
 
        switch (event) {
        case DEVICE_UNKNOWN:
diff --git a/drivers/usb/usbdcore_s3c2410.c b/drivers/usb/usbdcore_s3c2410.c
index a18e7e1..13cd3d6 100644
--- a/drivers/usb/usbdcore_s3c2410.c
+++ b/drivers/usb/usbdcore_s3c2410.c
@@ -191,7 +191,7 @@ static void s3c2410_udc_ep0(void)
 
        /* clear stall status */
        if (ep0csr & S3C2410_UDC_EP0_CSR_SENTSTL) {
-               serial_printf("Clearing SENT_STALL\n");
+               /* serial_printf("Clearing SENT_STALL\n"); */
                clear_ep0_sst();
                if (ep0csr & S3C2410_UDC_EP0_CSR_SOPKTRDY)
                        clear_ep0_opr();
@@ -202,7 +202,7 @@ static void s3c2410_udc_ep0(void)
        /* clear setup end */
        if (ep0csr & S3C2410_UDC_EP0_CSR_SE
            /* && ep0->state != EP0_IDLE */) {
-               serial_printf("Clearing SETUP_END\n");
+               /* serial_printf("Clearing SETUP_END\n"); */
                clear_ep0_se();
 #if 1
                if (ep0csr & S3C2410_UDC_EP0_CSR_SOPKTRDY) {


Reply via email to