1. 17 10月, 2008 1 次提交
  2. 24 9月, 2008 1 次提交
    • G
      USB: fix hcd interrupt disabling · 83a79820
      Geoff Levand 提交于
      Commit de85422b, 'USB: fix interrupt
      disabling for HCDs with shared interrupt handlers' changed usb_add_hcd()
      to strip IRQF_DISABLED from irqflags prior to calling request_irq()
      with the justification that such a removal was necessary for shared
      interrupts to work properly.  Unfortunately, the change in that commit
      unconditionally removes the IRQF_DISABLED flag, causing problems on
      platforms that don't use a shared interrupt but require IRQF_DISABLED.
      This change adds a check for IRQF_SHARED prior to removing the
      IRQF_DISABLED flag.
      
      Fixes the PS3 system startup hang reported with recent Fedora and
      OpenSUSE kernels.
      
      Note that this problem is hidden when CONFIG_LOCKDEP=y (ps3_defconfig),
      as local_irq_enable_in_hardirq() is defined as a null statement for
      that config.
      
      CC: stable <stable@kernel.org>
      Signed-off-by: NGeoff Levand <geoffrey.levand@am.sony.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Stefan Becker <Stefan.Becker@nokia.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      83a79820
  3. 22 8月, 2008 1 次提交
    • A
      USB: automatically enable RHSC interrupts · b5fb454f
      Alan Stern 提交于
      This patch (as1069c) changes the way OHCI root-hub status-change
      interrupts are enabled.  Currently a special HCD method,
      hub_irq_enable(), is called when the hub driver is finished using a
      root hub.  This approach turns out to be subject to races, resulting
      in unnecessary polling.
      
      The patch does away with the method entirely.  Instead, the driver
      automatically enables the RHSC interrupt when no more status changes
      are present.  This scheme is safe with controllers using
      level-triggered semantics for their interrupt flags.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      b5fb454f
  4. 22 7月, 2008 2 次提交
  5. 07 7月, 2008 1 次提交
  6. 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
  7. 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
  8. 25 4月, 2008 3 次提交
  9. 02 2月, 2008 4 次提交
  10. 29 11月, 2007 1 次提交
  11. 02 11月, 2007 1 次提交
  12. 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
  13. 20 7月, 2007 2 次提交
  14. 13 7月, 2007 3 次提交
    • 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