1. 13 Sep, 2016 1 commit
  2. 15 Aug, 2016 1 commit
  3. 09 Aug, 2016 1 commit
  4. 26 Apr, 2016 1 commit
  5. 13 Apr, 2016 1 commit
  6. 10 May, 2015 1 commit
    • Akinobu Mita's avatar
      usb: storage: fix module reference for scsi host · aa519be3
      Akinobu Mita authored
      
      
      While accessing a unusual usb storage (ums-alauda, ums-cypress, ...),
      the module reference count is not incremented.  Because these drivers
      allocate scsi hosts with usb_stor_host_template defined in usb-storage
      module.  So these drivers always can be unloaded.
      
      This fixes it by preparing scsi host template which is initialized
      at module_init() for each ums-* driver.  In order to minimize the
      difference in ums-* drivers, introduce module_usb_stor_driver() helper
      macro which is same as module_usb_driver() except that it also
      initializes scsi host template.
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Cc: Vinayak Holikatti <vinholikatti@gmail.com>
      Cc: Dolev Raviv <draviv@codeaurora.org>
      Cc: Sujit Reddy Thumma <sthumma@codeaurora.org>
      Cc: Subhash Jadavani <subhashj@codeaurora.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: linux-usb@vger.kernel.org
      Cc: usb-storage@lists.one-eyed-alien.net
      Cc: linux-scsi@vger.kernel.org
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa519be3
  7. 28 Apr, 2015 2 commits
  8. 24 Feb, 2015 1 commit
  9. 25 Nov, 2014 1 commit
    • Mark Knibbs's avatar
      storage: Fix bus scan and multi-LUN support for SCM eUSCSI devices · 646a3843
      Mark Knibbs authored
      
      
      This patch does two things for SCM eUSCSI USB-SCSI converters:
      
      1. SCM eUSCSI bridge devices are hard-wired to use SCSI ID 7. On connecting
      the converter, access to that ID is attempted during the bus scan. Asking
      the converter to issue INQUIRY commands to itself isn't very polite and
      wastes time. Set this_id to 7 so __scsi_scan_target() skips it in the scan.
      
      2. Enable multi-LUN support. eUSCSI devices don't support Get Max LUN
      requests, returning an error (-32). [Different targets could have different
      numbers of LUNs, so it wouldn't make sense to return a particular value in
      response to Get Max LUN.]
      
      usb_stor_scan_dwork() does this:
          /* For bulk-only devices, determine the max LUN value */
          if (us->protocol == USB_PR_BULK && !(us->fflags & US_FL_SINGLE_LUN)) {
                  mutex_lock(&us->dev_mutex);
                  us->max_lun = usb_stor_Bulk_max_lun(us);
                  mutex_unlock(&us->dev_mutex);
      
      It avoids calling usb_stor_Bulk_max_lun() if US_FL_SINGLE_LUN, but not for
      US_FL_SCM_MULT_TARG. Since usb_stor_Bulk_max_lun() returns 0 in the error
      case, us->max_lun was always set to 0.
      
      [If the user doesn't want multi-LUN support (perhaps there are SCSI devices
      which respond to commands on all LUNs?), the US_FL_SINGLE_LUN quirk can be
      specified on the kernel command line.]
      Signed-off-by: default avatarMark Knibbs <markk@clara.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      646a3843
  10. 24 Sep, 2014 3 commits
  11. 15 Sep, 2014 1 commit
    • 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
  12. 17 Jul, 2014 1 commit
  13. 04 Mar, 2014 2 commits
  14. 08 Jan, 2014 1 commit
  15. 19 Apr, 2013 2 commits
    • Greg Kroah-Hartman's avatar
      USB: storage: convert to use module_usb_driver() · 4601de80
      Greg Kroah-Hartman authored
      
      
      Now that Joe cleaned up the init/exit functions, we can just get rid of
      them entirely and use the proper macro that almost all other USB drivers
      now use.
      
      Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Cc: Joe Perches <joe@perches.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4601de80
    • Joe Perches's avatar
      usb: storage: Convert US_DEBUGP to usb_stor_dbg · 191648d0
      Joe Perches authored
      
      
      Use a more current logging style with dev_printk
      where possible.
      
      o Convert uses of US_DEBUGP to usb_stor_dbg
      o Add "struct us_data *" to usb_stor_dbg uses
      o usb_stor_dbg now uses struct device */dev_vprint_emit
      o Removed embedded function names
      o Coalesce formats
      o Remove trailing whitespace
      o Remove useless OOM messages
      o Remove useless function entry/exit logging
      o Convert some US_DEBUGP uses to dev_info and dev_dbg
      
      Object size is slightly reduced when debugging
      is enabled, slightly increased with no debugging
      because some initialization and removal messages
      are now always emitted.
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      191648d0
  16. 04 Feb, 2013 1 commit
  17. 21 Jan, 2013 1 commit
  18. 26 Nov, 2012 1 commit
  19. 06 Sep, 2012 1 commit
  20. 20 Jul, 2012 1 commit
  21. 16 Jul, 2012 1 commit
  22. 17 May, 2012 3 commits
  23. 06 Apr, 2012 1 commit
    • Ming Lei's avatar
      usb: storage: fix lockdep warning inside usb_stor_pre_reset(v2) · c825bab0
      Ming Lei authored
      
      
      This patch fixes one lockdep warning[1] inside usb_stor_pre_reset.
      
      If the current configuration includes multiple mass storage interfaces,
      the 'AA' lockdep warning will be triggered since the lock class of
      'us->dev_mutex' is acquired two times in .reset path. It isn't
      a real deadlock, so just take the lockdep_set_class annotation to
      remove the warning.
      
      [1], lockdep warning log
      :[ INFO: possible recursive locking detected ]
      :3.3.0-0.rc5.git3.1.fc17.x86_64 #1 Tainted: G        W
      :---------------------------------------------
      :usb-storage/14846 is trying to acquire lock:
      : (&(us->dev_mutex)){+.+.+.}, at: [<ffffffffa0481c0c>] usb_stor_pre_reset+0x1c/0x20 [usb_storage]
      :but task is already holding lock:
      : (&(us->dev_mutex)){+.+.+.}, at: [<ffffffffa0481c0c>] usb_stor_pre_reset+0x1c/0x20 [usb_storage]
      :other info that might help us debug this:
      : Possible unsafe locking scenario:
      :       CPU0
      :       ----
      :  lock(&(us->dev_mutex));
      :  lock(&(us->dev_mutex));
      : *** DEADLOCK ***
      : May be due to missing lock nesting notation
      :2 locks held by usb-storage/14846:
      : #0:  (&__lockdep_no_validate__){......}, at: [<ffffffff8147e6a5>] usb_lock_device_for_reset+0x95/0x100
      : #1:  (&(us->dev_mutex)){+.+.+.}, at: [<ffffffffa0481c0c>] usb_stor_pre_reset+0x1c/0x20 [usb_storage]
      :stack backtrace:
      :Pid: 14846, comm: usb-storage Tainted: G        W 3.3.0-0.rc5.git3.1.fc17.x86_64 #1
      :Call Trace:
      : [<ffffffff810cbdaf>] __lock_acquire+0x168f/0x1bb0
      : [<ffffffff81021083>] ? native_sched_clock+0x13/0x80
      : [<ffffffff810210f9>] ? sched_clock+0x9/0x10
      : [<ffffffff810210f9>] ? sched_clock+0x9/0x10
      : [<ffffffff810a2975>] ? sched_clock_local+0x25/0xa0
      : [<ffffffff810cc9a1>] lock_acquire+0xa1/0x1e0
      : [<ffffffffa0481c0c>] ? usb_stor_pre_reset+0x1c/0x20 [usb_storage]
      : [<ffffffff81699c86>] mutex_lock_nested+0x76/0x3a0
      : [<ffffffffa0481c0c>] ? usb_stor_pre_reset+0x1c/0x20 [usb_storage]
      : [<ffffffffa0481c0c>] ? usb_stor_pre_reset+0x1c/0x20 [usb_storage]
      : [<ffffffffa0481c0c>] usb_stor_pre_reset+0x1c/0x20 [usb_storage]
      : [<ffffffff8148184d>] usb_reset_device+0x7d/0x190
      : [<ffffffffa048119c>] usb_stor_port_reset+0x7c/0x80 [usb_storage]
      : [<ffffffffa0481234>] usb_stor_invoke_transport+0x94/0x560 [usb_storage]
      : [<ffffffff810cd3b2>] ? mark_held_locks+0xb2/0x130
      : [<ffffffff8169dbd0>] ? _raw_spin_unlock_irq+0x30/0x50
      : [<ffffffffa047fe3e>] usb_stor_transparent_scsi_command+0xe/0x10 [usb_storage]
      : [<ffffffffa0481ae3>] usb_stor_control_thread+0x173/0x280 [usb_storage]
      : [<ffffffffa0481970>] ? fill_inquiry_response+0x20/0x20 [usb_storage]
      : [<ffffffff8108a3f7>] kthread+0xb7/0xc0
      : [<ffffffff816a7d34>] kernel_thread_helper+0x4/0x10
      : [<ffffffff8169e0f4>] ? retint_restore_args+0x13/0x13
      : [<ffffffff8108a340>] ? kthread_worker_fn+0x1a0/0x1a0
      : [<ffffffff816a7d30>] ? gs_change+0x13/0x13
      Reported-By: default avatarDave Jones <davej@redhat.com>
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c825bab0
  24. 22 Feb, 2012 1 commit
    • Alan Stern's avatar
      usb-storage: fix freezing of the scanning thread · bb94a406
      Alan Stern authored
      
      
      This patch (as1521b) fixes the interaction between usb-storage's
      scanning thread and the freezer.  The current implementation has a
      race: If the device is unplugged shortly after being plugged in and
      just as a system sleep begins, the scanning thread may get frozen
      before the khubd task.  Khubd won't be able to freeze until the
      disconnect processing is complete, and the disconnect processing can't
      proceed until the scanning thread finishes, so the sleep transition
      will fail.
      
      The implementation in the 3.2 kernel suffers from an additional
      problem.  There the scanning thread calls set_freezable_with_signal(),
      and the signals sent by the freezer will mess up the thread's I/O
      delays, which are all interruptible.
      
      The solution to both problems is the same: Replace the kernel thread
      used for scanning with a delayed-work routine on the system freezable
      work queue.  Freezable work queues have the nice property that you can
      cancel a work item even while the work queue is frozen, and no signals
      are needed.
      
      The 3.2 version of this patch solves the problem in Bugzilla #42730.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Acked-by: default avatarSeth Forshee <seth.forshee@canonical.com>
      CC: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bb94a406
  25. 24 Jan, 2012 1 commit
  26. 05 Jan, 2012 1 commit
    • Huajun Li's avatar
      usb: usb-storage doesn't support dynamic id currently, the patch disables the... · 1a3a026b
      Huajun Li authored
      
      usb: usb-storage doesn't support dynamic id currently, the patch disables the feature to fix an oops
      
      Echo vendor and product number of a non usb-storage device to
      usb-storage driver's new_id, then plug in the device to host and you
      will find following oops msg, the root cause is usb_stor_probe1()
      refers invalid id entry if giving a dynamic id, so just disable the
      feature.
      
      [ 3105.018012] general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC
      [ 3105.018062] CPU 0
      [ 3105.018075] Modules linked in: usb_storage usb_libusual bluetooth
      dm_crypt binfmt_misc snd_hda_codec_analog snd_hda_intel snd_hda_codec
      snd_hwdep hp_wmi ppdev sparse_keymap snd_pcm snd_seq_midi snd_rawmidi
      snd_seq_midi_event snd_seq snd_timer snd_seq_device psmouse snd
      serio_raw tpm_infineon soundcore i915 snd_page_alloc tpm_tis
      parport_pc tpm tpm_bios drm_kms_helper drm i2c_algo_bit video lp
      parport usbhid hid sg sr_mod sd_mod ehci_hcd uhci_hcd usbcore e1000e
      usb_common floppy
      [ 3105.018408]
      [ 3105.018419] Pid: 189, comm: khubd Tainted: G          I  3.2.0-rc7+
      #29 Hewlett-Packard HP Compaq dc7800p Convertible Minitower/0AACh
      [ 3105.018481] RIP: 0010:[<ffffffffa045830d>]  [<ffffffffa045830d>]
      usb_stor_probe1+0x2fd/0xc20 [usb_storage]
      [ 3105.018536] RSP: 0018:ffff880056a3d830  EFLAGS: 00010286
      [ 3105.018562] RAX: ffff880065f4e648 RBX: ffff88006bb28000 RCX: 0000000000000000
      [ 3105.018597] RDX: ffff88006f23c7b0 RSI: 0000000000000001 RDI: 0000000000000206
      [ 3105.018632] RBP: ffff880056a3d900 R08: 0000000000000000 R09: ffff880067365000
      [ 3105.018665] R10: 00000000000002ac R11: 0000000000000010 R12: ffff6000b41a7340
      [ 3105.018698] R13: ffff880065f4ef60 R14: ffff88006bb28b88 R15: ffff88006f23d270
      [ 3105.018733] FS:  0000000000000000(0000) GS:ffff88007a200000(0000)
      knlGS:0000000000000000
      [ 3105.018773] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [ 3105.018801] CR2: 00007fc99c8c4650 CR3: 0000000001e05000 CR4: 00000000000006f0
      [ 3105.018835] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [ 3105.018870] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
      [ 3105.018906] Process khubd (pid: 189, threadinfo ffff880056a3c000,
      task ffff88005677a400)
      [ 3105.018945] Stack:
      [ 3105.018959]  0000000000000000 0000000000000000 ffff880056a3d8d0
      0000000000000002
      [ 3105.019011]  0000000000000000 ffff880056a3d918 ffff880000000000
      0000000000000002
      [ 3105.019058]  ffff880056a3d8d0 0000000000000012 ffff880056a3d8d0
      0000000000000006
      [ 3105.019105] Call Trace:
      [ 3105.019128]  [<ffffffffa0458cd4>] storage_probe+0xa4/0xe0 [usb_storage]
      [ 3105.019173]  [<ffffffffa0097822>] usb_probe_interface+0x172/0x330 [usbcore]
      [ 3105.019211]  [<ffffffff815fda67>] driver_probe_device+0x257/0x3b0
      [ 3105.019243]  [<ffffffff815fdd43>] __device_attach+0x73/0x90
      [ 3105.019272]  [<ffffffff815fdcd0>] ? __driver_attach+0x110/0x110
      [ 3105.019303]  [<ffffffff815fb93c>] bus_for_each_drv+0x9c/0xf0
      [ 3105.019334]  [<ffffffff815fd6c7>] device_attach+0xf7/0x120
      [ 3105.019364]  [<ffffffff815fc905>] bus_probe_device+0x45/0x80
      [ 3105.019396]  [<ffffffff815f98a6>] device_add+0x876/0x990
      [ 3105.019434]  [<ffffffffa0094e42>] usb_set_configuration+0x822/0x9e0 [usbcore]
      [ 3105.019479]  [<ffffffffa00a3492>] generic_probe+0x62/0xf0 [usbcore]
      [ 3105.019518]  [<ffffffffa0097a46>] usb_probe_device+0x66/0xb0 [usbcore]
      [ 3105.019555]  [<ffffffff815fda67>] driver_probe_device+0x257/0x3b0
      [ 3105.019589]  [<ffffffff815fdd43>] __device_attach+0x73/0x90
      [ 3105.019617]  [<ffffffff815fdcd0>] ? __driver_attach+0x110/0x110
      [ 3105.019648]  [<ffffffff815fb93c>] bus_for_each_drv+0x9c/0xf0
      [ 3105.019680]  [<ffffffff815fd6c7>] device_attach+0xf7/0x120
      [ 3105.019709]  [<ffffffff815fc905>] bus_probe_device+0x45/0x80
      [ 3105.021040] usb usb6: usb auto-resume
      [ 3105.021045] usb usb6: wakeup_rh
      [ 3105.024849]  [<ffffffff815f98a6>] device_add+0x876/0x990
      [ 3105.025086]  [<ffffffffa0088987>] usb_new_device+0x1e7/0x2b0 [usbcore]
      [ 3105.025086]  [<ffffffffa008a4d7>] hub_thread+0xb27/0x1ec0 [usbcore]
      [ 3105.025086]  [<ffffffff810d5200>] ? wake_up_bit+0x50/0x50
      [ 3105.025086]  [<ffffffffa00899b0>] ? usb_remote_wakeup+0xa0/0xa0 [usbcore]
      [ 3105.025086]  [<ffffffff810d49b8>] kthread+0xd8/0xf0
      [ 3105.025086]  [<ffffffff81939884>] kernel_thread_helper+0x4/0x10
      [ 3105.025086]  [<ffffffff8192a8c0>] ? _raw_spin_unlock_irq+0x50/0x80
      [ 3105.025086]  [<ffffffff8192b1b4>] ? retint_restore_args+0x13/0x13
      [ 3105.025086]  [<ffffffff810d48e0>] ? __init_kthread_worker+0x80/0x80
      [ 3105.025086]  [<ffffffff81939880>] ? gs_change+0x13/0x13
      [ 3105.025086] Code: 00 48 83 05 cd ad 00 00 01 48 83 05 cd ad 00 00
      01 4c 8b ab 30 0c 00 00 48 8b 50 08 48 83 c0 30 48 89 45 a0 4c 89 a3
      40 0c 00 00 <41> 0f b6 44 24 10 48 89 55 a8 3c ff 0f 84 b8 04 00 00 48
      83 05
      [ 3105.025086] RIP  [<ffffffffa045830d>] usb_stor_probe1+0x2fd/0xc20
      [usb_storage]
      [ 3105.025086]  RSP <ffff880056a3d830>
      [ 3105.060037] hub 6-0:1.0: hub_resume
      [ 3105.062616] usb usb5: usb auto-resume
      [ 3105.064317] ehci_hcd 0000:00:1d.7: resume root hub
      [ 3105.094809] ---[ end trace a7919e7f17c0a727 ]---
      [ 3105.130069] hub 5-0:1.0: hub_resume
      [ 3105.132131] usb usb4: usb auto-resume
      [ 3105.132136] usb usb4: wakeup_rh
      [ 3105.180059] hub 4-0:1.0: hub_resume
      [ 3106.290052] usb usb6: suspend_rh (auto-stop)
      [ 3106.290077] usb usb4: suspend_rh (auto-stop)
      Signed-off-by: default avatarHuajun Li <huajun.li.lee@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      1a3a026b
  27. 21 Nov, 2011 1 commit
    • Tejun Heo's avatar
      usb_storage: don't use set_freezable_with_signal() · ec012476
      Tejun Heo authored
      
      
      The current implementation of set_freezable_with_signal() is buggy and
      tricky to get right.  usb-storage is the only user and its use can be
      avoided trivially.
      
      All usb-storage wants is to be able to sleep with timeout and get
      woken up if freezing() becomes true.  This can be trivially
      implemented by doing interruptible wait w/ freezing() included in the
      wait condition.  There's no reason to use set_freezable_with_signal().
      
      Perform interruptible wait on freezing() instead of using
      set_freezable_with_signal(), which is scheduled for removal.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Seth Forshee <seth.forshee@canonical.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      ec012476
  28. 22 Aug, 2011 1 commit
    • Seth Forshee's avatar
      usb_storage: Don't freeze in usb-stor-scan · f02fe890
      Seth Forshee authored
      
      
      Scanning cannot be run during suspend or hibernation, but if
      usb-stor-scan freezes another thread waiting on scanning to
      complete may fail to freeze.
      
      However, if usb-stor-scan is left freezable without ever actually
      freezing then the freezer will wait on it to exit, and threads
      waiting for scanning to finish will no longer be blocked. One
      problem with this approach is that usb-stor-scan has a delay to
      wait for devices to settle (which is currently the only point where
      it can freeze). To work around this we can request that the freezer
      send a fake signal when freezing, then use interruptible sleep to
      wake the thread early when freezing happens.
      
      To make this happen, the following changes are made to
      usb-stor-scan:
      
       * Use set_freezable_with_signal() instead of set_freezable() to
         request a fake signal when freezing
      
       * Use wait_event_interruptible_timeout() instead of
         wait_event_freezable_timeout() to avoid freezing
      Signed-off-by: default avatarSeth Forshee <seth.forshee@canonical.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f02fe890
  29. 07 Jun, 2011 1 commit
    • Alan Stern's avatar
      usb-storage: redo incorrect reads · 21c13a4f
      Alan Stern authored
      
      
      Some USB mass-storage devices have bugs that cause them not to handle
      the first READ(10) command they receive correctly.  The Corsair
      Padlock v2 returns completely bogus data for its first read (possibly
      it returns the data in encrypted form even though the device is
      supposed to be unlocked).  The Feiya SD/SDHC card reader fails to
      complete the first READ(10) command after it is plugged in or after a
      new card is inserted, returning a status code that indicates it thinks
      the command was invalid, which prevents the kernel from retrying the
      read.
      
      Since the first read of a new device or a new medium is for the
      partition sector, the kernel is unable to retrieve the device's
      partition table.  Users have to manually issue an "hdparm -z" or
      "blockdev --rereadpt" command before they can access the device.
      
      This patch (as1470) works around the problem.  It adds a new quirk
      flag, US_FL_INVALID_READ10, indicating that the first READ(10) should
      always be retried immediately, as should any failing READ(10) commands
      (provided the preceding READ(10) command succeeded, to avoid getting
      stuck in a loop).  The patch also adds appropriate unusual_devs
      entries containing the new flag.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Tested-by: default avatarSven Geggus <sven-usbst@geggus.net>
      Tested-by: default avatarPaul Hartman <paul.hartman+linux@gmail.com>
      CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      CC: <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      21c13a4f
  30. 19 May, 2011 1 commit
  31. 22 Oct, 2010 1 commit
  32. 10 Aug, 2010 1 commit
    • Alan Stern's avatar
      USB: usb-storage: implement autosuspend · f283925f
      Alan Stern authored
      
      
      This patch (as1400) adds runtime-PM support to usb-storage.  It
      utilizes the SCSI layer's runtime-PM implementation, so its scope is
      limited.  Currently the only effect is that disk-like devices (such as
      card readers or flash drives) will be autosuspended if they aren't
      mounted and their device files aren't open.  This would apply, for
      example, to card readers that don't contain a memory card.
      
      Unfortunately this won't interact very well with the removable-media
      polling normally carried out by hal or DeviceKit.  Maybe those
      programs can be changed to use a longer polling interval, or maybe the
      default autosuspend time for usb-storage should be set to something
      below 1 second.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: James Bottomley <James.Bottomley@suse.de>
      Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f283925f
  33. 20 May, 2010 1 commit
    • Felipe Contreras's avatar
      usb-storage: always print quirks · 39f2f080
      Felipe Contreras authored
      
      
      Right now quirks are printed only when the are manually overriden with
      the module parameters. It's not so useful to remind the user that his
      parameters are correctly applied; what is useful is to print out the
      quirks the user is not aware are being applied.
      
      So let's do the smart thing and print the quirks when they are present.
      Signed-off-by: default avatarFelipe Contreras <felipe.contreras@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      39f2f080