瀏覽代碼

The PIPE_INTERRUPT flag is used wrong

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>
Remy Bohmer 16 年之前
父節點
當前提交
9dbc366744

+ 1 - 1
board/MAI/AmigaOneG3SE/usb_uhci.c

@@ -801,7 +801,7 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 	unsigned short wIndex;
 	unsigned short wIndex;
 	unsigned short wLength;
 	unsigned short wLength;
 
 
-	if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+	if (usb_pipeint(pipe)) {
 		printf("Root-Hub submit IRQ: NOT implemented\n");
 		printf("Root-Hub submit IRQ: NOT implemented\n");
 #if 0
 #if 0
 		uhci->rh.urb = urb;
 		uhci->rh.urb = urb;

+ 1 - 1
board/mpl/common/usb_uhci.c

@@ -792,7 +792,7 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 	unsigned short wIndex;
 	unsigned short wIndex;
 	unsigned short wLength;
 	unsigned short wLength;
 
 
-	if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+	if (usb_pipeint(pipe)) {
 		printf("Root-Hub submit IRQ: NOT implemented\n");
 		printf("Root-Hub submit IRQ: NOT implemented\n");
 #if 0
 #if 0
 		uhci->rh.urb = urb;
 		uhci->rh.urb = urb;

+ 4 - 4
cpu/arm920t/s3c24x0/usb_ohci.c

@@ -654,7 +654,7 @@ static void td_fill (ohci_t *ohci, unsigned int info,
 	td->index = index;
 	td->index = index;
 	td->data = (__u32)data;
 	td->data = (__u32)data;
 #ifdef OHCI_FILL_TRACE
 #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++)
 		for (i = 0; i < len; i++)
 		printf("td->data[%d] %#2x ",i, ((unsigned char *)td->data)[i]);
 		printf("td->data[%d] %#2x ",i, ((unsigned char *)td->data)[i]);
 		printf("\n");
 		printf("\n");
@@ -756,7 +756,7 @@ static void dl_transfer_length(td_t * td)
 	tdCBP  = m32_swap (td->hwCBP);
 	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)))) {
 	    ((td->index == 0) || (td->index == lurb_priv->length - 1)))) {
 		if (tdBE != 0) {
 		if (tdBE != 0) {
 			if (td->hwCBP == 0)
 			if (td->hwCBP == 0)
@@ -1025,7 +1025,7 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
 #else
 #else
 	wait_ms(1);
 	wait_ms(1);
 #endif
 #endif
-	if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+	if (usb_pipeint(pipe)) {
 		info("Root-Hub submit IRQ: NOT implemented");
 		info("Root-Hub submit IRQ: NOT implemented");
 		return 0;
 		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 */
 	/* allow more time for a BULK device to react - some are slow */
 #define BULK_TO	 5000	/* timeout in milliseconds */
 #define BULK_TO	 5000	/* timeout in milliseconds */
-	if (usb_pipetype (pipe) == PIPE_BULK)
+	if (usb_pipebulk(pipe))
 		timeout = BULK_TO;
 		timeout = BULK_TO;
 	else
 	else
 		timeout = 100;
 		timeout = 100;

+ 1 - 1
cpu/leon3/usb_uhci.c

@@ -901,7 +901,7 @@ int uhci_submit_rh_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 	unsigned short wIndex;
 	unsigned short wIndex;
 	unsigned short wLength;
 	unsigned short wLength;
 
 
-	if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+	if (usb_pipeint(pipe)) {
 		printf("Root-Hub submit IRQ: NOT implemented\n");
 		printf("Root-Hub submit IRQ: NOT implemented\n");
 		return 0;
 		return 0;
 	}
 	}

+ 5 - 4
cpu/mips/au1x00_usb_ohci.c

@@ -654,7 +654,8 @@ static void td_fill (ohci_t *ohci, unsigned int info,
 	td->index = index;
 	td->index = index;
 	td->data = (__u32)data;
 	td->data = (__u32)data;
 #ifdef OHCI_FILL_TRACE
 #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++)
 		for (i = 0; i < len; i++)
 		printf("td->data[%d] %#2x\n",i, ((unsigned char *)(td->data+0x80000000))[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);
 	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)))) {
 	    ((td->index == 0) || (td->index == lurb_priv->length - 1)))) {
 		if (tdBE != 0) {
 		if (tdBE != 0) {
 			if (td->hwCBP == 0)
 			if (td->hwCBP == 0)
@@ -1015,7 +1016,7 @@ pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
 #else
 #else
 	wait_ms(1);
 	wait_ms(1);
 #endif
 #endif
-	if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+	if (usb_pipeint(pipe)) {
 		info("Root-Hub submit IRQ: NOT implemented");
 		info("Root-Hub submit IRQ: NOT implemented");
 		return 0;
 		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 */
 	/* allow more time for a BULK device to react - some are slow */
 #define BULK_TO	 5000	/* timeout in milliseconds */
 #define BULK_TO	 5000	/* timeout in milliseconds */
-	if (usb_pipetype (pipe) == PIPE_BULK)
+	if (usb_pipebulk(pipe))
 		timeout = BULK_TO;
 		timeout = BULK_TO;
 	else
 	else
 		timeout = 100;
 		timeout = 100;

+ 4 - 4
cpu/mpc5xxx/usb_ohci.c

@@ -660,7 +660,7 @@ static void td_fill (ohci_t *ohci, unsigned int info,
 	td->index = index;
 	td->index = index;
 	td->data = (__u32)data;
 	td->data = (__u32)data;
 #ifdef OHCI_FILL_TRACE
 #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++)
 		for (i = 0; i < len; i++)
 		printf("td->data[%d] %#2x ",i, ((unsigned char *)td->data)[i]);
 		printf("td->data[%d] %#2x ",i, ((unsigned char *)td->data)[i]);
 		printf("\n");
 		printf("\n");
@@ -761,7 +761,7 @@ static void dl_transfer_length(td_t * td)
 	tdCBP  = ohci_cpu_to_le32 (td->hwCBP);
 	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)))) {
 	    ((td->index == 0) || (td->index == lurb_priv->length - 1)))) {
 		if (tdBE != 0) {
 		if (tdBE != 0) {
 			if (td->hwCBP == 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;
 urb_priv.actual_length = 0;
 pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
 pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
 #endif
 #endif
-	if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+	if (usb_pipeint(pipe)) {
 		info("Root-Hub submit IRQ: NOT implemented");
 		info("Root-Hub submit IRQ: NOT implemented");
 		return 0;
 		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 */
 	/* allow more time for a BULK device to react - some are slow */
 #define BULK_TO	 5000	/* timeout in milliseconds */
 #define BULK_TO	 5000	/* timeout in milliseconds */
-	if (usb_pipetype (pipe) == PIPE_BULK)
+	if (usb_pipebulk(pipe))
 		timeout = BULK_TO;
 		timeout = BULK_TO;
 	else
 	else
 		timeout = 100;
 		timeout = 100;

+ 4 - 4
cpu/ppc4xx/usb_ohci.c

@@ -660,7 +660,7 @@ static void td_fill (ohci_t *ohci, unsigned int info,
 	td->index = index;
 	td->index = index;
 	td->data = (__u32)data;
 	td->data = (__u32)data;
 #ifdef OHCI_FILL_TRACE
 #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++)
 		for (i = 0; i < len; i++)
 		printf("td->data[%d] %#2x ",i, ((unsigned char *)td->data)[i]);
 		printf("td->data[%d] %#2x ",i, ((unsigned char *)td->data)[i]);
 		printf("\n");
 		printf("\n");
@@ -761,7 +761,7 @@ static void dl_transfer_length(td_t * td)
 	tdCBP  = ohci_cpu_to_le32 (td->hwCBP);
 	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)))) {
 	    ((td->index == 0) || (td->index == lurb_priv->length - 1)))) {
 		if (tdBE != 0) {
 		if (tdBE != 0) {
 			if (td->hwCBP == 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;
 urb_priv.actual_length = 0;
 pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
 pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)", usb_pipein(pipe));
 #endif
 #endif
-	if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+	if (usb_pipeint(pipe)) {
 		info("Root-Hub submit IRQ: NOT implemented");
 		info("Root-Hub submit IRQ: NOT implemented");
 		return 0;
 		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 */
 	/* allow more time for a BULK device to react - some are slow */
 #define BULK_TO	 5000	/* timeout in milliseconds */
 #define BULK_TO	 5000	/* timeout in milliseconds */
-	if (usb_pipetype (pipe) == PIPE_BULK)
+	if (usb_pipebulk(pipe))
 		timeout = BULK_TO;
 		timeout = BULK_TO;
 	else
 	else
 		timeout = 100;
 		timeout = 100;

+ 2 - 2
drivers/usb/isp116x-hcd.c

@@ -687,7 +687,7 @@ retry_same:
 	/* Start the data transfer */
 	/* Start the data transfer */
 
 
 	/* Allow more time for a BULK device to react - some are slow */
 	/* Allow more time for a BULK device to react - some are slow */
-	if (usb_pipetype(pipe) == PIPE_BULK)
+	if (usb_pipebulk(pipe))
 		timeout = 5000;
 		timeout = 5000;
 	else
 	else
 		timeout = 100;
 		timeout = 100;
@@ -822,7 +822,7 @@ static int isp116x_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
 	u16 wIndex;
 	u16 wIndex;
 	u16 wLength;
 	u16 wLength;
 
 
-	if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+	if (usb_pipeint(pipe)) {
 		INFO("Root-Hub submit IRQ: NOT implemented");
 		INFO("Root-Hub submit IRQ: NOT implemented");
 		return 0;
 		return 0;
 	}
 	}

+ 1 - 1
drivers/usb/r8a66597-hcd.c

@@ -654,7 +654,7 @@ static int r8a66597_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
 
 
 	R8A66597_DPRINT("%s\n", __func__);
 	R8A66597_DPRINT("%s\n", __func__);
 
 
-	if ((pipe & PIPE_INTERRUPT) == PIPE_INTERRUPT) {
+	if (usb_pipeint(pipe)) {
 		printf("Root-Hub submit IRQ: NOT implemented");
 		printf("Root-Hub submit IRQ: NOT implemented");
 		return 0;
 		return 0;
 	}
 	}