Re: Questions about the r8a66597-hcd driver

Yoshihiro Shimoda <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
Alan Stern wrote:
 > It's an easy change except for two places where set_urb_error() gets
 > called for pipe 0.  They are marked with FIXME comments in the patch
 > below because I didn't know what to do; they don't call
 > finish_request().

In the case of pipe 0, the driver calls finish_request() via
check_next_phase().

 > Can you tell me what needs to be changed?

I made the patch and confirmed it is working.

This patch includes the bug fix. There was the problem that did not
work when I applied a "add urb->unlinked" patch.

Thanks,
Yoshihiro Shimoda

---
  drivers/usb/host/r8a66597-hcd.c |   27 +++++++++++++--------------
  1 file changed, 13 insertions(+), 14 deletions(-)

diff -uprN a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
--- a/drivers/usb/host/r8a66597-hcd.c	2007-08-24 21:12:12.000000000 +0900
+++ b/drivers/usb/host/r8a66597-hcd.c	2007-08-24 21:19:58.000000000 +0900
@@ -1290,8 +1290,7 @@ static void packet_write(struct r8a66597
  		pipe_irq_enable(r8a66597, urb, pipenum);
  }

-
-static void check_next_phase(struct r8a66597 *r8a66597)
+static void check_next_phase(struct r8a66597 *r8a66597, int status)
  {
  	struct r8a66597_td *td = r8a66597_get_td(r8a66597, 0);
  	struct urb *urb;
@@ -1320,17 +1319,17 @@ static void check_next_phase(struct r8a6
  		break;
  	}

-	if (finish || urb->unlinked)
-		finish_request(r8a66597, td, 0, urb, 0);
+	if (finish || status != 0 || urb->unlinked)
+		finish_request(r8a66597, td, 0, urb, status);
  	else
  		start_transfer(r8a66597, td);
  }

-static int set_urb_error(struct r8a66597 *r8a66597, u16 pipenum)
+static int get_urb_error(struct r8a66597 *r8a66597, u16 pipenum)
  {
  	struct r8a66597_td *td = r8a66597_get_td(r8a66597, pipenum);

-	if (td && td->urb) {
+	if (td) {
  		u16 pid = r8a66597_read(r8a66597, td->pipe->pipectr) & PID;

  		if (pid == PID_NAK)
@@ -1357,7 +1356,7 @@ static void irq_pipe_ready(struct r8a665
  			packet_read(r8a66597, 0);
  		else
  			pipe_irq_disable(r8a66597, 0);
-		check_next_phase(r8a66597);
+		check_next_phase(r8a66597, 0);
  	}

  	for (pipenum = 1; pipenum < R8A66597_MAX_NUM_PIPE; pipenum++) {
@@ -1391,7 +1390,7 @@ static void irq_pipe_empty(struct r8a665
  		td = r8a66597_get_td(r8a66597, 0);
  		if (td && td->type != USB_PID_OUT)
  			disable_irq_empty(r8a66597, 0);
-		check_next_phase(r8a66597);
+		check_next_phase(r8a66597, 0);
  	}

  	for (pipenum = 1; pipenum < R8A66597_MAX_NUM_PIPE; pipenum++) {
@@ -1425,9 +1424,9 @@ static void irq_pipe_nrdy(struct r8a6659
  	r8a66597_write(r8a66597, ~mask, NRDYSTS);
  	if (mask & NRDY0) {
  		cfifo_change(r8a66597, 0);
-		status = set_urb_error(r8a66597, 0);	/* FIXME */
+		status = get_urb_error(r8a66597, 0);
  		pipe_irq_disable(r8a66597, 0);
-		check_next_phase(r8a66597);
+		check_next_phase(r8a66597, status);
  	}

  	for (pipenum = 1; pipenum < R8A66597_MAX_NUM_PIPE; pipenum++) {
@@ -1438,7 +1437,7 @@ static void irq_pipe_nrdy(struct r8a6659
  			if (unlikely(!td))
  				continue;

-			status = set_urb_error(r8a66597, pipenum);
+			status = get_urb_error(r8a66597, pipenum);
  			pipe_irq_disable(r8a66597, pipenum);
  			pipe_stop(r8a66597, td->pipe);
  			finish_request(r8a66597, td, pipenum, td->urb, status);
@@ -1505,12 +1504,12 @@ static irqreturn_t r8a66597_irq(struct u
  		}
  		if (mask1 & SIGN) {
  			r8a66597_write(r8a66597, ~SIGN, INTSTS1);
-			status = set_urb_error(r8a66597, 0);	/* FIXME */
-			check_next_phase(r8a66597);
+			status = get_urb_error(r8a66597, 0);
+			check_next_phase(r8a66597, status);
  		}
  		if (mask1 & SACK) {
  			r8a66597_write(r8a66597, ~SACK, INTSTS1);
-			check_next_phase(r8a66597);
+			check_next_phase(r8a66597, 0);
  		}
  	}
  	if (mask0) {



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.