Lines 213-221
Link Here
|
213 |
static int device_reset( Scsi_Cmnd *srb ) |
213 |
static int device_reset( Scsi_Cmnd *srb ) |
214 |
{ |
214 |
{ |
215 |
struct us_data *us = (struct us_data *)srb->host->hostdata[0]; |
215 |
struct us_data *us = (struct us_data *)srb->host->hostdata[0]; |
|
|
216 |
int rc; |
216 |
|
217 |
|
217 |
US_DEBUGP("device_reset() called\n" ); |
218 |
US_DEBUGP("device_reset() called\n" ); |
218 |
return us->transport_reset(us); |
219 |
spin_unlock_irq(&io_request_lock); |
|
|
220 |
down(&(us->dev_semaphore)); |
221 |
if (!us->pusb_dev) { |
222 |
up(&(us->dev_semaphore)); |
223 |
spin_lock_irq(&io_request_lock); |
224 |
return SUCCESS; |
225 |
} |
226 |
rc = us->transport_reset(us); |
227 |
up(&(us->dev_semaphore)); |
228 |
spin_lock_irq(&io_request_lock); |
229 |
return rc; |
219 |
} |
230 |
} |
220 |
|
231 |
|
221 |
/* This resets the device port, and simulates the device |
232 |
/* This resets the device port, and simulates the device |
Lines 230-256
Link Here
|
230 |
/* we use the usb_reset_device() function to handle this for us */ |
241 |
/* we use the usb_reset_device() function to handle this for us */ |
231 |
US_DEBUGP("bus_reset() called\n"); |
242 |
US_DEBUGP("bus_reset() called\n"); |
232 |
|
243 |
|
|
|
244 |
spin_unlock_irq(&io_request_lock); |
245 |
|
246 |
down(&(us->dev_semaphore)); |
247 |
|
233 |
/* if the device has been removed, this worked */ |
248 |
/* if the device has been removed, this worked */ |
234 |
if (!us->pusb_dev) { |
249 |
if (!us->pusb_dev) { |
235 |
US_DEBUGP("-- device removed already\n"); |
250 |
US_DEBUGP("-- device removed already\n"); |
|
|
251 |
up(&(us->dev_semaphore)); |
252 |
spin_lock_irq(&io_request_lock); |
236 |
return SUCCESS; |
253 |
return SUCCESS; |
237 |
} |
254 |
} |
238 |
|
255 |
|
239 |
spin_unlock_irq(&io_request_lock); |
|
|
240 |
|
241 |
/* release the IRQ, if we have one */ |
256 |
/* release the IRQ, if we have one */ |
242 |
down(&(us->irq_urb_sem)); |
|
|
243 |
if (us->irq_urb) { |
257 |
if (us->irq_urb) { |
244 |
US_DEBUGP("-- releasing irq URB\n"); |
258 |
US_DEBUGP("-- releasing irq URB\n"); |
245 |
result = usb_unlink_urb(us->irq_urb); |
259 |
result = usb_unlink_urb(us->irq_urb); |
246 |
US_DEBUGP("-- usb_unlink_urb() returned %d\n", result); |
260 |
US_DEBUGP("-- usb_unlink_urb() returned %d\n", result); |
247 |
} |
261 |
} |
248 |
up(&(us->irq_urb_sem)); |
|
|
249 |
|
262 |
|
250 |
/* attempt to reset the port */ |
263 |
/* attempt to reset the port */ |
251 |
if (usb_reset_device(us->pusb_dev) < 0) { |
264 |
if (usb_reset_device(us->pusb_dev) < 0) { |
252 |
spin_lock_irq(&io_request_lock); |
265 |
/* |
253 |
return FAILED; |
266 |
* Do not return errors, or else the error handler might |
|
|
267 |
* invoke host_reset, which is not implemented. |
268 |
*/ |
269 |
goto bail_out; |
254 |
} |
270 |
} |
255 |
|
271 |
|
256 |
/* FIXME: This needs to lock out driver probing while it's working |
272 |
/* FIXME: This needs to lock out driver probing while it's working |
Lines 281-297
Link Here
|
281 |
up(&intf->driver->serialize); |
297 |
up(&intf->driver->serialize); |
282 |
} |
298 |
} |
283 |
|
299 |
|
|
|
300 |
bail_out: |
284 |
/* re-allocate the IRQ URB and submit it to restore connectivity |
301 |
/* re-allocate the IRQ URB and submit it to restore connectivity |
285 |
* for CBI devices |
302 |
* for CBI devices |
286 |
*/ |
303 |
*/ |
287 |
if (us->protocol == US_PR_CBI) { |
304 |
if (us->protocol == US_PR_CBI) { |
288 |
down(&(us->irq_urb_sem)); |
|
|
289 |
us->irq_urb->dev = us->pusb_dev; |
305 |
us->irq_urb->dev = us->pusb_dev; |
290 |
result = usb_submit_urb(us->irq_urb); |
306 |
result = usb_submit_urb(us->irq_urb); |
291 |
US_DEBUGP("usb_submit_urb() returns %d\n", result); |
307 |
US_DEBUGP("usb_submit_urb() returns %d\n", result); |
292 |
up(&(us->irq_urb_sem)); |
|
|
293 |
} |
308 |
} |
294 |
|
309 |
|
|
|
310 |
up(&(us->dev_semaphore)); |
311 |
|
295 |
spin_lock_irq(&io_request_lock); |
312 |
spin_lock_irq(&io_request_lock); |
296 |
|
313 |
|
297 |
US_DEBUGP("bus_reset() complete\n"); |
314 |
US_DEBUGP("bus_reset() complete\n"); |