1. 20 7月, 2007 1 次提交
  2. 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
  3. 13 7月, 2007 15 次提交
    • 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
    • A
      USB: move bus_suspend and bus_resume method calls · b6f6436d
      Alan Stern 提交于
      This patch (as885) moves the root-hub bus_suspend() and bus_resume()
      method calls from the hub driver's suspend and resume methods into the
      usb_generic driver methods, where they make just as much sense.
      
      Their old locations were not fully correct.  For example, in a kernel
      compiled without CONFIG_USB_SUSPEND, if one were to do:
      
      	echo -n 1-0:1.0 >/sys/bus/usb/drivers/hub/unbind
      
      to unbind the hub driver from a root hub, there would then be no way
      to suspend that root hub.  Attempts to put the system to sleep would
      fail; the USB controller driver would refuse to suspend because the
      root hub was still active.
      
      The patch also makes a very slight change in the way devices with no
      driver are handled during suspend.  Rather than doing a standard USB
      port-suspend directly, now the suspend routine in usb_generic is
      called.  In practice this should never affect anyone.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b6f6436d
  4. 12 7月, 2007 1 次提交
    • R
      PM: Remove prev_state from struct dev_pm_info · 515c5357
      Rafael J. Wysocki 提交于
      The prev_state member of struct dev_pm_info (defined in include/linux/pm.h) is
      only used during a resume to check if the device's state before the suspend was
      'off', in which case the device is not resumed.  However, in such cases the
      decision whether or not to resume the device should be made on the driver level
      and the resume callbacks from the device's bus and class should be executed
      anyway (the may be needed for some things other than just powering on the
      device).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      515c5357
  5. 30 5月, 2007 1 次提交
    • A
      USB: replace flush_workqueue with cancel_sync_work · d5d4db70
      Alan Stern 提交于
      This patch (as912) replaces a couple of calls to flush_workqueue()
      with cancel_sync_work() and cancel_rearming_delayed_work().  Using a
      more directed approach allows us to avoid some nasty deadlocks.  The
      prime example occurs when a first-level device (the parent is a root
      hub) is removed while at the same time the root hub gets a remote
      wakeup request.  khubd would try to flush the autosuspend workqueue
      while holding the root-hub's lock, and the remote-wakeup workqueue
      routine would be waiting to lock the root hub.
      
      The patch also reorganizes the power management portion of
      usb_disconnect(), separating it out into its own routine.  The
      autosuspend workqueue entry is cancelled immediately instead of
      waiting for the device's release routine.  In addition,
      synchronization with the autosuspend thread is carried out even for
      root hubs (an oversight in the original code).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Greg KH <gregkh@suse.de>
      Cc: Mark Lord <lkml@rtr.ca>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d5d4db70
  6. 23 5月, 2007 2 次提交
  7. 09 5月, 2007 1 次提交
  8. 28 4月, 2007 4 次提交
    • A
      USB: add "last_busy" field for use in autosuspend · 1941044a
      Alan Stern 提交于
      This patch (as877) adds a "last_busy" field to struct usb_device, for
      use by the autosuspend framework.  Now if an autosuspend call comes at
      a time when the device isn't busy but hasn't yet been idle for long
      enough, the timer can be set to exactly the desired value.  And we
      will be ready to handle things like HID drivers, which can't maintain
      a useful usage count and must rely on the time-of-last-use to decide
      when to autosuspend.
      
      The patch also makes some related minor improvements:
      
      	Move the calls to the autosuspend condition-checking routine
      	into usb_suspend_both(), which is the only place where it
      	really matters.
      
      	If the autosuspend timer is already running, don't stop
      	and restart it.
      
      	Replace immediate returns with gotos so that the optional
      	debugging ouput won't be bypassed.
      
      	If autoresume is disabled but the device is already awake,
      	don't return an error for an autoresume call.
      
      	Don't try to autoresume a device if it isn't suspended.
      	(Yes, this undercuts the previous change -- so sue me.)
      
      	Don't duplicate existing code in the autosuspend work routine.
      
      	Fix the kerneldoc in usb_autopm_put_interface(): If an
      	autoresume call fails, the usage counter is left unchanged.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      1941044a
    • K
      USB: make usbdevices export their device nodes instead of using a separate class · 9f8b17e6
      Kay Sievers 提交于
      o The "real" usb-devices export now a device node which can
        populate /dev/bus/usb.
      
      o The usb_device class is optional now and can be disabled in the
        kernel config. Major/minor of the "real" devices and class devices
        are the same.
      
      o The environment of the usb-device event contains DEVNUM and BUSNUM to
        help udev and get rid of the ugly udev rule we need for the class
        devices.
      
      o The usb-devices and usb-interfaces share the same bus, so I used
        the new "struct device_type" to let these devices identify
        themselves. This also removes the current logic of using a magic
        platform-pointer.
        The name of the device_type is also added to the environment
        which makes it easier to distinguish the different kinds of devices
        on the same subsystem.
      
        It looks like this:
          add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1
          ACTION=add
          DEVPATH=/devices/pci0000:00/0000:00:1d.1/usb2/2-1
          SUBSYSTEM=usb
          SEQNUM=1533
          MAJOR=189
          MINOR=131
          DEVTYPE=usb_device
          PRODUCT=46d/c03e/2000
          TYPE=0/0/0
          BUSNUM=002
          DEVNUM=004
      
      This udev rule works as a replacement for usb_device class devices:
        SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \
          NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644"
      
      Updated patch, which needs the device_type patches in Greg's tree.
      
      I also got a bugzilla assigned for this. :)
        https://bugzilla.novell.com/show_bug.cgi?id=250659Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      9f8b17e6
    • A
      USB: separate autosuspend from external suspend · 6b157c9b
      Alan Stern 提交于
      This patch (as866) adds new entry points for external USB device
      suspend and resume requests, as opposed to internally-generated
      autosuspend or autoresume.  It also changes the existing
      remote-wakeup code paths to use the new routines, since remote wakeup
      is not the same as autoresume.
      
      As part of the change, it turns out to be necessary to do remote
      wakeup of root hubs from a workqueue.  We had been using khubd, but it
      does autoresume rather than an external resume.  Using the
      ksuspend_usb_wq workqueue for this purpose seemed a logical choice.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6b157c9b
    • D
      dev_dbg: check dev_dbg() arguments · 404d5b18
      Dan Williams 提交于
      Duplicate what Zach Brown did for pr_debug in commit
      8b2a1fd1
      
      [akpm@linux-foundation.org: fix a couple of things which broke]
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      404d5b18
  9. 10 3月, 2007 2 次提交
  10. 24 2月, 2007 1 次提交
  11. 17 2月, 2007 2 次提交
  12. 08 2月, 2007 1 次提交
  13. 23 1月, 2007 1 次提交
  14. 08 12月, 2006 3 次提交
  15. 06 12月, 2006 1 次提交
  16. 02 12月, 2006 3 次提交
    • A
      usbcore: remove unused argument in autosuspend · 94fcda1f
      Alan Stern 提交于
      Thanks to several earlier patches, usb_autosuspend_device() and
      usb_autoresume_device() are never called with a second argument other
      than 1.  This patch (as819) removes the now-redundant argument.
      
      It also consolidates some common code between those two routines,
      putting it into a new subroutine called usb_autopm_do_device().  And
      it includes a sizable kerneldoc update for the affected functions.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      94fcda1f
    • A
      USB: keep count of unsuspended children · ee49fb5d
      Alan Stern 提交于
      This patch (as818b) simplifies autosuspend processing by keeping track
      of the number of unsuspended children of each USB hub.  This will
      permit us to avoid a good deal of unnecessary work all the time; we
      will no longer have to create a bunch of workqueue entries to carry
      out autosuspend requests, only to have them fail because one of the
      hub's children isn't suspended.
      
      The basic idea is simple.  There already is a usage counter in the
      usb_device structure for preventing autosuspends.  The patch just
      increments that counter for every unsuspended child.  There's only one
      tricky part: When a device disconnects we need to remember whether it
      was suspended at the time (leave the counter alone) or not (decrement
      the counter).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ee49fb5d
    • A
      USB hub: simplify remote-wakeup handling · d25450c6
      Alan Stern 提交于
      This patch (as817) simplifies the remote-wakeup processing in the hub
      driver.  Now instead of using a specialized code path, it relies on
      the standard USB resume routines.  The hub_port_resume() function does
      an initial get_port_status() to see whether the port has already
      resumed itself (as it does when a remote-wakeup request is sent).
      This will slow down handling of other resume events slightly, but not
      enough to matter.
      
      The patch also changes the hub_port_status() routine, making it return
      an error if a short reply is received.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d25450c6