1. 08 1月, 2009 20 次提交
    • A
      USB: re-enable interface after driver unbinds · 2caf7fcd
      Alan Stern 提交于
      This patch (as1197) fixes an error introduced recently.  Since a
      significant number of devices can't handle Set-Interface requests, we
      no longer call usb_set_interface() when a driver unbinds from an
      interface, provided the interface is already in altsetting 0.  However
      the interface still does get disabled, and the call to
      usb_set_interface() was the only thing re-enabling it.  Since the
      interface doesn't get re-enabled, further attempts to use it fail.
      
      So the patch adds a call to usb_enable_interface() when a driver
      unbinds and the interface is in altsetting 0.  For this to work
      right, the interface's endpoints have to be re-enabled but their
      toggles have to be left alone.  Therefore an additional argument is
      added to usb_enable_endpoint() and usb_enable_interface(), a flag
      indicating whether or not the endpoint toggles should be reset.
      
      This is a forward-ported version of a patch which fixes Bugzilla
      #12301.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NDavid Roka <roka@dawid.hu>
      Reported-by: NErik Ekman <erik@kryo.se>
      Tested-by: NErik Ekman <erik@kryo.se>
      Tested-by: NAlon Bar-Lev <alon.barlev@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2caf7fcd
    • A
      USB: cancel pending Set-Config requests if userspace gets there first · df718962
      Alan Stern 提交于
      This patch (as1195) eliminates a potential problem identified by
      Oliver Neukum.  When a driver queues an asynchronous Set-Config
      request using usb_driver_set_configuration(), the request should be
      cancelled if userspace changes the configuration first.  The patch
      introduces a linked list of pending async Set-Config requests, and
      uses it to invalidate the requests for a particular device whenever
      that device's configuration is set.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Oliver Neukum <oliver@neukum.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      df718962
    • A
      USB: automatically enable wakeup for PCI host controllers · 6fd9086a
      Alan Stern 提交于
      This patch (as1193b) enables wakeup during initialization for all PCI
      host controllers, and it removes some code (and comments!) that are no
      longer needed now that the PCI core automatically initializes wakeup
      settings for all new devices.
      
      The idea is that the bus should initialize wakeup, and the bus glue
      or controller driver should enable it.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6fd9086a
    • A
      USB: fix up suspend and resume for PCI host controllers · a0d4922d
      Alan Stern 提交于
      This patch (as1192) rearranges the USB PCI host controller suspend and
      resume and resume routines:
      
      	Use pci_wake_from_d3() for enabling and disabling wakeup,
      	instead of pci_enable_wake().
      
      	Carry out the actual state change while interrupts are
      	disabled.
      
      	Change the order of the preparations to agree with the
      	general recommendation for PCI devices, instead of
      	messing around with the wakeup settings while the device
      	is in D3.
      
      		In .suspend:
      			Call the underlying driver to disable IRQ
      				generation;
      			pci_wake_from_d3(device_may_wakeup());
      			pci_disable_device();
      
      		In .suspend_late:
      			pci_save_state();
      			pci_set_power_state(D3hot);
      			(for PPC_PMAC) Disable ASIC clocks
      
      		In .resume_early:
      			(for PPC_PMAC) Enable ASIC clocks
      			pci_set_power_state(D0);
      			pci_restore_state();
      
      		In .resume:
      			pci_enable_device();
      			pci_set_master();
      			pci_wake_from_d3(0);
      			Call the underlying driver to reenable IRQ
      				generation
      
      	Add the necessary .suspend_late and .resume_early method
      	pointers to the PCI host controller drivers.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Rafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a0d4922d
    • O
      USB: extension of anchor API to unpoison an anchor · 856395d6
      Oliver Neukum 提交于
      This extension allows unpoisoning an anchor allowing drivers that
      resubmit URBs to reuse an anchor for methods like resume()
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      856395d6
    • M
      USB: mark "reject" field of struct urb as atomic_t · 49367d8f
      Ming Lei 提交于
      It is enough to protect accesses to reject field of urb
      by marking it as atomic_t,also it is the only reason of
      existence of usb_reject_lock,so remove the lock to make
      code more clean.
      Signed-off-by: NMing Lei <tom.leiming@gmail.com>
      Acked-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      49367d8f
    • 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
    • W
      USB: make printk messages more searchable · b9cef6c3
      Wu Fengguang 提交于
      USB: make printk messages more searchable
      
      Make USB printk messages long and straightforward.  One of these
      decorated USB error messages cost me non-trivial efforts to locate.
      Signed-off-by: NWu Fengguang <fengguang.wu@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b9cef6c3
    • 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: utilize round_jiffies_up_relative() · 4ec06d62
      Alan Stern 提交于
      This patch (as1178) uses the new round_jiffies_up_relative() routine
      for setting the autosuspend delayed_work timer.  It's appropriate
      since we don't care too much about the exact length of the delay, but
      we don't want it to be too short (rounded down).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4ec06d62
    • R
      USB: Don't use __module_param_call; use core_param. · 785895ff
      Rusty Russell 提交于
      Impact: cleanup
      
      Found this when I changed args to __module_param_call.  We now have
      core_param for exactly this, but Greg assures me "nousb" is used as a
      module parameter, so we need the #ifdef MODULE.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      785895ff
    • A
      USB: announce new devices earlier · 6cd13201
      Alan Stern 提交于
      This patch (as1166) changes usb_new_device().  Now new devices will be
      announced in the log _prior_ to being registered; this way the "new
      device" lines will appear before all the output from driver probing,
      which seems much more logical.
      
      Also, the patch adds a call to usb_stop_pm() to the failure pathway,
      so that the parent's count of unsuspended children will remain correct
      if registration fails.  In order for this to work properly, the code
      to increment that count has to be moved forward, before the first
      point where a failure can occur.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6cd13201
    • P
      USB: Allow usbmon as a module even if usbcore is builtin · f150fa1a
      Pete Zaitcev 提交于
      usbmon can only be built as a module if usbcore is a module too. Trivial
      changes to the relevant Kconfig and Makefile (and a few trivial changes
      elsewhere) allow usbmon to be built as a module even if usbcore is
      builtin.
      
      This is verified to work in all 9 permutations (3 correctly prohibited
      by Kconfig, 6 build a suitable result).
      Signed-off-by: NPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: NPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f150fa1a
    • I
      USB: Introduce usb_queue_reset() to do resets from atomic contexts · dc023dce
      Inaky Perez-Gonzalez 提交于
      This patch introduces a new call to be able to do a USB reset from an
      atomic contect. This is quite helpful in USB callbacks to handle
      errors (when the only thing that can be done is to do a device
      reset).
      
      It is done queuing a work struct that will do the actual reset. The
      struct is "attached" to an interface so pending requests from an
      interface are removed when said interface is unbound from the driver.
      
      The call flow then becomes:
      
      usb_queue_reset_device()
        __usb_queue_reset_device() [workqueue]
          usb_reset_device()
      
      usb_probe_interface()
        usb_cancel_queue_reset()      [error path]
      
      usb_unbind_interface()
        usb_cancel_queue_reset()
      
      usb_driver_release_interface()
        usb_cancel_queue_reset()
      
      Note usb_cancel_queue_reset() needs smarts to try not to unqueue when
      it is actually being executed. This happens when we run the reset from
      the workqueue: usb_reset_device() is called and on interface unbind
      time, usb_cancel_queue_reset() would be called. That would deadlock on
      cancel_work_sync(). To avoid that, we set (before running
      usb_reset_device()) usb_intf->reset_running and clear it inmediately
      after returning.
      
      Patch is against 2.6.28-rc2 and depends on
      http://marc.info/?l=linux-usb&m=122581634925308&w=2 (as submitted by
      Alan Stern).
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      dc023dce
    • A
      USB: add asynchronous autosuspend/autoresume support · 9ac39f28
      Alan Stern 提交于
      This patch (as1160b) adds support routines for asynchronous autosuspend
      and autoresume, with accompanying documentation updates.  There
      already are several potential users of this interface, and others are
      likely to arise as autosuspend support becomes more widespread.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9ac39f28
    • A
      USB: change interface to usb_lock_device_for_reset() · 011b15df
      Alan Stern 提交于
      This patch (as1161) changes the interface to
      usb_lock_device_for_reset().  The existing interface is apparently not
      very clear, judging from the fact that several of its callers don't
      use it correctly.  The new interface always returns 0 for success and
      it always requires the caller to unlock the device afterward.
      
      The new routine will not return immediately if it is called while the
      driver's probe method is running.  Instead it will wait until the
      probe is over and the device has been unlocked.  This shouldn't cause
      any problems; I don't know of any cases where drivers call
      usb_lock_device_for_reset() during probe.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      011b15df
    • P
      USB: Remove restrictions on signal numbers in devio.c · ff8973d9
      Phil Endecott 提交于
      Just over a year ago (!) I had this brief exchange with Alan Stern:
      
      >> It seems that the signal that can be used with USBDEVFS_DISCSIGNAL and 
      >> in usbdevfs_urb.signr is limited to the real-time signals SIGRTMIN to 
      >> SIGRTMAX. What's the rationale for this restriction? I believe that a 
      >> process can kill() itself with any signal number, can't it? I was 
      >> planning to use SIGIO for usbdevfs_urb.signr and SIGTERM (uncaught) for 
      >> USBDEVFS_DISCSIGNAL. I don't think I'll have a problem with using 
      >> SIGRTMIN+n instead, but I'm curious to know if there's some subtle 
      >> problem with the non-real-time signals that I should be aware of.
      >
      > I don't know of any reason for this restriction.
      
      Since no-one else could think of a reason either, I offer the following 
      patch which allows any signal to be used with USBDEVFS_DISCSIGNAL and 
      usbdevfs_urb.signr.
      Signed-off-by: NPhil Endecott <usbpatch@chezphil.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ff8973d9
    • 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
    • H
      USB: avoid needless address-taking of function parameters · da2bbdcc
      Harvey Harrison 提交于
      There's no need to take the address of the function params or local variables
      when the direct value byteswapping routines are available.
      Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      da2bbdcc
    • A
      USB: protect hcd.h from multiple inclusions · aa459e6a
      Anton Vorontsov 提交于
      This will let us use this header in other header files.
      Will be needed for the FHCI USB Host driver.
      Signed-off-by: NAnton Vorontsov <avorontsov@ru.mvista.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      aa459e6a
  2. 07 1月, 2009 1 次提交
    • R
      PM: Simplify the new suspend/hibernation framework for devices · adf09493
      Rafael J. Wysocki 提交于
      PM: Simplify the new suspend/hibernation framework for devices
      
      Following the discussion at the Kernel Summit, simplify the new
      device PM framework by merging 'struct pm_ops' and
      'struct pm_ext_ops' and removing pointers to 'struct pm_ext_ops'
      from 'struct platform_driver' and 'struct pci_driver'.
      
      After this change, the suspend/hibernation callbacks will only
      reside in 'struct device_driver' as well as at the bus type/
      device class/device type level.  Accordingly, PCI and platform
      device drivers are now expected to put their suspend/hibernation
      callbacks into the 'struct device_driver' embedded in
      'struct pci_driver' or 'struct platform_driver', respectively.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NPavel Machek <pavel@suse.cz>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      adf09493
  3. 06 1月, 2009 1 次提交
  4. 18 12月, 2008 1 次提交
  5. 14 11月, 2008 4 次提交
  6. 30 10月, 2008 2 次提交
    • A
      USB: prevent autosuspend during hub initialization · 61fbeba1
      Alan Stern 提交于
      This patch (as1153) fixes a potential problem in hub initialization.
      Starting in 2.6.28, initialization was split into several tasks to
      help speed up booting.  This opens the possibility that the hub may be
      autosuspended before all the initialization tasks can complete.
      
      Normally that wouldn't matter, but with incomplete initialization
      there is a risk that the hub would never autoresume -- especially if
      devices were plugged into the hub beforehand.  The solution is a
      simple one-line change to suppress autosuspend until the
      initialization is finished.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      61fbeba1
    • A
      USB: fix crash when URBs are unlinked after the device is gone · cde217a5
      Alan Stern 提交于
      This patch (as1151) protects usbcore against drivers that try to
      unlink an URB after the URB's device or bus have been removed.  The
      core does not currently check for this, and certain drivers can cause
      a crash if they are running while an HCD is unloaded.
      
      Certainly it would be best to fix the guilty drivers.  But a little
      defensive programming doesn't hurt, especially since it appears that
      quite a few drivers need to be fixed.
      
      The patch prevents the problem by grabbing a reference to the device
      while an unlink is in progress and using a new spinlock to synchronize
      unlinks with device removal.  (There's no need to acquire a reference
      to the bus as well, since the device structure itself keeps a
      reference to the bus.)  In addition, the kerneldoc is updated to
      indicate that URBs should not be unlinked after the disconnect method
      returns.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      cde217a5
  7. 23 10月, 2008 1 次提交
    • A
      USB: don't rebind drivers after failed resume or reset · 6c640945
      Alan Stern 提交于
      This patch (as1152) may help prevent some problems associated with the
      new policy of unbinding drivers that don't support suspend/resume or
      pre_reset/post_reset.  If for any reason the resume or reset fails, and
      the device is logically disconnected, there's no point in trying to
      rebind the driver.  So the patch checks for success before carrying
      out the unbind/rebind.
      
      There was a report from one user that this fixed a problem he was
      experiencing, but the details never became fully clear.  In any case,
      adding these tests can't hurt.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6c640945
  8. 18 10月, 2008 10 次提交