1. 11 7月, 2012 1 次提交
  2. 14 6月, 2012 1 次提交
    • B
      USB: allow match on bInterfaceNumber · 81df2d59
      Bjørn Mork 提交于
      Some composite USB devices provide multiple interfaces
      with different functions, all using "vendor-specific"
      for class/subclass/protocol.  Another OS use interface
      numbers to match the driver and interface. It seems
      these devices are designed with that in mind - using
      static interface numbers for the different functions.
      
      This adds support for matching against the
      bInterfaceNumber, allowing such devices to be supported
      without having to resort to testing against interface
      number whitelists and/or blacklists in the probe.
      Signed-off-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      81df2d59
  3. 15 5月, 2012 1 次提交
    • A
      sysfs: get rid of some lockdep false positives · 356c05d5
      Alan Stern 提交于
      This patch (as1554) fixes a lockdep false-positive report.  The
      problem arises because lockdep is unable to deal with the
      tree-structured locks created by the device core and sysfs.
      
      This particular problem involves a sysfs attribute method that
      unregisters itself, not from the device it was called for, but from a
      descendant device.  Lockdep doesn't understand the distinction and
      reports a possible deadlock, even though the operation is safe.
      
      This is the sort of thing that would normally be handled by using a
      nested lock annotation; unfortunately it's not feasible to do that
      here.  There's no sensible way to tell sysfs when attribute removal
      occurs in the context of a parent attribute method.
      
      As a workaround, the patch adds a new flag to struct attribute
      telling sysfs not to inform lockdep when it acquires a readlock on a
      sysfs_dirent instance for the attribute.  The readlock is still
      acquired, but lockdep doesn't know about it and hence does not
      complain about impossible deadlock scenarios.
      
      Also added are macros for static initialization of attribute
      structures with the ignore_lockdep flag set.  The three offending
      attributes in the USB subsystem are converted to use the new macros.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NTejun Heo <tj@kernel.org>
      CC: Eric W. Biederman <ebiederm@xmission.com>
      CC: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      356c05d5
  4. 10 2月, 2012 1 次提交
  5. 04 1月, 2012 1 次提交
  6. 27 9月, 2011 1 次提交
  7. 30 4月, 2011 1 次提交
  8. 17 11月, 2010 2 次提交
  9. 22 5月, 2010 1 次提交
  10. 21 5月, 2010 2 次提交
  11. 03 3月, 2010 6 次提交
    • A
      USB: change handling of negative autosuspend delays · 5899f1e0
      Alan Stern 提交于
      This patch (as1327) changes the way negative autosuspend delays
      prevent device from autosuspending.  The current code checks for
      negative values explicitly in the autosuspend_check() routine.  The
      updated code keeps things from getting that far by using
      usb_autoresume_device() to increment the usage counter when a negative
      delay is set, and by using usb_autosuspend_device() to decrement the
      usage counter when a non-negative delay is set.
      
      This complicates the set_autosuspend() attribute method code slightly,
      but it will reduce the overall power management overhead.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5899f1e0
    • A
      USB: implement usb_enable_autosuspend · 088f7fec
      Alan Stern 提交于
      This patch (as1326) adds usb_enable_autosuspend() and
      usb_disable_autosuspend() routines for use by drivers.  If a driver
      knows that its device can handle suspends and resumes correctly, it
      can enable autosuspend all by itself.  This is equivalent to the user
      writing "auto" to the device's power/level attribute.
      
      The implementation differs slightly from what it used to be.  Now
      autosuspend is disabled simply by doing usb_autoresume_device() (to
      increment the usage counter) and enabled by doing
      usb_autosuspend_device() (to decrement the usage counter).
      
      The set_level() attribute method is updated to use the new routines,
      and the USB Power-Management documentation is updated.
      
      The patch adds a usb_enable_autosuspend() call to the hub driver's
      probe routine, allowing the special-case code for hubs in quirks.c to
      be removed.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      088f7fec
    • A
      USB: use the device lock for persist_enabled · 0c4db6df
      Alan Stern 提交于
      This patch (as1325) changes the locking for the persist_enabled flag
      in struct usb_device.  Now it is protected by the device lock, along
      with all its neighboring bit flags, instead of the PM lock (which is
      about to vanish anyway).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0c4db6df
    • A
      USB: change locking for device-level autosuspend · 62e299e6
      Alan Stern 提交于
      This patch (as1323) changes the locking requirements for
      usb_autosuspend_device(), usb_autoresume_device(), and
      usb_try_autosuspend_device().  This isn't a very important change;
      mainly it's meant to make the locking more uniform.
      
      The most tricky part of the patch involves changes to usbdev_open().
      To avoid an ABBA locking problem, it was necessary to reduce the
      region protected by usbfs_mutex.  Since that mutex now protects only
      against simultaneous open and remove, this posed no difficulty -- its
      scope was larger than necessary.
      
      And it turns out that usbfs_mutex is no longer needed in
      usbdev_release() at all.  The list of usbfs "ps" structures is now
      protected by the device lock instead of by usbfs_mutex.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      62e299e6
    • G
      USB: rename USB_SPEED_VARIABLE to USB_SPEED_WIRELESS · 551cdbbe
      Greg Kroah-Hartman 提交于
      It's really the wireless speed, so rename the thing to make
      more sense.  Based on a recommendation from David Vrabel
      
      Cc: David Vrabel <david.vrabel@csr.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      551cdbbe
    • O
      USB: Export QUIRK_RESET_MORPHS through sysfs · ef955341
      Oliver Neukum 提交于
      Some devices which use mode switching revert to their
      primary mode as they are reset. They must not be reset for
      error handling. As user spaces makes the switch it also
      has to tell the kernel that a device is quirky.
      Signed-off-by: NOliver Neukum <oliver@neukum.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ef955341
  12. 21 1月, 2010 1 次提交
  13. 24 12月, 2009 1 次提交
    • A
      USB: fix bugs in usb_(de)authorize_device · da307123
      Alan Stern 提交于
      This patch (as1315) fixes some bugs in the USB core authorization
      code:
      
      	usb_deauthorize_device() should deallocate the device strings
      	instead of leaking them, and it should invoke
      	usb_destroy_configuration() (which does proper reference
      	counting) instead of freeing the config information directly.
      
      	usb_authorize_device() shouldn't change the device strings
      	until it knows that the authorization will succeed, and it should
      	autosuspend the device at the end (having autoresumed the
      	device at the start).
      
      	Because the device strings can be changed, the sysfs routines
      	to display the strings must protect the string pointers by
      	locking the device.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Inaky Perez-Gonzalez <inaky@linux.intel.com>
      Acked-by: NDavid Vrabel <david.vrabel@csr.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      da307123
  14. 12 12月, 2009 3 次提交
    • A
      USB: prepare for changover to Runtime PM framework · 8e4ceb38
      Alan Stern 提交于
      This patch (as1303) revises the USB Power Management infrastructure to
      make it compatible with the new driver-model Runtime PM framework:
      
      	Drivers are no longer allowed to access intf->pm_usage_cnt
      	directly; the PM framework manages its own usage counters.
      
      	usb_autopm_set_interface() is eliminated, because it directly
      	sets intf->pm_usage_cnt.
      
      	usb_autopm_enable() and usb_autopm_disable() are eliminated,
      	because they call usb_autopm_set_interface().
      
      	usb_autopm_get_interface_no_resume() and
      	usb_autopm_put_interface_no_suspend() are added.  They
      	correspond to pm_runtime_get_noresume() and
      	pm_runtime_put_noidle() in the PM framework.
      
      	The power/level attribute no longer accepts "suspend", only
      	"on" and "auto".  The PM framework doesn't allow devices to be
      	forced into a suspended mode.
      
      The hub driver contains the only code that violates the new
      guidelines.  It is updated to use the new interface routines instead.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8e4ceb38
    • G
      USB: add devpath sysfs attribute · 9af23624
      Greg Kroah-Hartman 提交于
      This is not exported from the usb core, yet we rely on it to create
      paths to interfaces for this device in sysfs.  Export it to make
      userspace tools have an easier time to figure things out.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9af23624
    • A
      USB: add a "remove hardware" sysfs attribute · 253e0572
      Alan Stern 提交于
      This patch (as1297) adds a "remove" attribute to each USB device's
      directory in sysfs.  Writing to this attribute causes the device to be
      deconfigured (the same as writing 0 to the "bConfigurationValue"
      attribute) and then tells the hub driver to disable the device's
      upstream port.  The device remains locked during these activities so
      there is no possibility of it getting reconfigured in between.  The
      port will remain disabled until after the device is unplugged.
      
      The purpose of this is to provide a means for user programs to imitate
      the "Safely remove hardware" applet in Windows.  Some devices do
      expect their ports to be disabled before they are unplugged, and they
      provide visual feedback to users indicating when they can safely be
      unplugged.
      
      The security implications are minimal.  Writing to the "remove"
      attribute is no more dangerous than writing to the
      "bConfigurationValue" attribute.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: David Zeuthen <davidz@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      253e0572
  15. 16 9月, 2009 1 次提交
  16. 16 6月, 2009 1 次提交
  17. 25 3月, 2009 1 次提交
  18. 08 1月, 2009 3 次提交
    • A
      USB: utilize the bus notifiers · 3b23dd6f
      Alan Stern 提交于
      This patch (as1185) makes usbcore take advantage of the bus
      notifications sent out by the driver core.  Now we can create all our
      device and interface attribute files before the device or interface
      uevent is broadcast.
      
      A side effect is that we no longer create the endpoint "pseudo"
      devices at the same time as a device or interface is registered -- it
      seems like a bad idea to try registering an endpoint before the
      registration of its parent is complete.  So the routines for creating
      and removing endpoint devices have been split out and renamed, and
      they are called explicitly when needed.  A new bitflag is used for
      keeping track of whether or not the interface's endpoint devices have
      been created, since (just as with the interface attributes) they vary
      with the altsetting and hence can be changed at random times.
      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>
      3b23dd6f
    • A
      USB: Enhance usage of pm_message_t · 65bfd296
      Alan Stern 提交于
      This patch (as1177) modifies the USB core suspend and resume
      routines.  The resume functions now will take a pm_message_t argument,
      so they will know what sort of resume is occurring.  The new argument
      is also passed to the port suspend/resume and bus suspend/resume
      routines (although they don't use it for anything but debugging).
      
      In addition, special pm_message_t values are used for user-initiated,
      device-initiated (i.e., remote wakeup), and automatic suspend/resume.
      By testing these values, drivers can tell whether or not a particular
      suspend was an autosuspend.  Unfortunately, they can't do the same for
      resumes -- not until the pm_message_t argument is also passed to the
      drivers' resume methods.  That will require a bigger change.
      
      IMO, the whole Power Management framework should have been set up this
      way in the first place.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      65bfd296
    • A
      USB: straighten out inline code in sysfs.c · 92b0da15
      Alan Stern 提交于
      This patch (as1156) straightens out some code in usbcore.  The
      usb_create_intf_ep_files() and usb_remove_intf_ep_files() routines
      don't need to be separate inlines; they should be moved bodily into
      the places where they get used.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      92b0da15
  19. 14 11月, 2008 1 次提交
    • A
      USB: don't register endpoints for interfaces that are going away · 352d0263
      Alan Stern 提交于
      This patch (as1155) fixes a bug in usbcore.  When interfaces are
      deleted, either because the device was disconnected or because of a
      configuration change, the extra attribute files and child endpoint
      devices may get left behind.  This is because the core removes them
      before calling device_del().  But during device_del(), after the
      driver is unbound the core will reinstall altsetting 0 and recreate
      those extra attributes and children.
      
      The patch prevents this by adding a flag to record when the interface
      is in the midst of being unregistered.  When the flag is set, the
      attribute files and child devices will not be created.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org> [2.6.27, 2.6.26, 2.6.25]
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      352d0263
  20. 18 10月, 2008 1 次提交
  21. 30 5月, 2008 1 次提交
    • A
      USB: add all configs to the "descriptors" attribute · 217a9081
      Alan Stern 提交于
      This patch (as1094) changes the output of the "descriptors" binary
      attribute.  Now it will contain the device descriptor followed by all
      the configuration descriptors, not just the descriptor for the current
      config.
      
      Userspace libraries want to have access to the kernel's cached
      descriptor information, so they can learn about device characteristics
      without having to wake up suspended devices.  So far the only user of
      this attribute is the new libusb-1.0 library; thus changing its
      contents shouldn't cause any problems.
      
      This should be considered for 2.6.26, if for no other reason than to
      minimize the range of releases in which the attribute contains only the
      current config descriptor.
      
      Also, it doesn't hurt that the patch removes the device locking --
      which was formerly needed in order to know for certain which config was
      indeed current.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      217a9081
  22. 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
  23. 25 4月, 2008 1 次提交
  24. 02 2月, 2008 2 次提交
    • G
      USB: fix codingstyle issues in drivers/usb/core/*.c · 2c044a48
      Greg Kroah-Hartman 提交于
      Fixes a number of coding style issues in the remaining .c files in
      drivers/usb/core/
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2c044a48
    • S
      USB: Export suspend statistics · 15123006
      Sarah Sharp 提交于
      This patch exports two statistics to userspace:
      /sys/bus/usb/device/.../power/connected_duration
      /sys/bus/usb/device/.../power/active_duration
      
      connected_duration is the total time (in msec) that the device has
      been connected.  active_duration is the total time the device has not
      been suspended.  With these two statistics, tools like PowerTOP can
      calculate the percentage time that a device is active, i.e. not
      suspended or auto-suspended.
      
      Users can also use the active_duration to check if a device is actually
      autosuspended.  Currently, they can set power/level to auto and
      power/autosuspend to a positive timeout, but there's no way to know from
      userspace if a device was actually autosuspended without looking at the
      dmesg output.  These statistics will be useful in creating an automated
      userspace script to test autosuspend for USB devices.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      15123006
  25. 29 11月, 2007 1 次提交
  26. 13 10月, 2007 2 次提交
  27. 20 7月, 2007 1 次提交
    • A
      USB: add "descriptors" binary sysfs attribute · 69d42a78
      Alan Stern 提交于
      This patch (as934) adds a new readonly binary sysfs attribute file
      called "descriptors" for each USB device.  The attribute contains the
      device descriptor followed by the raw descriptor entry (config plug
      subsidiary descriptors) for the current configuration.
      
      Having this information available in fixed-format binary makes life a
      lot easier for user programs by avoiding the need to open, read, and
      parse multiple sysfs text files.
      
      The information in this attribute file is much like that in usbfs's
      device file, but there are some significant differences:
      
      	The 2-byte fields in the device descriptor are left in
      	little-endian byte order, as they appear on the bus and
      	in the kernel.
      
      	Only one raw descriptor set is presented, that of the
      	current configuration.
      
      	Opening this file will not cause a suspended device to be
      	autoresumed.
      
      The last item in particular should be a big selling point for libusb,
      which currently forces all USB devices to be resumed as it scans the
      device tree.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Dave Mielke <dave@mielke.cc>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      69d42a78