diff mbox

[U-Boot,14/16] usb: ohci: Skip unnecessary mdelay(1) calls in various places

Message ID 1430862979-4684-15-git-send-email-hdegoede@redhat.com
State Changes Requested
Delegated to: Simon Glass
Headers show

Commit Message

Hans de Goede May 5, 2015, 9:56 p.m. UTC
For some reason the ohci code is full with:

		pkt_print(...)
		mdelay(1);

AFAICT there is no reason for the mdelay(1) calls. This commit disables them
when building the ohci code for new driver-model using boards. It leaves
the mdelay(1) calls in place when building for older boards, so as to avoid
causing any regressions there.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Comments

Marek Vasut May 5, 2015, 11:01 p.m. UTC | #1
On Tuesday, May 05, 2015 at 11:56:17 PM, Hans de Goede wrote:
> For some reason the ohci code is full with:
> 
> 		pkt_print(...)
> 		mdelay(1);
> 
> AFAICT there is no reason for the mdelay(1) calls. This commit disables
> them when building the ohci code for new driver-model using boards. It
> leaves the mdelay(1) calls in place when building for older boards, so as
> to avoid causing any regressions there.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

You might as well define a ohcidelay(1) function to avoid poluting the
code with ifdefs .

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index dc0892f..d06d9dc 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1256,7 +1256,7 @@  static int ohci_submit_rh_msg(ohci_t *ohci, struct usb_device *dev,
 #ifdef DEBUG
 pkt_print(ohci, NULL, dev, pipe, buffer, transfer_len,
 	  cmd, "SUB(rh)", usb_pipein(pipe));
-#else
+#elif !defined CONFIG_DM_USB
 	mdelay(1);
 #endif
 	if (usb_pipeint(pipe)) {
@@ -1441,7 +1441,7 @@  pkt_print(ohci, NULL, dev, pipe, buffer, transfer_len,
 
 #ifdef	DEBUG
 	ohci_dump_roothub(ohci, 1);
-#else
+#elif !defined CONFIG_DM_USB
 	mdelay(1);
 #endif
 
@@ -1454,7 +1454,7 @@  pkt_print(ohci, NULL, dev, pipe, buffer, transfer_len,
 #ifdef DEBUG
 	pkt_print(ohci, NULL, dev, pipe, buffer,
 		  transfer_len, cmd, "RET(rh)", 0/*usb_pipein(pipe)*/);
-#else
+#elif !defined CONFIG_DM_USB
 	mdelay(1);
 #endif
 
@@ -1487,7 +1487,7 @@  static int submit_common_msg(ohci_t *ohci, struct usb_device *dev,
 	urb->actual_length = 0;
 	pkt_print(ohci, urb, dev, pipe, buffer, transfer_len,
 		  setup, "SUB", usb_pipein(pipe));
-#else
+#elif !defined CONFIG_DM_USB
 	mdelay(1);
 #endif
 	if (!maxsize) {
@@ -1555,7 +1555,7 @@  static int submit_common_msg(ohci_t *ohci, struct usb_device *dev,
 #ifdef DEBUG
 	pkt_print(ohci, urb, dev, pipe, buffer, transfer_len,
 		  setup, "RET(ctlr)", usb_pipein(pipe));
-#else
+#elif !defined CONFIG_DM_USB
 	mdelay(1);
 #endif
 	urb_free_priv(urb);
@@ -1589,7 +1589,7 @@  static int _ohci_submit_control_msg(ohci_t *ohci, struct usb_device *dev,
 #ifdef DEBUG
 	pkt_print(ohci, NULL, dev, pipe, buffer, transfer_len,
 		  setup, "SUB", usb_pipein(pipe));
-#else
+#elif !defined CONFIG_DM_USB
 	mdelay(1);
 #endif
 	if (!maxsize) {
@@ -1786,7 +1786,7 @@  static int hc_interrupt(ohci_t *ohci)
 
 #ifdef	DEBUG
 		ohci_dump(ohci, 1);
-#else
+#elif !defined CONFIG_DM_USB
 		mdelay(1);
 #endif
 		/* FIXME: be optimistic, hope that bug won't repeat often. */
@@ -1798,7 +1798,9 @@  static int hc_interrupt(ohci_t *ohci)
 	}
 
 	if (ints & OHCI_INTR_WDH) {
+#if !defined CONFIG_DM_USB
 		mdelay(1);
+#endif
 		ohci_writel(OHCI_INTR_WDH, &regs->intrdisable);
 		(void)ohci_readl(&regs->intrdisable); /* flush */
 		stat = dl_done_list(ohci);