Re: suspend/resume for usb serial devices

Oliver Neukum <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Novell
Message-ID <[email protected]>
Am Donnerstag, 3. Mai 2007 01:08 schrieb James Graves:
> 
> Here's those two patch files.  Boy, don't I feel silly.
> 
> James
>

Hi,

this is wrong for 2 reasons:
 
+static int sierra_resume(struct usb_serial *serial)
+{
+       dbg("%s", __FUNCTION__);
+       if (serial)
+               sierra_setup_urbs(serial);
+       return 0;
+}

1. sierra_setup_urb called in sierra_setup_urbs:

static struct urb *sierra_setup_urb(struct usb_serial *serial, int endpoint,
				    int dir, void *ctx, char *buf, int len,
				    usb_complete_t callback)
{
	struct urb *urb;

	if (endpoint == -1)
		return NULL;		/* endpoint not needed */

	urb = usb_alloc_urb(0, GFP_KERNEL);		/* No ISO */
	if (urb == NULL) {
		dbg("%s: alloc for endpoint %d failed.", __FUNCTION__, endpoint);
		return NULL;
	}

		/* Fill URB using supplied data. */
	usb_fill_bulk_urb(urb, serial->dev,
		      usb_sndbulkpipe(serial->dev, endpoint) | dir,
		      buf, len, callback, ctx);

	return urb;
}

1. You allocate new urbs. But you don't free the old urbs in suspend.
2. You don't restart the read queue. resume() must share code with open()
in that regard

+static inline void unlink_urbs(struct sierra_port_private *portdata)
+{              
+       int i;
+       for (i = 0; i < N_IN_URB; i++)
+               usb_unlink_urb(portdata->in_urbs[i]);
+       for (i = 0; i < N_OUT_URB; i++)
+               usb_unlink_urb(portdata->out_urbs[i]);
+}

Use usb_kill_urb() please.

	Regards
		Oliver

-- 
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
This signature is a legal requirement

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
[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.