1. 22 Mar, 2017 1 commit
  2. 21 Jun, 2016 2 commits
    • Iago Abal's avatar
      usb: gadget: pch_udc: reorder spin_[un]lock to avoid deadlock · 1d23d16a
      Iago Abal authored
      The above commit reordered spin_lock/unlock and now `&dev->lock' is acquired
      (rather than released) before calling `dev->driver->disconnect',
      `dev->driver->setup', `dev->driver->suspend', `usb_gadget_giveback_request', and
      `usb_gadget_udc_reset'.
      
      But this *may* not be the right way to fix the problem pointed by d3cb25a1.
      
      Note that the other usb/gadget/udc drivers do release the lock before calling
      these functions. There are also inconsistencies within pch_udc.c, where
      `dev->driver->disconnect' is called while holding `&dev->lock' in lines 613 and
      1184, but not in line 2739.
      
      Finally, commit d3cb25a1 may have introduced several potential deadlocks.
      
      For instance, EBA (https://github.com/models-team/eba) reports:
      
          Double lock in drivers/usb/gadget/udc/pch_udc.c
          first at 2791: spin_lock(& dev->lock); [pch_udc_isr]
          second at 2694: spin_lock(& dev->lock); [pch_udc_svc_cfg_interrupt]
              after calling from 2793: pch_udc_dev_isr(dev, dev_intr);
              after calling from 2724: pch_udc_svc_cfg_interrupt(dev);
      
      Similarly, other potential deadlocks are 2791 -> 2793 -> 2721 -> 2657; and
      2791 -> 2793 -> 2711 -> 2573 -> 1499 -> 1480.
      
      Fixes: d3cb25a1
      
       ("usb: gadget: udc: fix spin_lock in pch_udc")
      Signed-off-by: default avatarIago Abal <mail@iagoabal.eu>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      1d23d16a
    • Michal Nazarewicz's avatar
      usb: gadget: fix unused-but-set-variale warnings · 872ce511
      Michal Nazarewicz authored
      
      
      Those are enabled with W=1 make option.
      
      The patch leaves of some type-limits warnings which are caused by
      generic macros used in a way where they produce always-false
      conditions.
      
      Signed-off-by: default avatarMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
      872ce511
  3. 19 Apr, 2016 1 commit
  4. 18 Apr, 2016 5 commits
  5. 15 Mar, 2016 1 commit
  6. 19 Oct, 2015 1 commit
  7. 28 Sep, 2015 1 commit
  8. 04 Aug, 2015 1 commit
  9. 03 Aug, 2015 1 commit
    • Pengyu Ma's avatar
      usb: gadget: udc: fix spin_lock in pch_udc · d3cb25a1
      Pengyu Ma authored
      
      
      When remove module g_serial on quark platform, the following Warning on:
      
      Modules linked in: usb_f_acm u_serial g_serial(-) pch_udc libcomposite configfs udc_core
      ad7298 industrialio_triggered_buffer kfifo_buf tpm_i2c_infineon indus
      CPU: 0 PID: 369 Comm: modprobe Not tainted 3.14.29ltsi-WR7.0.0.0_standard #6
      Hardware name: Intel Corp. QUARK/CrossHill, BIOS 0x010100F5 01/01/2014
       f641df0c f641df0c f641dec8 c15ac7fa f641defc c103084f c16c2356 f641df28
       00000171 c16b855c 000009dd c15b2d6f 000009dd c15b2d6f f6bd2000 faae5480
       00000000 f641df14 c10308a3 00000009 f641df0c c16c2356 f641df28 f641df2c
      Call Trace:
       [<c15ac7fa>] dump_stack+0x16/0x18
       [<c103084f>] warn_slowpath_common+0x7f/0xa0
       [<c15b2d6f>] ? preempt_count_sub+0x6f/0xc0
       [<c15b2d6f>] ? preempt_count_sub+0x6f/0xc0
       [<c10308a3>] warn_slowpath_fmt+0x33/0x40
       [<c15b2d6f>] preempt_count_sub+0x6f/0xc0
       [<faadbc82>] pch_udc_pcd_pullup+0x32/0xa0 [pch_udc]
       [<fa9747d9>] usb_gadget_remove_driver+0x29/0x60 [udc_core]
       [<fa974869>] usb_gadget_unregister_driver+0x59/0x80 [udc_core]
       [<faa78310>] usb_composite_unregister+0x10/0x20 [libcomposite]
       [<faae50f1>] cleanup+0xd/0xf [g_serial]
       [<c1084c47>] SyS_delete_module+0xf7/0x150
       [<c111f8dd>] ? ____fput+0xd/0x10
       [<c104b2ae>] ? task_work_run+0x6e/0xa0
       [<c15afda5>] syscall_call+0x7/0x7
      
      g_serial module on quark is depended on pch_udc module, ttyGSX cann't recieve
      data and warning on when remove g_serial.
      
      It was unlocked before the modification of the structure it was protecting,
      fix it as "lock -> unlock" to resolve this.
      
      Signed-off-by: default avatarPengyu Ma <pengyu.ma@windriver.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      d3cb25a1
  10. 29 Jul, 2015 1 commit
    • Vaishali Thakkar's avatar
      usb: udc: Convert use of __constant_cpu_to_leXX to cpu_to_leXX · b5c03bff
      Vaishali Thakkar authored
      
      
      In big endian cases, the macro cpu_to_le{16,32} unfolds to __swab{16,32}
      which provides special case for constants. In little endian cases,
      __constant_cpu_to_le{16,32} and cpu_to_le{16,32} expand directly to
      the same expression. So, replace __constant_cpu_to_le{16,32} with
      cpu_to_le{16,32} with the goal of getting rid of the definition of
      __constant_cpu_to_le{16,32} completely.
      
      The semantic patch that performs this transformation is as follows:
      
      @@expression x;@@
      
      (
      - __constant_cpu_to_le16(x)
      + cpu_to_le16(x)
      |
      - __constant_cpu_to_le32(x)
      + cpu_to_le32(x)
      )
      
      Signed-off-by: default avatarVaishali Thakkar <vthakkar1994@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      b5c03bff
  11. 29 Jan, 2015 1 commit
  12. 10 Nov, 2014 1 commit
  13. 03 Nov, 2014 1 commit
  14. 25 Sep, 2014 1 commit
  15. 20 Aug, 2014 1 commit
  16. 16 Jul, 2014 1 commit
  17. 17 Dec, 2013 1 commit
    • Robert Baldyga's avatar
      usb: gadget: add "maxpacket_limit" field to struct usb_ep · e117e742
      Robert Baldyga authored
      
      
      This patch adds "maxpacket_limit" to struct usb_ep. This field contains
      maximum value of maxpacket supported by driver, and is set in driver probe.
      This value should be used by autoconfig() function, because value of field
      "maxpacket" is set to value from endpoint descriptor when endpoint becomes
      enabled. So when autoconfig() function will be called again for this endpoint,
      "maxpacket" value will contain wMaxPacketSize from descriptior instead of
      maximum packet size for this endpoint.
      
      For this reason this patch adds new field "maxpacket_limit" which contains
      value of maximum packet size (which defines maximum endpoint capabilities).
      This value is used in ep_matches() function used by autoconfig().
      
      Value of "maxpacket_limit" should be set in UDC driver probe function, using
      usb_ep_set_maxpacket_limit() function, defined in gadget.h. This function
      set choosen value to both "maxpacket_limit" and "maxpacket" fields.
      
      This patch modifies UDC drivers by adding support for maxpacket_limit.
      
      Signed-off-by: default avatarRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      e117e742
  18. 06 Dec, 2013 1 commit
  19. 05 Dec, 2013 1 commit
  20. 01 Oct, 2013 1 commit
  21. 26 Sep, 2013 1 commit
  22. 27 Mar, 2013 1 commit
    • Felipe Balbi's avatar
      usb: gadget: pch_udc: fix sparse warnings · 3f8b6201
      Felipe Balbi authored
      
      
      fix the following sparse warnings:
      
      drivers/usb/gadget/pch_udc.c:1483:9: warning: context imbalance in 'complete_req' - unexpected unlock
      drivers/usb/gadget/pch_udc.c:2408:28: warning: context imbalance in 'pch_udc_svc_control_out' - unexpected unlock
      
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      3f8b6201
  23. 18 Mar, 2013 5 commits
  24. 24 Jan, 2013 1 commit
  25. 10 Sep, 2012 1 commit
  26. 04 Jun, 2012 1 commit
  27. 04 May, 2012 2 commits
  28. 06 Mar, 2012 1 commit
  29. 24 Feb, 2012 1 commit
  30. 09 Feb, 2012 1 commit
    • Tomoya MORINAGA's avatar
      usb: gadget: pch_udc: Detecting VBUS through GPIO with interrupt · 637b78eb
      Tomoya MORINAGA authored
      
      
      Problem:
       pch_udc continues operation even if VBUS becomes Low.
       pch_udc performs D+ pulling up before VBUS becomes High.
       USB device should be controlled according to VBUS state.
      
      Root cause:
       The current pch_udc is not always monitoring VBUS.
      
      Solution:
       The change of VBUS is detected using an interrupt of GPIO.
       If VBUS became Low, pch_udc handles 'disconnect'.
       After VBUS became High, a pull improves D+, and pch_udc
       handles 'connect'.
      
      [ balbi@ti.com : make it actually compile ]
      
      Signed-off-by: default avatarTomoya MORINAGA <tomoya.rohm@gmail.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      637b78eb