usb: renesas_usbhs: modify fifo clear timing
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 21 Apr 2011 05:09:58 +0000 (14:09 +0900)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sat, 30 Apr 2011 00:24:31 +0000 (17:24 -0700)
Pipe buffer should be cleaned before using it,
but should NOT be cleaned in pipe "prepare" function.
Because the pipe might be working in such timing.
This patch fixup this issue.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/renesas_usbhs/pipe.c

index b7a9137f599baf7618e46aa49fef1fc4d1fe3de2..4852c073e2f53db5895a55256373f31985e24f91 100644 (file)
@@ -369,15 +369,7 @@ static int usbhsp_fifo_select(struct usbhs_pipe *pipe, int write)
 
 int usbhs_fifo_prepare_write(struct usbhs_pipe *pipe)
 {
-       int ret;
-
-       ret = usbhsp_fifo_select(pipe, 1);
-       if (ret < 0)
-               return ret;
-
-       usbhsp_fifo_clear(pipe);
-
-       return ret;
+       return usbhsp_fifo_select(pipe, 1);
 }
 
 int usbhs_fifo_write(struct usbhs_pipe *pipe, u8 *buf, int len)
@@ -392,7 +384,7 @@ int usbhs_fifo_write(struct usbhs_pipe *pipe, u8 *buf, int len)
        if (ret < 0)
                return ret;
 
-       ret = usbhs_fifo_prepare_write(pipe);
+       ret = usbhsp_fifo_select(pipe, 1);
        if (ret < 0)
                return ret;
 
@@ -750,6 +742,8 @@ void usbhs_pipe_init(struct usbhs_priv *priv)
 
                usbhsp_flags_init(pipe);
                pipe->mod_private = NULL;
+
+               usbhsp_fifo_clear(pipe);
        }
 }