From: David Brownell Date: Fri, 23 Mar 2007 13:57:34 +0000 (-0400) Subject: musb_hdrc: Minor root hub cleanups X-Git-Tag: v2.6.21-omap1~72 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=0855214a004e70e994c285b7435d01c31cec1b3b;p=linux-2.6-omap-h63xx.git musb_hdrc: Minor root hub cleanups Minor root hub cleanups: - Use unaligned accessors to return status, in case usbcore passes a buffer that's not aligned. - Fix some glitching on restart (e.g. when switching gadget drivers while leaving the OTG-mode musb_hdrc driver loaded). Signed-off-by: David Brownell --- diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 0e3b691607c..d5b53d937cf 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c @@ -2121,10 +2121,13 @@ static int musb_h_get_frame_number(struct usb_hcd *hcd) static int musb_h_start(struct usb_hcd *hcd) { + struct musb *musb = hcd_to_musb(hcd); + /* NOTE: musb_start() is called when the hub driver turns * on port power, or when (OTG) peripheral starts. */ hcd->state = HC_STATE_RUNNING; + musb->port1_status = 0; return 0; } diff --git a/drivers/usb/musb/virthub.c b/drivers/usb/musb/virthub.c index 41ae741430c..6a65f4fd1c0 100644 --- a/drivers/usb/musb/virthub.c +++ b/drivers/usb/musb/virthub.c @@ -41,6 +41,8 @@ #include #include +#include + #include "musbdefs.h" @@ -300,11 +302,11 @@ int musb_hub_control( musb->xceiv.state = OTG_STATE_A_HOST; } - *(__le32 *) buf = cpu_to_le32(musb->port1_status - & ~MUSB_PORT_STAT_RESUME); + put_unaligned(cpu_to_le32(musb->port1_status & ~MUSB_PORT_STAT_RESUME), + (__le32 *) buf); /* port change status is more interesting */ - DBG((*(u16*)(buf+2)) ? 2 : 5, "port status %08x\n", + DBG(get_unaligned((u16*)(buf+2)) ? 2 : 5, "port status %08x\n", musb->port1_status); break; case SetPortFeature: