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 <dbrownell@users.sourceforge.net>
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;
}
#include <linux/time.h>
#include <linux/timer.h>
+#include <asm/unaligned.h>
+
#include "musbdefs.h"
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: