1. 28 8月, 2013 1 次提交
    • G
      USB: gadget: audit sysfs attribute permissions · ce26bd23
      Greg Kroah-Hartman 提交于
      Convert all USB gadget sysfs attributes to use the _RO or _RW variants,
      to make them easier to audit and ensure that the permissions are
      correct.
      
      Note, two are left using the DEVICE_ATTR() macro, as there is no
      DEVICE_ATTR_WO() in Linus's tree, that will happen after 3.12-rc1 is
      out, a follow-on patch will be sent then.
      Reviewed-by: NFelipe Balbi <balbi@ti.com>
      Acked-by: NFelipe Balbi <balbi@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      --
       drivers/usb/gadget/composite.c      |    8 +++-----
       drivers/usb/gadget/dummy_hcd.c      |    8 ++++----
       drivers/usb/gadget/f_mass_storage.c |   14 ++++++--------
       drivers/usb/gadget/net2272.c        |    4 ++--
       drivers/usb/gadget/net2280.c        |   18 +++++++++---------
       drivers/usb/gadget/storage_common.c |   25 ++++++++++++-------------
       drivers/usb/gadget/udc-core.c       |   14 +++++++-------
       7 files changed, 43 insertions(+), 48 deletions(-)
      ce26bd23
  2. 29 7月, 2013 2 次提交
  3. 15 7月, 2013 1 次提交
    • A
      usb: gadget: don't fail when DMA isn't present · 908b9613
      Alan Stern 提交于
      When CONFIG_HAS_DMA isn't enabled, the UDC core gets build errors:
      
      drivers/built-in.o: In function `dma_set_coherent_mask':
      include/linux/dma-mapping.h:93: undefined reference to `dma_supported'
      include/linux/dma-mapping.h:93: undefined reference to `dma_supported'
      drivers/built-in.o: In function `usb_gadget_unmap_request':
      drivers/usb/gadget/udc-core.c:91: undefined reference to `dma_unmap_sg'
      drivers/usb/gadget/udc-core.c:96: undefined reference to `dma_unmap_single'
      drivers/built-in.o: In function `usb_gadget_map_request':
      drivers/usb/gadget/udc-core.c:62: undefined reference to `dma_map_sg'
      drivers/usb/gadget/udc-core.c:71: undefined reference to `dma_map_single'
      drivers/usb/gadget/udc-core.c:74: undefined reference to `dma_mapping_error'
      
      Prevent this by protecting the DMA API routines with preprocessor tests.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Geert Uytterhoeven <geert@linux-m68k.org>
      Acked-by: NAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      908b9613
  4. 02 4月, 2013 1 次提交
  5. 20 3月, 2013 1 次提交
    • A
      usb: gadget: udc-core: fix a regression during gadget driver unbinding · 511f3c53
      Alan Stern 提交于
      This patch (as1666) fixes a regression in the UDC core.  The core
      takes care of unbinding gadget drivers, and it does the unbinding
      before telling the UDC driver to turn off the controller hardware.
      When the call to the udc_stop callback is made, the gadget no longer
      has a driver.  The callback routine should not be invoked with a
      pointer to the old driver; doing so can cause problems (such as
      use-after-free accesses in net2280).
      
      This patch should be applied, with appropriate context changes, to all
      the stable kernels going back to 3.1.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      511f3c53
  6. 18 3月, 2013 9 次提交
  7. 25 1月, 2013 1 次提交
  8. 22 1月, 2013 1 次提交
  9. 08 11月, 2012 1 次提交
    • M
      usb: gadget: Remove reference to is_dualspeed from sysfs. · be44f1c8
      Michal Nazarewicz 提交于
      This commit removes the /sys/devices/platform/<UDC>/udc/<UDC>/is_dualspeed
      file and is_dualspeeed line from /sys/devices/platform/ci13xxx_*/udc/device
      file.
      
      The is_dualspeed file is superseded by maximum_speed in the same directory
      and is_dualspeed line in device file is superseded by max_speed line in
      the same file.
      
      The maximum_speed/max_speed specifies maximum speed supported by UDC.
      To check if dualspeeed is supported, check if the value is >= 3.
      Signed-off-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      be44f1c8
  10. 10 9月, 2012 2 次提交
  11. 23 8月, 2012 1 次提交
    • K
      usb: gadget: udc-core: Race between disconnect/unbind and setup · 974e9323
      Kevin Cernekee 提交于
      usb_gadget_remove_driver() runs through a four-step sequence to shut down
      the gadget driver.  For the case of a composite gadget + at91 UDC, this
      would look like:
      
          udc->driver->disconnect(udc->gadget);          // composite_disconnect()
          usb_gadget_disconnect(udc->gadget);            // at91_pullup(gadget, 0)
          udc->driver->unbind(udc->gadget);              // composite_unbind()
          usb_gadget_udc_stop(udc->gadget, udc->driver); // at91_stop()
      
      The UDC driver can receive SETUP packets from the host up until the
      point when usb_gadget_disconnect() returns.  On rare occasions, the
      gadget driver may see this sequence:
      
          udc->driver->disconnect(udc->gadget);          // composite_disconnect()
          udc->driver->setup(udc->gadget, &ctrl);        // composite_setup()
          udc->driver->unbind(udc->gadget);              // composite_unbind()
      
      Some gadget drivers, such as composite, assume this will never happen
      and crash as a result.
      
      The fix is to quiesce the UDC hardware (via usb_gadget_disconnect)
      before running the gadget driver through the disconnect/unbind sequence.
      Reviewed-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NKevin Cernekee <cernekee@gmail.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      974e9323
  12. 27 4月, 2012 2 次提交
  13. 11 4月, 2012 1 次提交
  14. 10 4月, 2012 1 次提交
  15. 28 2月, 2012 1 次提交
  16. 12 12月, 2011 1 次提交
  17. 15 11月, 2011 3 次提交
  18. 27 9月, 2011 1 次提交
  19. 18 9月, 2011 1 次提交
    • M
      usb: Provide usb_speed_string() function · e538dfda
      Michal Nazarewicz 提交于
      In a few places in the kernel, the code prints
      a human-readable USB device speed (eg. "high speed").
      This involves a switch statement sometimes wrapped
      around in ({ ... }) block leading to code repetition.
      
      To mitigate this issue, this commit introduces
      usb_speed_string() function, which returns
      a human-readable name of provided speed.
      
      It also changes a few places switch was used to use
      this new function.  This changes a bit the way the
      speed is printed in few instances at the same time
      standardising it.
      Signed-off-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e538dfda
  20. 02 7月, 2011 2 次提交
  21. 29 6月, 2011 1 次提交
    • F
      usb: gadget: introduce UDC Class · 2ccea03a
      Felipe Balbi 提交于
      this class will be used to abstract away several of the duplicated
      operations scattered among the USB gadget controller drivers.
      
      Later, we can add an atomic notifier to tell interested drivers about
      what's happening with the controller. Notifications such as suspend,
      resume, enumerated, etc. will be useful, at a minimum, for implementing
      usb charger detection.
      
      As part of the converting process usb_gadget_probe_driver() is no longer
      part of each udc but pushed into the ->stap() callback. The same for his
      couterpart.
      
      The core is currently set explicit to 'n'. It will be changed to 'y' once
      all users are converted since it provides functions which clash with
      other drivers.
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      Signed-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2ccea03a