Am Freitag, 30. Juni 2006 04:17 schrieb Alan Stern:
> On Thu, 29 Jun 2006, Oliver Neukum wrote:
>
> > Hi,
> >
> > does anybody know what error to return from queuecommand for commands
> > arriving while a device is being suspended?
>
> I don't know of anyone who has worried about it yet...
>
> You want to tell the SCSI core that your device isn't reachable and it
> shouldn't attempt to retry the command, right? One way to do that is to
> set scmd->result = DID_NO_CONNECT << 16 and to call done(scmd), then
> return 0. That's what usb-storage does when queuecommand is called after
> the device has been disconnected.
>
> Presumably this won't come up very often. If all the children devices are
> properly suspended first then there shouldn't be any calls to queuecommand
> while your device is being suspended.
Is this true, even if we are talking about suspending single devices?
This is how the plan for microtek is looking now:
static int mts_usb_suspend (struct usb_interface *intf, pm_message_t message)
{
int rv = 0;
struct mts_desc* desc = usb_get_intfdata(intf);
spin_lock_irq(desc->susp_lock);
if (desc->working > 0) {
rv = -EBUSY;
} else {
desc->working = -1;
scsi_block_requests(desc->host);
}
spin_unlock_irq(desc->susp_lock);
return rv;
}
static int mts_usb_resume (struct usb_interface *intf)
{
struct mts_desc* desc;
desc = usb_get_intfdata(intf);
spin_lock_irq(desc->susp_lock);
desc->working = 0;
spin_unlock_irq(desc->susp_lock);
scsi_unblock_requests(desc->host);
return 0;
}
But scsi_block_requests() isn't doing any locking.
Regards
Oliver
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel