Re: [PATCH 1/4] uas: new function to cancel data urbs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/29/12 14:20, Oliver Neukum wrote:
> On Thursday 29 November 2012 14:06:12 Gerd Hoffmann wrote:
>> Add uas_unlink_data_urbs function to cancel in-flight data urbs.
>> Moves existing code into a separate function.
>>
>> Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
>> ---
>>  drivers/usb/storage/uas.c |   32 ++++++++++++++++++++++----------
>>  1 files changed, 22 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
>> index 98b98ee..c348afa 100644
>> --- a/drivers/usb/storage/uas.c
>> +++ b/drivers/usb/storage/uas.c
>> @@ -87,6 +87,25 @@ static DECLARE_WORK(uas_work, uas_do_work);
>>  static DEFINE_SPINLOCK(uas_work_lock);
>>  static LIST_HEAD(uas_work_list);
>>  
>> +static void uas_unlink_data_urbs(struct uas_dev_info *devinfo,
>> +				 struct uas_cmd_info *cmdinfo)
>> +{
>> +	unsigned long flags;
>> +
>> +	spin_lock_irqsave(&devinfo->lock, flags);
>> +	if (cmdinfo->state & DATA_IN_URB_INFLIGHT) {
>> +		spin_unlock_irqrestore(&devinfo->lock, flags);

urb_unlink_urb may call the completion callback which in turn grabs the
lock to update cmdinfo->state, so we must drop it to avoid deadlocks.

cheers,
  Gerd

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux