Oliver Neukum escribió: > Am Donnerstag, 3. Mai 2007 18:35 schrieb Alex Villacís Lasso: > >> /* Coming out of suspend, so reset hardware */ >> static int kingsun_resume(struct usb_interface *intf) >> { >> struct kingsun_cb *kingsun = usb_get_intfdata(intf); >> >> if (kingsun->rx_urb != NULL) usb_submit_urb(kingsun->rx_urb, >> GFP_KERNEL); >> netif_device_attach(kingsun->netdev); >> >> return 0; >> } >> > > Do you really want to submit the URB whether the device has been opened > or not? > > Regards > Oliver > > I don't think an URB would be submitted if the device is not opened:
- The code in kingsun_resume() checks for rx_urb != NULL before submitting the URB. So your question becomes one of whether rx_urb can be not NULL while the device is not opened. - In kingsun_probe() line 490, rx_urb is assigned NULL shortly after allocating a driver structure. After the probe function returns, rx_urb is still NULL, since this probe does not allocate any URBs. Therefore, if the device is suspended and then resumed right after kingsun_probe(), rx_urb is NULL and therefore no URB is submitted. I am assuming here that an explicit call to kingsun_net_open() is required to actually open the device. - kingsun_net_open() allocates the URB and (in successful completion) leaves the device in the open state. A suspend/resume cycle here will submit rx_urb, but the interface is supposed to be opened. - kingsun_net_close() kills and frees the URBs, and sets their pointers to NULL unconditionally. After this, a suspend/resume cycle will find rx_urb == NULL and therefore no URB is submitted - kingsun_disconnect() also kills and frees the URBs, and then sets their pointers to NULL, so same argument as in kingsun_net_close() Am I missing some scenario here? -- perl -e '$x = 2.4; print sprintf("%.0f + %.0f = %.0f\n", $x, $x, $x + $x);' ------------------------------------------------------------------------- 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/ _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel