]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
musb_hdrc: Minor root hub cleanups
authorDavid Brownell <dbrownell@users.sourceforge.net>
Fri, 23 Mar 2007 13:57:34 +0000 (09:57 -0400)
committerTony Lindgren <tony@atomide.com>
Fri, 23 Mar 2007 13:57:34 +0000 (09:57 -0400)
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>
drivers/usb/musb/musb_host.c
drivers/usb/musb/virthub.c

index 0e3b691607cbd5e204f10eca7ff58222288edde4..d5b53d937cfe9680e6fde33ced3b7bcda1a91923 100644 (file)
@@ -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;
 }
 
index 41ae741430c652215415991a1ba192e7dca1cc18..6a65f4fd1c07f23fd91f4e059b55e32199fdf93d 100644 (file)
@@ -41,6 +41,8 @@
 #include <linux/time.h>
 #include <linux/timer.h>
 
+#include <asm/unaligned.h>
+
 #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: