]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
The PIPE_INTERRUPT flag is used wrong
authorRemy Bohmer <linux@bohmer.net>
Fri, 10 Oct 2008 08:23:22 +0000 (10:23 +0200)
committerMarkus Klotzbuecher <mk@denx.de>
Tue, 14 Oct 2008 14:43:06 +0000 (16:43 +0200)
At a lot of places in the code the PIPE_INTERRUPT flags and friends
are used wrong. The wrong bits are compared to this flag resulting
in wrong conditions. Also there are macros that should be used for
PIPE_* flags.
This patch tries to fix them all, however, I was not able to test the
changes, because I do not have any of these boards.

Review required!

Signed-off-by: Remy Bohmer <linux@bohmer.net>
Signed-off-by: Markus Klotzbuecher <mk@denx.de>
board/MAI/AmigaOneG3SE/usb_uhci.c
board/mpl/common/usb_uhci.c
cpu/arm920t/s3c24x0/usb_ohci.c
cpu/leon3/usb_uhci.c
cpu/mips/au1x00_usb_ohci.c
cpu/mpc5xxx/usb_ohci.c
cpu/ppc4xx/usb_ohci.c
drivers/usb/isp116x-hcd.c
drivers/usb/r8a66597-hcd.c

index 26cdcdf7604c9f5600ec4fc9a2e86ce6406d3f56..1464f6058563c58659c65a3f2b4516a7e6edd813 100644 (file)
@@ -801,7 +801,7 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
        unsigned short wIndex;
        unsigned short wLength;
 
-       if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+       if (usb_pipeint(pipe)) {
                printf("Root-Hub submit IRQ: NOT implemented\n");
 #if 0
                uhci->rh.urb = urb;
index 666b999e372e9934cd3d03f10f1739ce98b0f06f..03d142b05b77b80f457296272d6b379720031597 100644 (file)
@@ -792,7 +792,7 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
        unsigned short wIndex;
        unsigned short wLength;
 
-       if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+       if (usb_pipeint(pipe)) {
                printf("Root-Hub submit IRQ: NOT implemented\n");
 #if 0
                uhci->rh.urb = urb;
index b57c2d8950b2c90c328a9926be635165cecabd19..641f2704900df6fd3aad4d4a7f4fe4c9f5170ab8 100644 (file)
@@ -654,7 +654,7 @@ static void td_fill (ohci_t *ohci, unsigned int info,
        td->index = index;
        td->data = (__u32)data;
 #ifdef OHCI_FILL_TRACE
-       if ((usb_pipetype(urb_priv->pipe) == PIPE_BULK) && usb_pipeout(urb_priv->pipe)) {
+       if (usb_pipebulk(urb_priv->pipe) && usb_pipeout(urb_priv->pipe)) {
                for (i = 0; i < len; i++)
                printf("td->data[%d] %#2x ",i, ((unsigned char *)td->data)[i]);
                printf("\n");
@@ -756,7 +756,7 @@ static void dl_transfer_length(td_t * td)
        tdCBP  = m32_swap (td->hwCBP);
 
 
-       if (!(usb_pipetype (lurb_priv->pipe) == PIPE_CONTROL &&
+       if (!(usb_pipecontrol(lurb_priv->pipe) &&
            ((td->index == 0) || (td->index == lurb_priv->length - 1)))) {
                if (tdBE != 0) {
                        if (td->hwCBP == 0)
@@ -1025,7 +1025,7 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
 #else
        wait_ms(1);
 #endif
-       if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+       if (usb_pipeint(pipe)) {
                info("Root-Hub submit IRQ: NOT implemented");
                return 0;
        }
@@ -1259,7 +1259,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 
        /* allow more time for a BULK device to react - some are slow */
 #define BULK_TO         5000   /* timeout in milliseconds */
-       if (usb_pipetype (pipe) == PIPE_BULK)
+       if (usb_pipebulk(pipe))
                timeout = BULK_TO;
        else
                timeout = 100;
index 7910bebe142acf92eb4bf24874c5dd8b50c33592..8f99e1db194e61eaeeeadd43689de1f6e3490caa 100644 (file)
@@ -901,7 +901,7 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
        unsigned short wIndex;
        unsigned short wLength;
 
-       if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+       if (usb_pipeint(pipe)) {
                printf("Root-Hub submit IRQ: NOT implemented\n");
                return 0;
        }
index 1ca8aafbbc9ccd3b01cf629e9a8290ed99e01ba2..17489da8d48e210ad90f77622a9a7e916aef4f7f 100644 (file)
@@ -654,7 +654,8 @@ static void td_fill (ohci_t *ohci, unsigned int info,
        td->index = index;
        td->data = (__u32)data;
 #ifdef OHCI_FILL_TRACE
-       if (1 || ((usb_pipetype(urb_priv->pipe) == PIPE_BULK) && usb_pipeout(urb_priv->pipe))) {
+       if (1 || (usb_pipebulk(urb_priv->pipe) &&
+                               usb_pipeout(urb_priv->pipe))) {
                for (i = 0; i < len; i++)
                printf("td->data[%d] %#2x\n",i, ((unsigned char *)(td->data+0x80000000))[i]);
        }
@@ -758,7 +759,7 @@ static void dl_transfer_length(td_t * td)
        tdCBP  = m32_swap (td->hwCBP);
 
 
-       if (!(usb_pipetype (lurb_priv->pipe) == PIPE_CONTROL &&
+       if (!(usb_pipecontrol(lurb_priv->pipe) &&
            ((td->index == 0) || (td->index == lurb_priv->length - 1)))) {
                if (tdBE != 0) {
                        if (td->hwCBP == 0)
@@ -1015,7 +1016,7 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
 #else
        wait_ms(1);
 #endif
-       if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+       if (usb_pipeint(pipe)) {
                info("Root-Hub submit IRQ: NOT implemented");
                return 0;
        }
@@ -1249,7 +1250,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 
        /* allow more time for a BULK device to react - some are slow */
 #define BULK_TO         5000   /* timeout in milliseconds */
-       if (usb_pipetype (pipe) == PIPE_BULK)
+       if (usb_pipebulk(pipe))
                timeout = BULK_TO;
        else
                timeout = 100;
index 2ad12b2a25931d616e076635de199594669f4da8..4bf659df8dac7630f315b999731d22ff7ff5d128 100644 (file)
@@ -660,7 +660,7 @@ static void td_fill (ohci_t *ohci, unsigned int info,
        td->index = index;
        td->data = (__u32)data;
 #ifdef OHCI_FILL_TRACE
-       if ((usb_pipetype(urb_priv->pipe) == PIPE_BULK) && usb_pipeout(urb_priv->pipe)) {
+       if (usb_pipebulk(urb_priv->pipe) && usb_pipeout(urb_priv->pipe)) {
                for (i = 0; i < len; i++)
                printf("td->data[%d] %#2x ",i, ((unsigned char *)td->data)[i]);
                printf("\n");
@@ -761,7 +761,7 @@ static void dl_transfer_length(td_t * td)
        tdCBP  = ohci_cpu_to_le32 (td->hwCBP);
 
 
-       if (!(usb_pipetype (lurb_priv->pipe) == PIPE_CONTROL &&
+       if (!(usb_pipecontrol(lurb_priv->pipe) &&
            ((td->index == 0) || (td->index == lurb_priv->length - 1)))) {
                if (tdBE != 0) {
                        if (td->hwCBP == 0)
@@ -1023,7 +1023,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
 urb_priv.actual_length = 0;
 pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
 #endif
-       if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+       if (usb_pipeint(pipe)) {
                info("Root-Hub submit IRQ: NOT implemented");
                return 0;
        }
@@ -1248,7 +1248,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 
        /* allow more time for a BULK device to react - some are slow */
 #define BULK_TO         5000   /* timeout in milliseconds */
-       if (usb_pipetype (pipe) == PIPE_BULK)
+       if (usb_pipebulk(pipe))
                timeout = BULK_TO;
        else
                timeout = 100;
index 5dbd84227453c455fe48179a67ae7ca7e9d16877..bfa79abceca6d58f1a374288cf49a17d6f482708 100644 (file)
@@ -660,7 +660,7 @@ static void td_fill (ohci_t *ohci, unsigned int info,
        td->index = index;
        td->data = (__u32)data;
 #ifdef OHCI_FILL_TRACE
-       if ((usb_pipetype(urb_priv->pipe) == PIPE_BULK) && usb_pipeout(urb_priv->pipe)) {
+       if (usb_pipebulk(urb_priv->pipe) && usb_pipeout(urb_priv->pipe)) {
                for (i = 0; i < len; i++)
                printf("td->data[%d] %#2x ",i, ((unsigned char *)td->data)[i]);
                printf("\n");
@@ -761,7 +761,7 @@ static void dl_transfer_length(td_t * td)
        tdCBP  = ohci_cpu_to_le32 (td->hwCBP);
 
 
-       if (!(usb_pipetype (lurb_priv->pipe) == PIPE_CONTROL &&
+       if (!(usb_pipecontrol(lurb_priv->pipe) &&
            ((td->index == 0) || (td->index == lurb_priv->length - 1)))) {
                if (tdBE != 0) {
                        if (td->hwCBP == 0)
@@ -1023,7 +1023,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
 urb_priv.actual_length = 0;
 pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
 #endif
-       if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+       if (usb_pipeint(pipe)) {
                info("Root-Hub submit IRQ: NOT implemented");
                return 0;
        }
@@ -1248,7 +1248,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 
        /* allow more time for a BULK device to react - some are slow */
 #define BULK_TO         5000   /* timeout in milliseconds */
-       if (usb_pipetype (pipe) == PIPE_BULK)
+       if (usb_pipebulk(pipe))
                timeout = BULK_TO;
        else
                timeout = 100;
index 6b9b23bc6ed9c3889bc21a961693d42ed7e11562..cc46dfe9f3a9860e51f11bb4849c330e45664a51 100644 (file)
@@ -687,7 +687,7 @@ retry_same:
        /* Start the data transfer */
 
        /* Allow more time for a BULK device to react - some are slow */
-       if (usb_pipetype(pipe) == PIPE_BULK)
+       if (usb_pipebulk(pipe))
                timeout = 5000;
        else
                timeout = 100;
@@ -822,7 +822,7 @@ static int isp116x_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
        u16 wIndex;
        u16 wLength;
 
-       if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+       if (usb_pipeint(pipe)) {
                INFO("Root-Hub submit IRQ: NOT implemented");
                return 0;
        }
index a2e1fffcc0e68a7b05bd9191cafed71892192f4a..288f41a8b83adbf8bac9c8129516931ace8c1b88 100644 (file)
@@ -654,7 +654,7 @@ static int r8a66597_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
 
        R8A66597_DPRINT("%s\n", __func__);
 
-       if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+       if (usb_pipeint(pipe)) {
                printf("Root-Hub submit IRQ: NOT implemented");
                return 0;
        }