1. 21 Jul, 2008 40 commits
    • Christophe Jaillet's avatar
      USB: AccessRunner: avoid unnecessary memset · 33578bd7
      Christophe Jaillet authored
      Remove an explicit memset(.., 0, ...) to a variable allocated with kzalloc
      (i.e.  'card_info' array of the structure 'instance').
      Signed-off-by: default avatarChristophe Jaillet <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      33578bd7
    • Andrew Morton's avatar
    • Oliver Neukum's avatar
      USB: cdc-wdm cleanup · 87d65e54
      Oliver Neukum authored
      - fixes an error with filling out control requests
      - increases grepability and error logging
      - fixes the short read code path
      Signed-off-by: default avatarOliver Neukum <oneukum@suse.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      87d65e54
    • Greg Kroah-Hartman's avatar
      USB: delete airprime driver · 640c1bce
      Greg Kroah-Hartman authored
      This driver is only for one device id, and the option driver should be
      used instead for it.
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      640c1bce
    • Akinobu Mita's avatar
    • Ming Lei's avatar
      USB: uhci: mark root_hub_hub_des[] as const · bef4665a
      Ming Lei authored
      mark this array as const because it is read-only
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      bef4665a
    • Ming Lei's avatar
      USB: host: mark const variable tables as "const" · fe9b9034
      Ming Lei authored
      Mark the tables as const so that they end up in .rodata
      section and don't cacheline share with things that get
      written to.
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Cc: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      fe9b9034
    • Alan Stern's avatar
      USB Gadget: documentation update · f579c2b4
      Alan Stern authored
      This patch (as1102) clarifies two points in the USB Gadget kerneldoc:
      
      	Request completion callbacks are always made with interrupts
      	disabled;
      
      	Device controllers may not support STALLing the status stage
      	of a control transfer after the data stage is over.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Acked-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f579c2b4
    • Felipe Balbi's avatar
      usb: irda: cleanup on ir-usb module · e0d795e4
      Felipe Balbi authored
      General cleanup on ir-usb module. Introduced
      a common header that could be used also on
      usb gadget framework.
      
      Lot's of cleanups and now using macros from the header
      file.
      Signed-off-by: default avatarFelipe Balbi <me@felipebalbi.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e0d795e4
    • David Brownell's avatar
      USB: ehci-hcd unlink speedups · b9638011
      David Brownell authored
      This patch fixes some performance bugs observed with some workloads
      when unlinking EHCI queue header (QH) descriptors from the async ring
      (control/bulk schedule).
      
      The mechanism intended to defer unlinking an empty QH (so there is no
      penalty in common cases where it's quickly reused) was not working as
      intended.  Sometimes the unlink was scheduled:
      
       - too quickly ... which can be a *strong* negative effect, since
         that QH becomes unavailable for immediate re-use;
      
       - too slowly ... wasting DMA cycles, usually a minor issue except
         for increased bus contention and power usage;
      
      Plus there was an extreme case of "too slowly":  a logical error in the
      IAA watchdog-timer conversion meant that sometimes the unlink never
      got scheduled.
      
      The fix replaces a simple counter with a timestamp derived from the
      controller's 8 KHz microframe counter, and adjusts the timer usage
      for some issues associated with HZ being less than 8K.
      
      (Based on a patch originally by Alan Stern, and good troubleshooting
      from  Leonid.)
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Leonid <leonidv11@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b9638011
    • Felipe Balbi's avatar
      usb: hub: add check for unsupported bus topology · 38f3ad5e
      Felipe Balbi authored
      We can't allow hubs on the 7th tier as they would allow
      devices on the 8th tier.
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      38f3ad5e
    • Pete Zaitcev's avatar
      USB: ohci_hcd hang: submit vs. rmmod race · 6deb270b
      Pete Zaitcev authored
      If we do rmmod ohci_hcd while an application is doing something, the
      following may happen:
      
      - a control URB completes (in finish_urb) and the ohci's endpoint is
        set into ED_UNLINK in ed_deschedule
      - same URB is (re)submitted because of the open/close loop or other
        such application behaviour
      - rmmod sets the state to HC_STATE_QUESCING
      - finish_unlinks happens at next SOF; normally it would set ed into
        ED_IDLE and immediately call ed_schedule (since URB had extra TDs
        queued), which sets it into ED_OPER. But the check in ed_schedule
        makes it fail with -EAGAIN (which is ignored)
      - from now on we have a dead URB stuck; it cannot even be unlinked
        because the ed status is not ED_OPER, and thus start_ed_unlink is
        not invoked.
      
      This patch removes the check. In 2.6.25, all callers check for
      __ACTIVE bit before invoking ed_schedule, which is more appropriate.
      
      Alan Stern and David Brownell approved of this (cautiously).
      Signed-off-by: default avatarPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6deb270b
    • Eric Miao's avatar
      USB: make SA1111 OHCI driver SA11x0 specific · 6381fad7
      Eric Miao authored
      As RMK pointed out,  considering the fact that the _only_ platform with
      a PXA and SA1111 is the Lubbock, and that SA1111 DMA doesn't work there,
      (i.e. the SA1111 OHCI doesn't work there) the SA1111 OHCI driver should
      really be made SA11x0 specific.
      Signed-off-by: default avatarEric Miao <eric.miao@marvell.com>
      Acked-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Acked-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      6381fad7
    • Pete Zaitcev's avatar
      USB: missing usb_put_hcd to ohci-at91 · 421b4bf5
      Pete Zaitcev authored
      Looks like usb_put_hcd was missing. Also, make an always-zero function
      return void.
      Signed-off-by: default avatarPete Zaitcev <zaitcev@yahoo.com>
      Acked-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      421b4bf5
    • Harvey Harrison's avatar
      USB: speedtch.c fix sparse shadowed variable warning · abe28c00
      Harvey Harrison authored
      i is used only as a for-loop index no need to declare another.
      drivers/usb/atm/speedtch.c:832:7: warning: symbol 'i' shadows an earlier one
      drivers/usb/atm/speedtch.c:766:6: originally declared here
      Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      abe28c00
    • Harvey Harrison's avatar
      USB: cp2101.c fix sparse signedness mismatch warnings · b2bdd1f5
      Harvey Harrison authored
      The get/set 2101_config helpers take an unsigned int rather than an
      int.  It is safe to change these in each case and may even produce
      better code as it will be an unsigned divide rather than a signed
      divide in places.  All other manipulation was setting/masking bits
      which will not be affected by the sign change.
      
      Fixes the following sparse warnings:
      drivers/usb/serial/cp2101.c:378:44: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:378:44:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:378:44:    got int *<noident>
      drivers/usb/serial/cp2101.c:388:40: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:388:40:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:388:40:    got int *<noident>
      drivers/usb/serial/cp2101.c:413:42: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:413:42:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:413:42:    got int *<noident>
      drivers/usb/serial/cp2101.c:421:42: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:421:42:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:421:42:    got int *<noident>
      drivers/usb/serial/cp2101.c:444:42: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:444:42:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:444:42:    got int *<noident>
      drivers/usb/serial/cp2101.c:451:42: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:451:42:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:451:42:    got int *<noident>
      drivers/usb/serial/cp2101.c:458:42: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:458:42:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:458:42:    got int *<noident>
      drivers/usb/serial/cp2101.c:471:42: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:471:42:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:471:42:    got int *<noident>
      drivers/usb/serial/cp2101.c:481:42: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:481:42:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:481:42:    got int *<noident>
      drivers/usb/serial/cp2101.c:561:41: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:561:41:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:561:41:    got int *<noident>
      drivers/usb/serial/cp2101.c:591:45: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:591:45:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:591:45:    got int *<noident>
      drivers/usb/serial/cp2101.c:597:41: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:597:41:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:597:41:    got int *<noident>
      drivers/usb/serial/cp2101.c:608:45: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:608:45:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:608:45:    got int *<noident>
      drivers/usb/serial/cp2101.c:614:41: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:614:41:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:614:41:    got int *<noident>
      drivers/usb/serial/cp2101.c:623:45: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:623:45:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:623:45:    got int *<noident>
      drivers/usb/serial/cp2101.c:680:50: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:680:50:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:680:50:    got int *<noident>
      drivers/usb/serial/cp2101.c:690:43: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:690:43:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:690:43:    got int *<noident>
      drivers/usb/serial/cp2101.c:715:41: warning: incorrect type in argument 3 (different signedness)
      drivers/usb/serial/cp2101.c:715:41:    expected unsigned int *data
      drivers/usb/serial/cp2101.c:715:41:    got int *<noident>
      Signed-off-by: default avatarHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b2bdd1f5
    • Harvey Harrison's avatar
    • Stephen Rothwell's avatar
    • Alan Cox's avatar
      USB: sisusb: Push down the BKL · 49f15255
      Alan Cox authored
      This is another case where the lock_kernel appears to be unneccessary and
      could be removed with a bit more investigative work
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      49f15255
    • Alan Cox's avatar
      USB: rio100: Push down the BKL · 54592157
      Alan Cox authored
      The BKL is actually probably not needed as the mutex seems sufficient. If
      so then a further patch to drop it would be a good followup.
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      54592157
    • Alan Cox's avatar
      USB: auerwald: Push down the BKL into the driver · f1b5a7fe
      Alan Cox authored
      Also fix the unknown ioctl return code
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f1b5a7fe
    • Alan Cox's avatar
      USB: iowarrior: Push down BKL · 824f16fd
      Alan Cox authored
      I'm pretty sure the mutex is sufficient for all locking but will come
      back to that later if the USB folks don't beat me to it. For now get rid
      of the old BKL ioctl method and wrap the ioctl handler
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      824f16fd
    • Alan Cox's avatar
      USB: usblcd: Push down BKL into driver · 5cb4aeca
      Alan Cox authored
      I'm pretty sure this can be eliminated however I couldn't prove (or find)
      what stopped the device vanishing mid IOCTL_GET_HARD_VERSION. Perhaps a
      USB wizard could double check that and see if the lock_kernel can go
      entirely.
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      5cb4aeca
    • Alan Cox's avatar
      USB: ftdi_usb: Eliminate ioctl and BKL ioctl use · 1160d076
      Alan Cox authored
      ftdi has one ioctl, which is buggy and for debugging. Kill it off
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      1160d076
    • Alan Cox's avatar
      USB: gadget: Push BKL down into drivers · 44c389a0
      Alan Cox authored
      This keeps the gadget ioctl method wrapped but pushes the BKL down into
      the gadget code so we can use unlocked_ioctl().
      Signed-off-by: default avatarAlan Cox <alan@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      44c389a0
    • David Brownell's avatar
      usb ethernet gadget: use composite gadget framework · 0391c828
      David Brownell authored
      Building on the previous patches which took code from this driver and
      pakaged it in more-reusable network "function" components, this patch
      gets rid of the original code and uses those components instead.
      
      As seen with the other gadget driver conversions, the resulting code
      is much easier to understand and (presumably) work with.  In this case
      that's especially true, since the Ethernet gadget had grown to handle
      three (!) different Ethernet-over-USB protocols.  This modularization
      should make it much easier to add a fourth option for the newish CDC
      "Ethernet Emulation Model" (or EEM).
      
      Lightly tested, primarily at full speed.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      0391c828
    • David Brownell's avatar
      usb gadget: new "CDC Composite" gadget driver · 19e20680
      David Brownell authored
      This is a simple example of a composite gadget, combining two
      Communications Class Device (CDC) functions:  ECM and ACM.
      
      This provides a clear example of how the composite gadget framework
      is intended to work.  It's surprising that MS-Windows (or at least,
      XP and previous) won't "just work" with something this simple...
      
      One /proc/bus/usb/devices listing looks like:
      
        T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 46 Spd=480 MxCh= 0
        D:  Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
        P:  Vendor=0525 ProdID=a4aa Rev= 3.01
        S:  Manufacturer=Linux 2.6.26-rc6-pnut with net2280
        S:  Product=CDC Composite Gadget
        C:* #Ifs= 4 Cfg#= 1 Atr=c0 MxPwr=  2mA
        I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
        E:  Ad=83(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
        I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
        I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
        E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        I:* If#= 2 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=cdc_acm
        E:  Ad=86(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
        I:* If#= 3 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm
        E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
        E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
      
      Not all USB peripheral controller hardware can support this driver.
      All the highspeed-capable peripheral controllers with drivers now in
      the mainline kernel seem to support this, as does omap_udc.  But
      many full speed controllers don't have enough endpoints, or (as with
      the PXA controllers) don't support altsettings.
      
      Lightly tested.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      19e20680
    • David Brownell's avatar
      usb ethernet gadget: split RNDIS function · 45fe3b8e
      David Brownell authored
      This is a RNDIS function driver, extracted from the all-in-one
      Ethernet gadget driver.
      
      Lightly tested ... there seems to be a pre-existing problem when
      talking to Windows XP SP2, not quite sure what's up with that yet.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      45fe3b8e
    • David Brownell's avatar
      usb ethernet gadget: split CDC Ethernet function · da741b8c
      David Brownell authored
      This is a "CDC Ethernet" (ECM) function driver, extracted from the
      all-in-one Ethernet gadget driver.
      
      This is a good example of how to implement interface altsettings.
      In fact it's currently the only such example in the gadget stack,
      pending addition of OBEX support.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      da741b8c
    • David Brownell's avatar
      usb ethernet gadget: split CDC Subset function · 8a40819e
      David Brownell authored
      This is a simple "CDC Subset" (and MCCI "SAFE") function driver, extracted
      from the all-in-one Ethernet gadget driver.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      8a40819e
    • David Brownell's avatar
      usb ethernet gadget: split out network core · 2b3d942c
      David Brownell authored
      Abstract the peripheral side Ethernet-over-USB link layer code from
      the all-in-one Ethernet gadget driver into a component that can be
      called by various functions, so the various flavors can be split
      apart and selectively reused.
      
      A notable difference from the approach taken with the serial link
      layer code (beyond talking to NET not TTY) is that because of the
      initialization requirements, this only supports one network link.
      (And one set of Ethernet link addresses.)
      
      That is, each configuration may have only one instance of a network
      function.  This doesn't change behavior; the current code has that
      same restriction.  If you want multiple logical links, that can
      easily be done using network layer tools.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      2b3d942c
    • David Brownell's avatar
      usb gadget: RNDIS cleanups · 15b2d2b5
      David Brownell authored
      Some cleanup to the RNDIS code:
      
       - Minor bugfix:  rndis_unit() is supposed to put the link into the
         RNDIS_UNINITIALIZED state, which does not mean "unused".  There's
         a separate method to stop using the link.  (Bug doesn't affect
         anything right now because of how the code is used.)
      
       - Reduce coupling between RNDIS code and its user(s), in preparation
         for updates in that code:
      
          * Decouple RNDIS_RESPONSE_AVAILABLE notifications from net_device
            by passing just a void* handle.  (Also, remove the unused return
            value of the notification callback.)
          * When it needs a copy of net_device stats, just ask for it
      
       - Remove unused/untested code backing various never-used OIDs:
      
          * RNDIS_PM, RNDIS_WAKEUP ... "should" get implemented, but the
            relevant docs were unclear, ambguous, and incomplete.  Someone
            with access to the Hidden Gospels (maybe in the EU?) might be
            able to figure out what this should do.
          * RNDIS_OPTIONAL_STATS ... as the name suggests, optional.  Never
            implemented in part because not all the semantics were clear.
          * OID_GEN_RNDIS_CONFIG_PARAMETER, which has been #if 0 forever.
      
       - A few small whitespace fixes
      
      Plus switch the VERBOSE symbol over to the newer VERBOSE_DEBUG style.
      
      There should be no functional changes because of this patch; it's a
      net source code shrink (because of the dead/unused code removal) and
      a small object code shrink (a couple hundred bytes on ARMv5).
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      15b2d2b5
    • David Brownell's avatar
      usb gadget serial: use composite gadget framework · 7bb5ea54
      David Brownell authored
      This switches the serial gadget over to using the new "function"
      versions of the serial port interfacing code.  The remaining code
      in the main source file is quite small...
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      7bb5ea54
    • David Brownell's avatar
      usb gadget serial: split out generic serial function · 61d8baea
      David Brownell authored
      Split out the generic serial support into a "function driver".  This
      closely mimics the ACM support, but with a MUCH simpler control model.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      61d8baea
    • David Brownell's avatar
      usb gadget serial: split out CDC ACM function · 4d5a73dc
      David Brownell authored
      Split out CDC ACM parts of "gadget serial" to a "function driver".
      Some key structural differences from the previous ACM support, shared
      with with the generic serial function (next patch):
      
       - As a function driver, it can be combined with other functions.
         One gadget configuration could offer both serial and network
         links, as an example.
      
       - One serial port can be exposed in multiple configurations;
         the /dev/ttyGS0 node could be exposed regardless of which
         config the host selected.
      
       - One configuration can expose multiple serial ports, such as
         ttyGS0, ttyGS1, ttyGS2, and ttyGS3.
      
      This code should be a lot easier to understand than the previous
      all-in-one-big-file version of the driver.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      4d5a73dc
    • David Brownell's avatar
      usb gadget zero: use composite gadget framework · 097db1d0
      David Brownell authored
      Update Gadget Zero to use the more modular versions of the loopback
      and source/sink configuration drivers which build on the new gadget
      framework code.
      
      The core code is a LOT simpler, and it should be much easier now to
      understand how the parts fit together.  The conversion is an overall
      source shrink in terms of this gadget, since it uses more midlayer
      support.  However, it's an overall increase in object size because
      there's less sharing between the two configurations (improves code
      clarity) and because the midlayer is a bit more functional than this
      driver actually needs.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      097db1d0
    • David Brownell's avatar
      usb gadget zero: split out loopback config · e5760fda
      David Brownell authored
      This splits the gadget zero "loopback" configuration into a standalone
      "configuration driver", building on the composite gadget framework code.
      It doesn't yet pull the original code out of gadget zero or update how
      that driver is built.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      e5760fda
    • David Brownell's avatar
      usb gadget zero: split out source/sink config · a400cadc
      David Brownell authored
      This splits the gadget zero "source/sink" configuration into a standalone
      "configuration driver", building on the composite gadget framework code.
      It doesn't yet pull the original code out of gadget zero or update how
      that driver is built.
      
      Neither this, nor its sibling "loopback" configuration, is a function
      driver that can be combined with other functions.  (The host "usbtest"
      driver wouldn't know how to deal with that!)  However the code becomes
      simpler because of this conversion, so it's a net win.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      a400cadc
    • David Brownell's avatar
      usb gadget: composite gadget core · 40982be5
      David Brownell authored
      Add <linux/usb/composite.h> interfaces for composite gadget drivers, and
      basic implementation support behind it:
      
        - struct usb_function ... groups one or more interfaces into a function
          managed as one unit within a configuration, to which it's added by
          usb_add_function().
      
        - struct usb_configuration ... groups one or more such functions into
          a configuration managed as one unit by a driver, to which it's added
          by usb_add_config().  These operate at either high or full/low speeds
          and at a given bMaxPower.
      
        - struct usb_composite_driver ... groups one or more such configurations
          into a gadget driver, which may be registered or unregistered.
      
        - struct usb_composite_dev ... a usb_composite_driver manages this; it
          wraps the usb_gadget exposed by the controller driver.
      
      This also includes some basic kerneldoc.
      
      How to use it (the short version):  provide a usb_composite_driver with a
      bind() that calls usb_add_config() for each of the needed configurations.
      The configurations in turn have bind() calls, which will usb_add_function()
      for each function required.  Each function's bind() allocates resources
      needed to perform its tasks, like endpoints; sometimes configurations will
      allocate resources too.
      
      Separate patches will convert most gadget drivers to this infrastructure.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      40982be5
    • David Brownell's avatar
      usb gadget: descriptor copying support · a4c39c41
      David Brownell authored
      Define three new descriptor manipulation utilities, for use when
      setting up functions that may have multiple instances:
      
      	usb_copy_descriptors() to copy a vector of descriptors
      	usb_free_descriptors() to free the copy
      	usb_find_endpoint() to find a copied version
      
      These will be used as follows.  Functions will continue to have static
      tables of descriptors they update, now used as __initdata templates.
      
      When a function creates a new instance, it patches those tables with
      relevant interface and string IDs, plus endpoint assignments.  Then it
      copies those morphed descriptors, associates the copies with the new
      function instance, and records the endpoint descriptors to use when
      activating the endpoints.  When initialization is done, only the copies
      remain in memory.  The copies are freed on driver removal.
      
      This ensures that each instance has descriptors which hold the right
      instance-specific data.  Two instances in the same configuration will
      obviously never share the same interface IDs or use the same endpoints.
      Instances in different configurations won't do so either, which means
      this is slightly less memory-efficient in some cases.
      
      This also includes a bugfix to the epautoconf code that shows up with
      this usage model.  It must replace the previous endpoint number when
      updating the template descriptors, not just mask in a few more bits.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      a4c39c41