usb/uas: use scsi_host_find_tag() to find command from a tag
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Mon, 19 Dec 2011 19:22:39 +0000 (20:22 +0100)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 30 Apr 2012 18:15:15 +0000 (19:15 +0100)
commitb503b11ee0ca9369d7f7e1b772985fd230c95a34
tree89c174907afc2a1995fd8c38df43aa36eb9b7d7f
parente1d6b6cad73a450503f1696b54f356a5cbaca8dd
usb/uas: use scsi_host_find_tag() to find command from a tag

BugLink: http://bugs.launchpad.net/bugs/901215

In "usb/uas: use unique tags for all LUNs" we make sure to create unique
tags across all LUNs. This patch uses scsi_host_find_tag() to obtain the
correct command which is associated with the tag.
The following changes are required:
- don't use sdev->current_cmnd anymore
  Since we can have devices which don't support command queueing we must
  ensure that we can tell the two commands apart. Even if a device
  supports comand queuing we send the INQUIRY command "untagged" for
  LUN1 while we can send a tagged command to LUN0 at the same time.
  devinfo->cmnd is used for stashing the one "untagged" command.
- tag number is altered. If stream support is used then the tag number
  must match the stream number. Therefore we can't use tag 0 and must
  start at tag 1.
  In case we have untagged commands (at least the first command) we must
  be able to distinguish between command tag 0 (which becomes 1) and
  untagged command (which becomes curently also 1).
  The following tag numbers are used:
  0: never
  1: for untagged commands (devinfo->cmnd)
  2+: tagged commands.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
(cherry picked from commit 22188f4a933c6e86ac67f52028895c795896492e)

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Herton Krzesinski <herton.krzesinski@canonical.com>
drivers/usb/storage/uas.c