1. 26 3月, 2013 12 次提交
    • A
      USB: EHCI: remove unused variable in unlink_empty_async() · afc2c9a2
      Alan Stern 提交于
      This patch (as1669) removes the check_unlinks_later flag in ehci-hcd's
      unlink_empty_async().  It wasn't being used for anything and should
      have been removed in an earlier patch, but I forgot about it.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      afc2c9a2
    • A
      USB: EHCI: improve end_unlink_async() · 214ac7a0
      Alan Stern 提交于
      This patch (as1665) changes the way ehci-hcd's end_unlink_async()
      routine works in order to avoid recursive execution and to be more
      efficient:
      
      	Now when an IAA cycle ends, a new one gets started up right
      	away (if it is needed) instead of waiting until the
      	just-unlinked QH has been processed.
      
      	The async_iaa list is renamed to async_idle, which better
      	expresses its new purpose: It is now the list of QHs which are
      	now completely idle and are waiting to be processed by
      	end_unlink_async().
      
      	A new flag is added to track whether an IAA cycle is in
      	progress, because the list formerly known as async_iaa no
      	longer stores the QHs waiting for the IAA to finish.
      
      	The decision about how many QHs to process when an IAA cycle
      	ends is now made at the end of the cycle, when we know the
      	current state of the hardware, rather than at the beginning.
      	This means a bunch of logic got moved from start_iaa_cycle()
      	to end_unlink_async().
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      214ac7a0
    • A
      USB: EHCI: convert singly-linked lists to list_heads · 6e018751
      Alan Stern 提交于
      This patch (as1664) converts ehci-hcd's async_unlink, async_iaa, and
      intr_unlink from singly-linked lists to standard doubly-linked
      list_heads.  Originally it didn't seem necessary to use list_heads,
      because items are always added to and removed from these lists in FIFO
      order.  But now with more list processing going on, it's easier to use
      the standard routines than continue with a roll-your-own approach.
      
      I don't know if the code ends up being notably shorter, but the
      patterns will be more familiar to any kernel hacker.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6e018751
    • A
      USB: EHCI: consolidate code in ehci_urb_dequeue() · 7655e316
      Alan Stern 提交于
      This patch (as1668) consolidates two nearly identical code paths in
      ehci_urb_dequeue().  The test for !qh can be removed because it will
      never succeed; the fact that usb_hcd_check_unlink_urb() returned 0
      means that urb must be queued and therefore urb->hcpriv must point to
      a QH.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7655e316
    • A
      USB: EHCI: split needs_rescan into two flags · 7bc782d7
      Alan Stern 提交于
      This patch (as1662) does some more QH-related cleanup in ehci-hcd.
      The qh->needs_rescan flag is currently used for two different
      purposes; the patch replaces it with two separate flags for greater
      clarity: qh->dequeue_during_giveback indicates that a completion
      handler dequeued an URB (implying that a rescan is needed), and
      qh->exception indicates that the QH is in an exceptional state
      requiring an unlink (either it encountered an I/O error or an unlink
      was requested).
      
      The new flags get set where the dequeue, exception, or unlink request
      occurred, rather than where the unlink is started.  This is so that in
      the future, if we need to, we will be able to tell apart unlinks that
      truly were required from those that were carried out merely because
      the QH wasn't being used.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7bc782d7
    • A
      USB: EHCI: change return value of qh_completions() · 79bcf7b0
      Alan Stern 提交于
      This patch (as1658) cleans up the usage of qh_completions() in
      ehci-hcd.  Currently the function's return value indicates whether any
      URBs were given back; the idea was that the caller can scan the QH
      over again to handle any URBs that were dequeued by a completion
      handler.  This is not necessary; when qh_completions() is ready to
      give back dequeued URBs, it does its own rescanning.
      
      Therefore the new return value will be a flag indicating whether the
      caller needs to unlink the QH.  This is more convenient than forcing
      the caller to check qh->needs_rescan, and it makes a lot more sense --
      why should "needs_rescan" imply that an unlink is needed?  The callers
      are also changed to remove the unneeded rescans.
      
      Lastly, the check for whether qh->qtd_list is non-empty is removed
      from the start of qh_completions().  Two of the callers have to make
      this test anyway, so the same test can simply be added to the other
      two callers.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      79bcf7b0
    • A
      USB: EHCI: changes related to qh_refresh() · c1fdb68e
      Alan Stern 提交于
      This patch (as1638) makes several changes to the ehci-hcd driver, all
      related to the qh_refresh() function.  This function must be called
      whenever an idle QH gets linked back into either the async or the
      periodic schedule.
      
      	Change a BUG_ON() in the qh_update routine to a WARN_ON().
      	Since this code runs in atomic context, a BUG_ON() would
      	immediately freeze the whole system.
      
      	Remove two unneeded calls to qh_refresh(), one when a QH is
      	initialized and one when a QH becomes idle.  Adjust the
      	adjacent comments accordingly.
      
      	Move the qh_refresh() and qh_link_periodic() calls for new
      	interrupt URBs to after the new TDs have been added.
      
      	As a result of the previous two changes, qh_refresh() is never
      	called when the qtd_list is empty.  The corresponding check in
      	qh_refresh() can be removed, along with an indentation level.
      
      These changes should not cause any alteration of behavior.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c1fdb68e
    • D
      USB: usb-skeleton.c: fix blocked forever in skel_read · c79041a4
      Du Xing 提交于
      In skel_read,the reader blocked in wait_for_completion before submit
      bulk in urb.
      Using processed_urb is for retaining the completion in the case that
      previous interruptible wait in skel_read was interrupted and complete
      before next skel_read.  Replacing completion with waitqueue can avoid
      working around the counting nature of completions
      and fix the bug.
      
      Signed-off-by: Du Xing duxing2007@gmail.com
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c79041a4
    • B
      USB: cdc-wdm: implement IOCTL_WDM_MAX_COMMAND · 3edce1cf
      Bjørn Mork 提交于
      Userspace applications need to know the maximum supported message
      size.
      
      The cdc-wdm driver translates between a character device stream
      and a message based protocol.  Each message is transported as a
      usb control message with no further encapsulation or syncronization.
      Each read or write on the character device should translate to
      exactly one usb control message to ensure that message boundaries
      are kept intact.  That means that the userspace application must
      know the maximum message size supported by the device and driver,
      making this size a vital part of the cdc-wdm character device API.
      
      CDC WDM and CDC MBIM functions export the maximum supported
      message size through CDC functional descriptors.  The cdc-wdm and
      cdc_mbim drivers will parse these descriptors and use the value
      chosen by the device.  The only current way for a userspace
      application to retrive the value is by duplicating the descriptor
      parsing. This is an unnecessary complex task, and application
      writers are likely to postpone it, using a fixed value and adding
      a "todo" item.
      
      QMI functions have no way to tell the host what message size they
      support.  The qmi_wwan driver use a fixed value based on protocol
      recommendations and observed device behaviour.  Userspace
      applications must know and hard code the same value.  This scheme
      will break if we ever encounter a QMI device needing a device
      specific message size quirk.  We are currently unable to support
      such a device because using a non default size would break the
      implicit userspace API.
      
      The message size is currently a hidden attribute of the cdc-wdm
      userspace API.  Retrieving it is unnecessarily complex, increasing
      the possibility of drivers and applications using different limits.
      The resulting errors are hard to debug, and can only be replicated
      on identical hardware.
      
      Exporting the maximum message size from the driver simplifies the
      task for the userspace application, and creates a unified
      information source independent of device and function class. It also
      serves to document that the message size is part of the cdc-wdm
      userspace API.
      
      This proposed API extension has been presented for the authors of
      userspace applications and libraries using the current API: libmbim,
      libqmi, uqmi, oFono and ModemManager.  The replies were:
      
      Aleksander Morgado:
       "We do really need max message size for MBIM; and as you say, it may be
        good to have the max message size info also for QMI, so the new ioctl
        seems a good addition. So +1 from my side, for what it's worth."
      
      Dan Williams:
       "Yeah, +1 here.  I'd prefer the sysfs file, but the fact that that
        doesn't work for fd passing pretty much kills it."
      
      No negative replies are so far received.
      
      Cc: Aleksander Morgado <aleksander@lanedo.com>
      Cc: Dan Williams <dcbw@redhat.com>
      Signed-off-by: NBjørn Mork <bjorn@mork.no>
      Acked-by: NOliver Neukum <oliver@neukum.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3edce1cf
    • D
      USB: hub: Avoid NULL pointer dereference when hub doesn't have any ports · 769d7368
      David Linares 提交于
      Return an error if hub->descriptor->bNbrPorts==0. Without this additional
      check, we can end up doing a "hub->ports = kzalloc(0, GFP_KERNEL)".
      This hub->ports pointer will therefore be non-NULL and will be used.
      Example of dmesg:
         INIT: usb 1-1: New USB device found, idVendor=0424, idProduct=2512
         usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
         hub 1-1:1.0: USB hub found
         version 2.86 bootinghub 1-1:1.0: 0 ports detected
         Unable to handle kernel NULL pointer dereference at virtual address 00000010
      Signed-off-by: NDavid Linares <dlinares.linux@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      769d7368
    • M
      USB: serial: comments on suspend failure · 93e4f47f
      Ming Lei 提交于
      If suspend callback fails in system sleep context, usb core will
      ignore the failure and let system sleep go ahead further, so
      this patch comments on the case and requires that serial->type->suspend()
      MUST return 0 in system sleep context.
      Acked-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      93e4f47f
    • M
      USB: adds comment on suspend callback · 303f0847
      Ming Lei 提交于
      This patch adds comments on interface driver suspend callback
      to emphasize that the failure return value is ignored by
      USB core in system sleep context, so do not try to recover
      device for this case and let resume/reset_resume callback
      handle the suspend failure if needed.
      
      Also kerneldoc for usb_suspend_both() is updated with the
      fact.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      303f0847
  2. 22 3月, 2013 22 次提交
  3. 21 3月, 2013 3 次提交
  4. 20 3月, 2013 3 次提交