1. 25 4月, 2008 3 次提交
    • A
      USB: make USB-PERSIST work after every system sleep · 5e6effae
      Alan Stern 提交于
      This patch (as1046) makes USB-PERSIST work more in accordance with
      the documentation.  Currently it takes effect only in cases where the
      root hub has lost power or been reset, but it is supposed to operate
      whenever a power session was dropped during a system sleep.
      
      A new hub_restart() routine carries out the duties required during a
      reset or a reset-resume.  It checks to see whether occupied ports are
      still enabled, and if they aren't then it clears the enable-change and
      connect-change features (to prevent interference by khubd) and sets
      the child device's reset_resume flag.  It also checks ports that are
      supposed to be unoccupied to verify that the firmware hasn't left the
      port in an enabled state.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5e6effae
    • A
      USB: reorganize code in hub.c · 3eb14915
      Alan Stern 提交于
      This patch (as1045) reorganizes some code in the hub driver.
      hub_port_status() is moved earlier in the file, and a new hub_stop()
      routine is created to do the work currently in hub_preset() (i.e.,
      disconnect all child devices and quiesce the hub).
      
      There are no functional changes.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3eb14915
    • A
      USB: EHCI: carry out port handover during each root-hub resume · 3bb1af52
      Alan Stern 提交于
      This patch (as1044) causes EHCI port handover for non-high-speed
      devices to occur during every root-hub resume, not just in cases where
      the controller lost power or was reset.  This is necessary because:
      
      	When some machines go into suspend, they remove power from
      	on-board USB devices while retaining suspend current for USB
      	controllers.
      
      	The user might well unplug a USB device while the system is
      	suspended and then plug it back in before resuming.
      
      A corresponding change is made to the core resume routine; now
      high-speed root hubs will always be resumed when the system wakes up,
      even if they were suspended before the system went to sleep.  If this
      weren't done then EHCI port handover wouldn't work, since it is called
      when the EHCI root hub is resumed.
      
      Finally, a comment is added to the hub driver explaining the khubd has
      to be freezable; if it weren't frozen then it could interfere with
      port handover.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3bb1af52
  2. 19 4月, 2008 1 次提交
  3. 02 2月, 2008 6 次提交
  4. 18 12月, 2007 1 次提交
  5. 29 11月, 2007 1 次提交
  6. 19 10月, 2007 1 次提交
  7. 16 10月, 2007 1 次提交
  8. 13 10月, 2007 9 次提交
    • A
      USB: mutual exclusion for EHCI init and port resets · 32fe0198
      Alan Stern 提交于
      This patch (as999) fixes a problem that sometimes shows up when host
      controller driver modules are loaded in the wrong order.  If ehci-hcd
      happens to initialize an EHCI controller while the companion OHCI or
      UHCI controller is in the middle of a port reset, the reset can fail
      and the companion may get very confused.  The patch adds an
      rw-semaphore and uses it to keep EHCI initialization and port resets
      mutually exclusive.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NDavid Brownell <david-b@pacbell.net>
      Cc: David Miller <davem@davemloft.net>
      Cc: Dely L Sy <dely.l.sy@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      32fe0198
    • J
      USB: fix limited_power setting mistake in hub.c · 403fae78
      jidong xiao 提交于
      This patch (jx001) fixes a variable assignment mistake in hub driver.
      limited_power should be set to 0 if the hub is self-powered,and 1 if
      the hub is bus-powered.
      
      However, the effect of the code was exactly opposite to the spec's
      statement for the Local Power Source field. The spec says, this field
      is 1 meaning Local power supply lost while this field is 0 indicating
      Local power supply good.(This statement is very confusing.)
      
      So this patch switchs the 0 and 1.
      Signed-off-by: NJason Xiao <jidong.xiao@gmail.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      403fae78
    • A
      USB: flush outstanding URBs when suspending · 6840d255
      Alan Stern 提交于
      This patch (as989) makes usbcore flush all outstanding URBs for each
      device as the device is suspended.  This will be true even when
      CONFIG_USB_SUSPEND is not enabled.
      
      In addition, an extra can_submit flag is added to the usb_device
      structure.  That flag will be turned off whenever a suspend request
      has been received for the device, even if the device isn't actually
      suspended because CONFIG_USB_SUSPEND isn't set.
      
      It's no longer necessary to check for the device state being equal to
      USB_STATE_SUSPENDED during URB submission; that check can be replaced
      by a check of the can_submit flag.  This also permits us to remove
      some questionable references to the deprecated power.power_state field.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6840d255
    • A
      USB: remove traces of urb->status from usbcore · e015268d
      Alan Stern 提交于
      This patch (as981) removes the remaining nontrivial usages of
      urb->status from usbcore.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e015268d
    • G
      USB: rename choose_configuration · b5ea060f
      Greg Kroah-Hartman 提交于
      As it is global, give it a usb specific name in the global namespace.
      
      Cc: Inaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b5ea060f
    • I
      usb: introduce usb_authorize/deauthorize() · 93993a0a
      Inaky Perez-Gonzalez 提交于
      These USB API functions will do the full authorization/deauthorization
      to be used for a device. When authorized we effectively allow a
      configuration to be set. Reverse that when deauthorized.
      
      Effectively this means that we have to clean all the configuration
      descriptors on deauthorize and reload them when we authorized. We could
      do without throwing them out for wired devices, but for wireless, we can
      read them only after authenticating, and thus, when authorizing an
      authenticated device we would need to read them. So to simplify, always
      release them on deauthorize(), re-read them on authorize().
      
      Also fix leak reported by Ragner Magalhaes; in usb_deauthorize_device(),
      bNumConfigurations was being set to zero before the for loop, and thus
      the different raw descriptors where never being freed.
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      93993a0a
    • I
      usb: split usb_new_device for clarity and refactoring · d9d16e8a
      Inaky Perez-Gonzalez 提交于
      This patch takes hub.c:usb_new_device() and splits it in three parts:
      
      - The actual actions of adding a new device (quirk detection,
        announcement and autoresume tracking)
      
      - Actual discovery and probing of the configuration and interfaces
        (split into __usb_configure_device())
      
      - Configuration of the On-the-go parameters (split into
        __usb_configure_device_otg()).
      
      The fundamental reasons for doing this split are clarity (smaller
      functions are easier to maintain) and to allow part of the code to be
      reused when authorizing devices to connect.
      
      When a device is authorized connection, we need to run through the
      hoops we didn't run when it was connected but not authorized, which is
      basically parsing the configurations and probing
      them. usb_configure_device() will do that for us.
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d9d16e8a
    • A
      USB: address-0 handling during device initialization · 4326ed0b
      Alan Stern 提交于
      This patch (as947) changes the device initialization and enumeration
      code in hub.c; now udev->devnum will be set to 0 while the device is
      being accessed at address 0.  Until now this wasn't needed because the
      address value was passed as part of urb->pipe; without that field the
      device address must be stored elsewhere.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4326ed0b
    • A
      USB: add ep->enable · bdd016ba
      Alan Stern 提交于
      This patch (as944) adds an explicit "enabled" field to the
      usb_host_endpoint structure and uses it in place of the current
      mechanism.  This is merely a time-space tradeoff; it makes checking
      whether URBs may be submitted to an endpoint simpler.  The existing
      mechanism is efficient when converting urb->pipe to an endpoint
      pointer, but it's not so efficient when urb->ep is used instead.
      
      As a side effect, the procedure for enabling an endpoint is now a
      little more complicated.  The ad-hoc inline code in usb.c and hub.c
      for enabling ep0 is now replaced with calls to usb_enable_endpoint,
      which is no longer static.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bdd016ba
  9. 23 8月, 2007 1 次提交
  10. 20 7月, 2007 1 次提交
  11. 18 7月, 2007 1 次提交
    • R
      Freezer: make kernel threads nonfreezable by default · 83144186
      Rafael J. Wysocki 提交于
      Currently, the freezer treats all tasks as freezable, except for the kernel
      threads that explicitly set the PF_NOFREEZE flag for themselves.  This
      approach is problematic, since it requires every kernel thread to either
      set PF_NOFREEZE explicitly, or call try_to_freeze(), even if it doesn't
      care for the freezing of tasks at all.
      
      It seems better to only require the kernel threads that want to or need to
      be frozen to use some freezer-related code and to remove any
      freezer-related code from the other (nonfreezable) kernel threads, which is
      done in this patch.
      
      The patch causes all kernel threads to be nonfreezable by default (ie.  to
      have PF_NOFREEZE set by default) and introduces the set_freezable()
      function that should be called by the freezable kernel threads in order to
      unset PF_NOFREEZE.  It also makes all of the currently freezable kernel
      threads call set_freezable(), so it shouldn't cause any (intentional)
      change of behaviour to appear.  Additionally, it updates documentation to
      describe the freezing of tasks more accurately.
      
      [akpm@linux-foundation.org: build fixes]
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NNigel Cunningham <nigel@nigel.suspend2.net>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Cc: Gautham R Shenoy <ego@in.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      83144186
  12. 13 7月, 2007 14 次提交
    • A
      USB: add power/persist device attribute · b41a60ec
      Alan Stern 提交于
      This patch (as920) adds an extra level of protection to the
      USB-Persist facility.  Now it will apply by default only to hubs; for
      all other devices the user must enable it explicitly by setting the
      power/persist device attribute.
      
      The disconnect_all_children() routine in hub.c has been removed and
      its code placed inline.  This is the way it was originally as part of
      hub_pre_reset(); the revised usage in hub_reset_resume() is
      sufficiently different that the code can no longer be shared.
      Likewise, mark_children_for_reset() is now inline as part of
      hub_reset_resume().  The end result looks much cleaner than before.
      
      The sysfs interface is updated to add the new attribute file, and
      there are corresponding documentation updates.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b41a60ec
    • A
      USB: unify reset_resume and normal resume · 54515fe5
      Alan Stern 提交于
      This patch (as919) unifies the code paths used for normal resume and
      for reset-resume.  Earlier I had failed to note a section in the USB
      spec which requires the host to resume a suspended port before
      resetting it if the attached device is enabled for remote wakeup.
      Since the port has to be resumed anyway, we might as well reuse the
      existing code.
      
      The main changes are:
      
      	usb_reset_suspended_device() is eliminated.
      
      	usb_root_hub_lost_power() is moved down next to the
      	hub_reset_resume() routine, to which it is logically
      	related.
      
      	finish_port_resume() does a port reset() if the device's
      	reset_resume flag is set.
      
      	usb_port_resume() doesn't check whether the port is initially
      	enabled if this is a USB-Persist sort of resume.
      
      	Code to perform the port reset is added to the resume pathway
      	for the non-CONFIG_USB_SUSPEND case.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      54515fe5
    • A
      USB: add reset_resume method · f07600cf
      Alan Stern 提交于
      This patch (as918) introduces a new USB driver method: reset_resume.
      It is called when a device needs to be reset as part of a resume
      procedure (whether because of a device quirk or because of the
      USB-Persist facility), thereby taking over a role formerly assigned to
      the post_reset method.  As a consequence, post_reset no longer needs
      an argument indicating whether it is being called as part of a
      reset-resume.  This separation of functions makes the code clearer.
      
      In addition, the pre_reset and post_reset method return types are
      changed; they now must return an error code.  The return value is
      unused at present, but at some later time we may unbind drivers and
      re-probe if they encounter an error during reset handling.
      
      The existing pre_reset and post_reset methods in the usbhid,
      usb-storage, and hub drivers are updated to match the new
      requirements.  For usbhid the post_reset routine is also used for
      reset_resume (duplicate method pointers); for the other drivers a new
      reset_resume routine is added.  The change to hub.c looks bigger than
      it really is, because mark_children_for_reset_resume() gets moved down
      next to the new hub_reset_resume() routine.
      
      A minor change to usb-storage makes the usb_stor_report_bus_reset()
      routine acquire the host lock instead of requiring the caller to hold
      it already.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      f07600cf
    • A
      USB: remove excess code from hub.c · 624d6c07
      Alan Stern 提交于
      This patch (as917) removes a now-unnecessary level of subroutine
      nesting from hub.c.  Since usb_port_suspend() does nothing but call
      hub_port_suspend(), and usb_port_resume() does nothing but call
      hub_port_resume(), there's no reason to keep the routines separate.
      
      Also included in the patch are a few cosmetic changes involving
      whitespace and use of braces.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      624d6c07
    • A
      USB: separate root and non-root suspend/resume · 686314cf
      Alan Stern 提交于
      This patch (as916) completes the separation of code paths for suspend
      and resume of root hubs as opposed to non-root devices.  Root hubs
      will be power-managed through their bus_suspend and bus_resume
      methods, whereas normal devices will use usb_port_suspend() and
      usb_port_resume().
      
      Changes to the hcd_bus_{suspend,resume} routines mostly represent
      motion of code that was already present elsewhere.  They include:
      
      	Adding debugging log messages,
      
      	Setting the device state appropriately, and
      
      	Adding a resume recovery time delay.
      
      Changes to the port-suspend and port-resume routines in hub.c include:
      
      	Removal of checks for root devices (since they will never
      	be triggered), and
      
      	Removal of checks for NULL or invalid device pointers (these
      	were left over from earlier kernel versions and aren't needed
      	at all).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      686314cf
    • A
      USB: remove __usb_port_suspend · 4956eccd
      Alan Stern 提交于
      This patch (as915b) combines the public routine usb_port_suspend() and
      the private routine __usb_port_suspend() into a single function.
      
      By removing the explicit mention of otg_port in the call to
      __usb_port_suspend(), we prevent a possible error in which the system
      tries to perform HNP on the wrong port when a non-targeted device is
      plugged into a non-OTG port.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4956eccd
    • V
      USB Core: hub.c: prevent re-enumeration on HNP · ffcdc18d
      Vikram Pandita 提交于
      Patch is to prevent the OTG host of doing 3 times enumeration of
      device when the Host suspends for HNP.  The error code used in
      this case is ENOTSUPP.
      Signed-off-by: NVikram Pandita <vikram.pandita@ti.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ffcdc18d
    • M
      USB: hub.c loops forever on resume from ram due to bluetooth · 55e5fdfa
      Mark Lord 提交于
      Okay, found it.  The root cause here was a missing CONFIG_USB_SUSPEND=y,
      which means the hci_usb device never got marked as USB_STATE_SUSPENDED,
      which then caused the loop to go on forever.
      
      The system works fine now with CONFIG_USB_SUSPEND=y in the .config.
      
      Here's the patch to prevent future lockups for this or other causes.
      I no longer need it, but it does still seem a good idea.
      Signed-off-by: NMark Lord <mlord@pobox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      55e5fdfa
    • A
      USB: Make device reset stop retrying after disconnect · dd4dd19e
      Alan Stern 提交于
      This patch (as898) changes the port reset code in the hub driver.  If
      a connect change occurs, it is reported the same way as a disconnect
      (which of course is what it really is).
      
      It also changes usb_reset_device(), to prevent the routine from futilely
      retrying the reset after a disconnect has occurred.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      dd4dd19e
    • A
      USB: add RESET_RESUME device quirk · 6bc6cff5
      Alan Stern 提交于
      This patch (as888) adds a new USB device quirk for devices which are
      unable to resume correctly.  By using the new code added for the
      USB-persist facility, it is a simple matter to reset these devices
      instead of resuming them.  To get things kicked off, a quirk entry is
      added for the Philips PSC805.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6bc6cff5
    • A
      USB: add USB-Persist facility · 0458d5b4
      Alan Stern 提交于
      This patch (as886) adds the controversial USB-persist facility,
      allowing USB devices to persist across a power loss during system
      suspend.
      
      The facility is controlled by a new Kconfig option (with appropriate
      warnings about the potential dangers); when the option is off the
      behavior will remain the same as it is now.  But when the option is
      on, people will be able to use suspend-to-disk and keep their USB
      filesystems intact -- something particularly valuable for small
      machines where the root filesystem is on a USB device!
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0458d5b4
    • A
      USB: make hub driver's release more robust · e8054854
      Alan Stern 提交于
      This revised patch (as893c) improves the method used by the hub driver
      to release its private data structure.  The current code is non-robust,
      relying on a memory region not getting reused by another driver after
      it has been freed.  The patch adds a reference count to the structure,
      resolving the question of when to release it.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e8054854
    • A
      USB: remove "locktree" routine from the hub driver · 06b84e8a
      Alan Stern 提交于
      This patch (as892) removes the "locktree" routine from the hub driver.
      It currently is used in only one place, by a single kernel thread;
      hence it isn't doing any good.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      06b84e8a
    • A
      USB: don't unsuspend for a new connection · 8adb4786
      Alan Stern 提交于
      This patch (as889) prevents the hub driver from trying to resume a
      port when there is a new connection.  For one thing, the resume is not
      needed -- the upcoming port reset will clear the suspend feature
      automatically.  For another, on some systems the resume fails and
      causes problems.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8adb4786