1. 16 Sep, 2014 38 commits
  2. 15 Sep, 2014 2 commits
    • Subhash Jadavani's avatar
      scsi: balance out autopm get/put calls in scsi_sysfs_add_sdev() · 6fe8c1db
      Subhash Jadavani authored
      SCSI Well-known logical units generally don't have any scsi driver
      associated with it which means no one will call scsi_autopm_put_device()
      on these wlun scsi devices and this would result in keeping the
      corresponding scsi device always active (hence LLD can't be suspended as
      well). Same exact problem can be seen for other scsi device representing
      normal logical unit whose driver is yet to be loaded. This patch fixes
      the above problem with this approach:
      
      - make the scsi_autopm_put_device call at the end of scsi_sysfs_add_sdev
        to make it balance out the get earlier in the function.
      - let drivers do paired get/put calls in their probe methods.
      Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
      Signed-off-by: default avatarDolev Raviv <draviv@codeaurora.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      6fe8c1db
    • Alan Stern's avatar
      scsi: don't store LUN bits in CDB[1] for USB mass-storage devices · 50c4e964
      Alan Stern authored
      The SCSI specification requires that the second Command Data Byte
      should contain the LUN value in its high-order bits if the recipient
      device reports SCSI level 2 or below.  Nevertheless, some USB
      mass-storage devices use those bits for other purposes in
      vendor-specific commands.  Currently Linux has no way to send such
      commands, because the SCSI stack always overwrites the LUN bits.
      
      Testing shows that Windows 7 and XP do not store the LUN bits in the
      CDB when sending commands to a USB device.  This doesn't matter if the
      device uses the Bulk-Only or UAS transports (which virtually all
      modern USB mass-storage devices do), as these have a separate
      mechanism for sending the LUN value.
      
      Therefore this patch introduces a flag in the Scsi_Host structure to
      inform the SCSI midlayer that a transport does not require the LUN
      bits to be stored in the CDB, and it makes usb-storage set this flag
      for all devices using the Bulk-Only transport.  (UAS is handled by a
      separate driver, but it doesn't really matter because no SCSI-2 or
      lower device is at all likely to use UAS.)
      
      The patch also cleans up the code responsible for storing the LUN
      value by adding a bitflag to the scsi_device structure.  The test for
      whether to stick the LUN value in the CDB can be made when the device
      is probed, and stored for future use rather than being made over and
      over in the fast path.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-by: default avatarTiziano Bacocco <tiziano.bacocco@gmail.com>
      Acked-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Acked-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      50c4e964