1. 22 7月, 2008 2 次提交
  2. 07 7月, 2008 1 次提交
  3. 04 7月, 2008 1 次提交
    • S
      USB: fix interrupt disabling for HCDs with shared interrupt handlers · de85422b
      Stefan Becker 提交于
      USB: fix interrupt disabling for HCDs with shared interrupt handlers
      
      As has been discussed several times on LKML, IRQF_SHARED | IRQF_DISABLED
      doesn't work reliably, i.e. a shared interrupt handler CAN'T be certain to
      be called with interrupts disabled. Most USB HCD handlers use IRQF_DISABLED
      and therefore havoc can break out if they share their interrupt with a
      handler that doesn't use it.
      
      On my test machine the yenta_socket interrupt handler (no IRQF_DISABLED)
      was registered before ehci_hcd and one uhci_hcd instance. Therefore all
      usb_hcd_irq() invocations for ehci_hcd and for one uhci_hcd instance
      happened with interrupts enabled. That led to random lockups as USB core
      HCD functions that acquire the same spinlock could be called twice
      from interrupt handlers.
      
      This patch updates usb_hcd_irq() to always disable/restore interrupts.
      usb_add_hcd() will silently remove any IRQF_DISABLED requested from HCD code.
      Signed-off-by: NStefan Becker <stefan.becker@nokia.com>
      Cc: stable <stable@kernel.org>
      Acked-by: NDavid Brownell <david-b@pacbell.net>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      de85422b
  4. 21 5月, 2008 1 次提交
    • G
      USB: Core: fix race in device_create · c013d040
      Greg Kroah-Hartman 提交于
      There is a race from when a device is created with device_create() and
      then the drvdata is set with a call to dev_set_drvdata() in which a
      sysfs file could be open, yet the drvdata will be NULL, causing all
      sorts of bad things to happen.
      
      This patch fixes the problem by using the new function,
      device_create_drvdata().
      
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      c013d040
  5. 25 4月, 2008 3 次提交
  6. 02 2月, 2008 4 次提交
  7. 29 11月, 2007 1 次提交
  8. 02 11月, 2007 1 次提交
  9. 13 10月, 2007 18 次提交
    • S
      USB: Export URB statistics for powertop · 4d59d8a1
      Sarah Sharp 提交于
      powertop currently tracks interrupts generated by uhci, ehci, and ohci,
      but it has no way of telling which USB device to blame USB bus activity on.
      This patch exports the number of URBs that are submitted for a given device.
      Cat the file 'urbnum' in /sys/bus/usb/devices/.../
      Signed-off-by: NSarah Sharp <sarah.a.sharp@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4d59d8a1
    • 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: break apart flush_endpoint and disable_endpoint · 95cf82f9
      Alan Stern 提交于
      This patch (as988) breaks usb_hcd_endpoint_disable() apart into two
      routines.  The first, usb_hcd_flush_endpoint() does the -ESHUTDOWN
      unlinking of all URBs in the endpoint's queue and waits for them to
      complete.  The second, usb_hcd_disable_endpoint() -- renamed for
      better grammatical style -- merely calls the HCD's endpoint_disable
      method.  The changeover is easy because the routine currently has only
      one caller.
      
      This separation of function will be exploited in the following patch:
      When a device is suspended, the core will be able to cancel all
      outstanding URBs for that device while leaving the HCD's
      endpoint-related data structures intact for later.
      
      As an added benefit, HCDs no longer need to check for existing URBs in
      their endpoint_disable methods.  It is now guaranteed that there will
      be none.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      95cf82f9
    • A
      USB: Eliminate urb->status usage! · 4a00027d
      Alan Stern 提交于
      This patch (as979) removes the last vestiges of urb->status from the
      host controller drivers and the root-hub emulator.  Now the field
      doesn't get set until just before the URB's completion routine is
      called.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      CC: Olav Kongas <ok@artecdesign.ee>
      CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
      CC: Tony Olech <tony.olech@elandigitalsystems.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4a00027d
    • A
      USB: reorganize urb->status use in usbmon · 9347d51c
      Alan Stern 提交于
      This patch (as978) reorganizes the way usbmon uses urb->status.  It
      now accepts the status value as an argument.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9347d51c
    • A
      USB: fix mistake in usb_hcd_giveback_urb · 1f5a3d0f
      Alan Stern 提交于
      This patch (as971) fixes a small mistake: The URB's completion status
      needs to be adjusted before the URB is passed to usmon_urb_complete(),
      not afterward.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      1f5a3d0f
    • A
      USB: add urb->unlinked field · eb231054
      Alan Stern 提交于
      This patch (as970) adds a new urb->unlinked field, which is used to
      store the status of unlinked URBs since we can't use urb->status for
      that purpose any more.  To help simplify the HCDs, usbcore will check
      urb->unlinked before calling the completion handler; if the value is
      set it will automatically override the status reported by the HCD.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      CC: Olav Kongas <ok@artecdesign.ee>
      CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
      CC: Tony Olech <tony.olech@elandigitalsystems.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      eb231054
    • A
      USB: centralize -EREMOTEIO handling · b0d9efba
      Alan Stern 提交于
      This patch (as969) continues the ongoing changes to the way HCDs
      report URB statuses.  The programming interface has been simplified by
      making usbcore responsible for clearing urb->hcpriv and for setting
      -EREMOTEIO status when an URB with the URB_SHORT_NOT_OK flag ends up
      as a short transfer.
      
      By moving the work out of the HCDs, this removes a fair amount of
      repeated code.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      CC: Olav Kongas <ok@artecdesign.ee>
      CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
      CC: Tony Olech <tony.olech@elandigitalsystems.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b0d9efba
    • A
      USB: make HCDs responsible for managing endpoint queues · e9df41c5
      Alan Stern 提交于
      This patch (as954) implements a suggestion of David Brownell's.  Now
      the host controller drivers are responsible for linking and unlinking
      URBs to/from their endpoint queues.  This eliminates the possiblity of
      strange situations where usbcore thinks an URB is linked but the HCD
      thinks it isn't.  It also means HCDs no longer have to check for URBs
      being dequeued before they were fully enqueued.
      
      In addition to the core changes, this requires changing every host
      controller driver and the root-hub URB handler.  For the most part the
      required changes are fairly small; drivers have to call
      usb_hcd_link_urb_to_ep() in their urb_enqueue method,
      usb_hcd_check_unlink_urb() in their urb_dequeue method, and
      usb_hcd_unlink_urb_from_ep() before giving URBs back.  A few HCDs make
      matters more complicated by the way they split up the flow of control.
      
      In addition some method interfaces get changed.  The endpoint argument
      for urb_enqueue is now redundant so it is removed.  The unlink status
      is required by usb_hcd_check_unlink_urb(), so it has been added to
      urb_dequeue.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: David Brownell <david-b@pacbell.net>
      CC: Olav Kongas <ok@artecdesign.ee>
      CC: Tony Olech <tony.olech@elandigitalsystems.com>
      CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e9df41c5
    • I
      usb: cleanup usb_register_bus() and hook up sysfs group · eb579f58
      Inaky Perez-Gonzalez 提交于
      This path cleans the exit paths of usb_register_bus() [to use a goto
      schema], maximum line length (keeping it under ~75).
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      eb579f58
    • I
      usb: add the concept of default authorization to USB hosts · 5234ce1b
      Inaky Perez-Gonzalez 提交于
      This introduces /sys/bus/devices/usb*/authorized_default; it dictates
      what is going to be the default authorization state for devices
      connected to the host. User space can set that using the sysfs file.
      
      We hook to the root hub instead of to the device controller as it is
      quite easy to get to it in sysfs from the device structure (device
      5-4.3 is usb5) vs. backtracking to the controller device.
      
      By default it is set to be 'authorized' (!0) for normal, wired USB
      devices and 'unauthorized' (0) for Wireless USB devices.
      
      As suggested by Adrian Bunk, make authorized_default static
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5234ce1b
    • A
      USB: separate out endpoint queue management and DMA mapping routines · 9a9bf406
      Alan Stern 提交于
      This patch (as953) separates out three key portions from
      usb_hcd_submit_urb(), usb_hcd_unlink_urb(), and usb_hcd_giveback_urb()
      and puts them in separate functions of their own.  In the next patch,
      these functions will be called directly by host controller drivers
      while holding their private spinlocks, which will remove the
      possibility of some unpleasant races.
      
      The code responsible for mapping and unmapping DMA buffers is also
      placed into a couple of separate subroutines, for the sake of
      cleanliness and consistency.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9a9bf406
    • A
      USB: update spinlock usage for root-hub URBs · 9439eb94
      Alan Stern 提交于
      This patch (as952) adjusts the spinlock usage in the root-hub
      emulation part of usbcore, to make it match more closely the pattern
      used by regular host controller drivers.  To wit: The private lock
      (usb_hcd_root_hub_lock) is held throughout the important parts, and it
      is dropped temporarily without re-enabling interrupts around the call
      to usb_hcd_giveback_urb().
      
      A nice side effect is that the code now avoids calling
      local_irq_save(), thereby becoming more RT-friendly.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9439eb94
    • A
      USB: cleanup for previous patches · d617bc83
      Alan Stern 提交于
      This patch (as951) cleans up a few loose ends from earlier patches.
      Redundant checks for non-NULL urb->dev are removed, as are checks of
      urb->dev->bus (which can never be NULL).  Conversely, a check for
      non-NULL urb->ep is added to the unlink paths.
      
      A homegrown round-down-to-power-of-2 loop is simplified by using the
      ilog2 routine.  The comparison in usb_urb_dir_in() is made more
      transparent.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d617bc83
    • A
      USB: avoid using urb->pipe in usbcore · 5e60a161
      Alan Stern 提交于
      This patch (as946) eliminates many of the uses of urb->pipe in
      usbcore.  Unfortunately there will have to be a significant API
      change, affecting all USB drivers, before we can remove it entirely.
      This patch contents itself with changing only the interface to
      usb_buffer_map_sg() and friends: The pipe argument is replaced with a
      direction flag.  That can be done easily because those routines get
      used in only one place.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5e60a161
    • A
      USB: add direction bit to urb->transfer_flags · fea34091
      Alan Stern 提交于
      This patch (as945) adds a bit to urb->transfer_flags for recording the
      direction of the URB.  The bit is set/cleared automatically in
      usb_submit_urb() so drivers don't have to worry about it (although as
      a result, it isn't valid until the URB has been submitted).  Inline
      routines are added for easily checking an URB's direction.  They
      replace calls to usb_pipein in the DMA-mapping parts of hcd.c.
      
      For non-control endpoints, the direction is determined directly from
      the endpoint descriptor.  However control endpoints are
      bi-directional; for them the direction is determined from the
      bRequestType byte and the wLength value in the setup packet.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      fea34091
    • 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
    • A
      USB: add urb->ep · 5b653c79
      Alan Stern 提交于
      This patch (as943) prepares the way for eliminating urb->pipe by
      introducing an endpoint pointer into struct urb.  For now urb->ep
      is set by usb_submit_urb() from the pipe value; eventually drivers
      will set it themselves and we will remove urb->pipe completely.
      
      The patch also adds new inline routines to retrieve an endpoint
      descriptor's number and transfer type, essentially as replacements for
      usb_pipeendpoint and usb_pipetype.
      
      usb_submit_urb(), usb_hcd_submit_urb(), and usb_hcd_unlink_urb() are
      converted to use the new field and new routines.  Other parts of
      usbcore will be converted in later patches.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5b653c79
  10. 20 7月, 2007 2 次提交
  11. 13 7月, 2007 6 次提交
    • A
      USB: Don't resume root hub if the controller is suspended · cfa59dab
      Alan Stern 提交于
      Root hubs can't be resumed if their parent controller device is still
      suspended.  This patch (as925) adds a check for that condition in
      hcd_bus_resume() and prevents it from being treated as a fatal
      controller failure.
      
      ehci-hcd is updated to add the corresponding test.  Unnecessary
      debugging messages are removed from uhci-hcd and dummy-hcd.  The
      error return code from dummy-hcd is changed to -ESHUTDOWN, the same as
      the others.  ohci-hcd doesn't need any changes.
      
      Suspend handling in the non-PCI host drivers is somewhat hit-and-miss.
      This patch shouldn't have any effect on them.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      cfa59dab
    • A
      USB: Remove usages of dev->power.power_state · e7e6da9e
      Alan Stern 提交于
      This patch (as922) removes all but one of the remaining vestiges of
      dev->power.power_state from usbcore.  The only usage left must remain
      until the deprecated "power/state" sysfs attribute is gone.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e7e6da9e
    • P
      usb: free DMA mappings if enqueue fails · 9f6a93f7
      Pete Zaitcev 提交于
      This patch releases DMA resources if enqueue fails in the HCD.
      
      Linux had this bug ever since we converted from virt_to_bus for 2.4.
      It is difficult to hit. A user would need a significant memory pressure
      or some other unusual condition.
      
      It was reported to me by IBM. They ran a management application for
      RSA II adapters which sent Bulk requests to an Interrupt endpoint.
      Submissions got rejected by HCD due to an invalid interval value
      and the swiotlb pool became depleted in the matter of hours.
      
      We fixed the invalid interval issue in devio.c separately, but this
      seems to be a bug worth fixing as well.
      Signed-off-by: NPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9f6a93f7
    • 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
    • O
      USB: introduce usb_anchor · 51a2f077
      Oliver Neukum 提交于
      - introduction of usb_anchor and its methods
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      51a2f077
    • A
      USB: Patch to align the various USB timers to fire at the same time · 01cd0819
      Arjan van de Ven 提交于
      This patch modifies the USB regular 250ms timer to be "perfectly aligned" to
      the second and quarters thereof. This change is there to make sure that if
      you have multiple USB ports, the timers for all these ports will fire at the
      same time rather than all spread out. All spread out wakes the CPU up from
      power saving idle a lot more than needed...
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      01cd0819