1. 22 8月, 2008 1 次提交
    • A
      USB: Add new PM callback methods for USB · f2189c47
      Alan Stern 提交于
      This patch (as1129) adds support for the new PM callbacks to usbcore.
      The new callbacks merely invoke the same old USB power management
      routines as the old ones did.
      
      A minor improvement is that the callbacks are present only in the
      "USB-device" device_type structure, rather than in the bus_type
      structure.  This way they will be invoked only for USB devices, not
      for USB interfaces.  The core USB PM routines automatically handle
      suspending and resuming interfaces along with their devices.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f2189c47
  2. 22 7月, 2008 2 次提交
    • A
      usbfs: send disconnect signals when device is unregistered · cd9f0375
      Alan Stern 提交于
      USB device files are accessible in two ways: as files in usbfs and as
      character device nodes.  The two paths are supposed to behave
      identically, but they don't.  When the underlying USB device is
      unplugged, disconnect signals are sent to processes with open usbfs
      files (if they requested these signals) but not to processes with open
      device node files.
      
      This patch (as1104) fixes the bug by moving the disconnect-signalling
      code into a common subroutine which is called from both paths.
      Putting this subroutine in devio.c removes the only out-of-file
      reference to struct dev_state, and so the structure's declaration can
      be moved from usb.h into devio.c.
      
      Finally, the new subroutine performs one extra action: It kills all
      the outstanding async URBs.  (I'd kill the outstanding synchronous
      URBs too, if there was any way to do it.)  In the past this hasn't
      mattered much, because devices were unregistered from usbfs only
      when they were disconnected.  But now the unregistration can also
      occur whenever devices are unbound from the usb_generic driver.  At
      any rate, killing URBs when a device is unregistered from usbfs seems
      like a good thing to do.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      cd9f0375
    • A
      USB: Force unbinding of drivers lacking reset_resume or other methods · 78d9a487
      Alan Stern 提交于
      This patch (as1024) takes care of a FIXME issue: Drivers that don't
      have the necessary suspend, resume, reset_resume, pre_reset, or
      post_reset methods will be unbound and their interface reprobed when
      one of the unsupported events occurs.
      
      This is made slightly more difficult by the fact that bind operations
      won't work during a system sleep transition.  So instead the code has
      to defer the operation until the transition ends.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      78d9a487
  3. 15 5月, 2008 1 次提交
    • A
      USB: create attributes before sending uevent · 2e5f10e4
      Alan Stern 提交于
      This patch (as1087d) fixes a long-standing problem in usbcore: Device,
      interface, and endpoint attributes aren't added until _after_ the
      creation uevent has already been broadcast.
      
      Unfortunately there are a few attributes which cannot be created that
      early.  The "descriptors" attribute is binary and so must be created
      separately.  The power-management attributes can't be created until
      the dev/power/ group exists.  And the interface string can vary from
      one altsetting to another, so it has to be created dynamically.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2e5f10e4
  4. 25 4月, 2008 1 次提交
  5. 02 2月, 2008 1 次提交
  6. 13 10月, 2007 3 次提交
    • 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
    • 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
  7. 13 7月, 2007 4 次提交
    • 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: 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
    • 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: interface PM state · 784a6e1c
      Alan Stern 提交于
      This patch (as880) strives to keep the PM core's idea of a USB
      interface's power state in synch with usbcore's own idea.  In the end
      this doesn't really matter, but it's better to be consistent.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      784a6e1c
  8. 28 4月, 2007 3 次提交
    • 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
    • A
      usbcore: move usb_autosuspend_work · 718efa64
      Alan Stern 提交于
      This patch (as864) moves the work routine for USB autosuspend from one
      source file to another.  This permits the removal of one whole global
      symbol (!) and should smooth the way for more changes in the future.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      718efa64
  9. 24 2月, 2007 4 次提交
  10. 02 12月, 2006 1 次提交
  11. 02 10月, 2006 1 次提交
  12. 29 9月, 2006 2 次提交
  13. 28 9月, 2006 13 次提交
    • G
      1b21d5e1
    • A
      usbcore: remove usb_suspend_root_hub · 02c399ee
      Alan Stern 提交于
      This patch (as740) removes the existing support for autosuspend of
      root hubs.  That support fit in rather awkwardly with the rest of
      usbcore and it was used only by ohci-hcd.  It won't be needed any more
      since the hub driver will take care of autosuspending all hubs, root
      or external.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      02c399ee
    • A
      usbcore: add autosuspend/autoresume infrastructure · 645daaab
      Alan Stern 提交于
      This patch (as739) adds the basic infrastructure for USB autosuspend
      and autoresume.  The main features are:
      
      	PM usage counters added to struct usb_device and struct
      	usb_interface, indicating whether it's okay to autosuspend
      	them or they are currently in use.
      
      	Flag added to usb_device indicating whether the current
      	suspend/resume operation originated from outside or as an
      	autosuspend/autoresume.
      
      	Flag added to usb_driver indicating whether the driver
      	supports autosuspend.  If not, no device bound to the driver
      	will be autosuspended.
      
      	Mutex added to usb_device for protecting PM operations.
      	Unlike the device semaphore, the locking rule for the pm_mutex
      	is that you must acquire the locks going _up_ the device tree.
      
      	New routines handling autosuspend/autoresume requests for
      	interfaces and devices.
      
      	Suspend and resume requests are propagated up the device tree
      	(but not outside the USB subsystem).
      
      	work_struct added to usb_device, for carrying out delayed
      	autosuspend requests.
      
      	Autoresume added (and autosuspend prevented) during probe and
      	disconnect.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      645daaab
    • A
      USB: Turn usb_resume_both() into static inline · 42d8a2d2
      Alexey Dobriyan 提交于
      drivers/usb/core/hub.c: In function `hub_events':
      drivers/usb/core/hub.c:2591: warning: statement with no effect
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      42d8a2d2
    • L
      USB core: Use const where possible. · 095bc335
      Luiz Fernando N. Capitulino 提交于
      This patch marks some USB core's functions parameters as const. This
      improves the design (we're saying to the caller that its parameter is
      not going to be modified) and may help in compiler's optimisation work.
      Signed-off-by: NLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      095bc335
    • L
      USB: Make file operations structs in drivers/usb const. · 066202dd
      Luiz Fernando N. Capitulino 提交于
      Making structs const prevents accidental bugs and with the proper debug
      options they're protected against corruption.
      Signed-off-by: NLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      066202dd
    • A
      hub driver: improve use of #ifdef · d388dab7
      Alan Stern 提交于
      This patch (as736) makes the hub driver more readable by improving the
      usage of "#ifdef CONFIG_PM" and "#ifdef CONFIG_USB_SUSPEND".
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d388dab7
    • A
      usbcore: track whether interfaces are suspended · 4d064c08
      Alan Stern 提交于
      Currently we rely on intf->dev.power.power_state.event for tracking
      whether intf is suspended.  This is not a reliable technique because
      that value is owned by the PM core, not by usbcore.  This patch (as718b)
      adds a new flag so that we can accurately tell which interfaces are
      suspended and which aren't.
      
      At first one might think these flags aren't needed, since interfaces
      will be suspended along with their devices.  It turns out there are a
      couple of intermediate situations where that's not quite true, such as
      while processing a remote-wakeup request.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4d064c08
    • A
      usbcore: resume device resume recursion · a8e7c565
      Alan Stern 提交于
      This patch (as717b) removes the existing recursion in hub resume code:
      Resuming a hub will no longer automatically resume the devices attached
      to the hub.
      
      At the same time, it adds one level of recursion: Suspending a USB
      device will automatically suspend all the device's interfaces.  Failure
      at an intermediate stage will cause all the already-suspended interfaces
      to be resumed. Attempts to suspend or resume an interface by itself will
      do nothing, although they won't return an error.  Thus the regular
      system-suspend and system-resume procedures should continue to work as
      before; only runtime PM will be affected.
      
      The patch also removes the code that tests state of the interfaces
      before suspending a device.  It's no longer needed, since everything
      gets suspended together.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a8e7c565
    • A
      usbcore: add usb_device_driver definition · 8bb54ab5
      Alan Stern 提交于
      This patch (as732) adds a usb_device_driver structure, for representing
      drivers that manage an entire USB device as opposed to just an
      interface.  Support routines like usb_register_device_driver,
      usb_deregister_device_driver, usb_probe_device, and usb_unbind_device
      are also added.
      
      Unlike an earlier version of this patch, the new code is type-safe.  To
      accomplish this, the existing struct driver embedded in struct
      usb_driver had to be wrapped in an intermediate wrapper.  This enables
      the core to tell at runtime whether a particular struct driver belongs
      to a device driver or to an interface driver.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8bb54ab5
    • A
      usbcore: move code among source files · 36e56a34
      Alan Stern 提交于
      This revised patch (as713b) moves a few routines among source files in
      usbcore.  Some driver-related code in usb.c (claiming interfaces and
      matching IDs) is moved to driver.c, where it belongs.  Also the
      usb_generic stuff in driver.c is moved to a new source file: generic.c.
      (That's the reason for revising the patch.)  Although not very big now,
      it will get bigger in a later patch.
      
      None of the code has been changed; it has only been re-arranged.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      36e56a34
    • A
      usbcore: rename usb_suspend_device to usb_port_suspend · 140d8f68
      Alan Stern 提交于
      This revised patch (as715b) renames usb_suspend_device to
      usb_port_suspend, usb_resume_device to usb_port_resume, and
      finish_device_resume to finish_port_resume.  There was no objection to
      the original version of the patch so this should be okay to apply.
      
      The revision was needed only because I have re-arranged the order of the
      earlier patches.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      140d8f68
    • A
      usbfs: private mutex for open, release, and remove · 4a2a8a2c
      Alan Stern 提交于
      The usbfs code doesn't provide sufficient mutual exclusion among open,
      release, and remove.  Release vs. remove is okay because they both
      acquire the device lock, but open is not exclusive with either one.  All
      three routines modify the udev->filelist linked list, so they must not
      run concurrently.
      
      Apparently someone gave this a minimum amount of thought in the past by
      explicitly acquiring the BKL at the start of the usbdev_open routine.
      Oddly enough, there's a comment pointing out that locking is unnecessary
      because chrdev_open already has acquired the BKL.
      
      But this ignores the point that the files in /proc/bus/usb/* are not
      char device files; they are regular files and so they don't get any
      special locking.  Furthermore it's necessary to acquire the same lock in
      the release and remove routines, which the code does not do.
      
      Yet another problem arises because the same file_operations structure is
      accessible through both the /proc/bus/usb/* and /dev/usb/usbdev* file
      nodes.  Even when one of them has been removed, it's still possible for
      userspace to open the other.  So simple locking around the individual
      remove routines is insufficient; we need to lock the entire
      usb_notify_remove_device notifier chain.
      
      Rather than rely on the BKL, this patch (as723) introduces a new private
      mutex for the purpose.  Holding the BKL while invoking a notifier chain
      doesn't seem like a good idea.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4a2a8a2c
  14. 01 7月, 2006 1 次提交
  15. 22 6月, 2006 2 次提交