1. 31 7月, 2015 14 次提交
    • K
      usb: gadget: mass_storage: Use static array for luns · dd02ea5a
      Krzysztof Opasiak 提交于
      This patch replace dynamicly allocated luns array with static one.
      This simplifies the code of mass storage function and modules.
      Signed-off-by: NKrzysztof Opasiak <k.opasiak@samsung.com>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      dd02ea5a
    • K
      usb: gadget: mass_storage: Fix freeing luns sysfs implementation · 5542f58c
      Krzysztof Opasiak 提交于
      Use device_is_registered() instad of sysfs flag to determine if
      we should free sysfs representation of particular LUN.
      
      sysfs flag in fsg common determines if luns attributes should be
      exposed using sysfs. This flag is used when creating and freeing
      luns. Unfortunately there is no guarantee that this flag will not
      be changed between creation and removal of particular LUN. Especially
      because of lun.0 which is created during allocating instance of
      function. This may lead to resource leak or NULL pointer dereference:
      
      [   62.539925] Unable to handle kernel NULL pointer dereference at virtual address 00000044
      [   62.548014] pgd = ec994000
      [   62.550679] [00000044] *pgd=6d7be831, *pte=00000000, *ppte=00000000
      [   62.556933] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
      [   62.562310] Modules linked in: g_mass_storage(+)
      [   62.566916] CPU: 2 PID: 613 Comm: insmod Not tainted 4.2.0-rc4-00077-ge29ee91-dirty #125
      [   62.574984] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [   62.581061] task: eca56e80 ti: eca76000 task.ti: eca76000
      [   62.586450] PC is at kernfs_find_ns+0x8/0xe8
      [   62.590698] LR is at kernfs_find_and_get_ns+0x30/0x48
      [   62.595732] pc : [<c01277c0>]    lr : [<c0127b88>]    psr: 40010053
      [   62.595732] sp : eca77c40  ip : eca77c38  fp : 000008c1
      [   62.607187] r10: 00000001  r9 : c0082f38  r8 : ed41ce40
      [   62.612395] r7 : c05c1484  r6 : 00000000  r5 : 00000000  r4 : c0814488
      [   62.618904] r3 : 00000000  r2 : 00000000  r1 : c05c1484  r0 : 00000000
      [   62.625417] Flags: nZcv  IRQs on  FIQs off  Mode SVC_32  ISA ARM  Segment user
      [   62.632620] Control: 10c5387d  Table: 6c99404a  DAC: 00000015
      [   62.638348] Process insmod (pid: 613, stack limit = 0xeca76210)
      [   62.644251] Stack: (0xeca77c40 to 0xeca78000)
      [   62.648594] 7c40: c0814488 00000000 00000000 c05c1484 ed41ce40 c0127b88 00000000 c0824888
      [   62.656753] 7c60: ed41d038 ed41d030 ed41d000 c012af4c 00000000 c0824858 ed41d038 c02e3314
      [   62.664912] 7c80: ed41d030 00000000 ed41ce04 c02d9e8c c070eda8 eca77cb4 000008c1 c058317c
      [   62.673071] 7ca0: 000008c1 ed41d030 ed41ce00 ed41ce04 ed41d000 c02da044 ed41cf48 c0375870
      [   62.681230] 7cc0: ed9d3c04 ed9d3c00 ed52df80 bf000940 fffffff0 c03758f4 c03758c0 00000000
      [   62.689389] 7ce0: bf000564 c03614e0 ed9d3c04 bf000194 c0082f38 00000001 00000000 c0000100
      [   62.697548] 7d00: c0814488 c0814488 c086b1dc c05893a8 00000000 ed7e8320 00000000 c0128b88
      [   62.705707] 7d20: ed8a6b40 00000000 00000000 ed410500 ed8a6b40 c0594818 ed7e8320 00000000
      [   62.713867] 7d40: 00000000 c0129f20 00000000 c082c444 ed8a6b40 c012a684 00001000 00000000
      [   62.722026] 7d60: c0594818 c082c444 00000000 00000000 ed52df80 ed52df80 00000000 00000000
      [   62.730185] 7d80: 00000000 00000000 00000001 00000002 ed8e9b70 ed52df80 bf0006d0 00000000
      [   62.738345] 7da0: ed8e9b70 ed410500 ed618340 c036129c ed8c1c00 bf0006d0 c080b158 ed8c1c00
      [   62.746504] 7dc0: bf0006d0 c080b158 ed8c1c08 ed410500 c0082f38 ed618340 000008c1 c03640ac
      [   62.754663] 7de0: 00000000 bf0006d0 c082c8dc c080b158 c080b158 c03642d4 00000000 bf003000
      [   62.762822] 7e00: 00000000 c0009784 00000000 00000001 00000000 c05849b0 00000002 ee7ab780
      [   62.770981] 7e20: 00000002 ed4105c0 0000c53e 000000d0 c0808600 eca77e5c 00000004 00000000
      [   62.779140] 7e40: bf000000 c0095680 c08075a0 ee001f00 ed4105c0 c00cadc0 ed52df80 bf000780
      [   62.787300] 7e60: ed4105c0 bf000780 00000001 bf0007c8 c0082f38 ed618340 000008c1 c0083e24
      [   62.795459] 7e80: 00000001 bf000780 00000001 eca77f58 00000001 bf000780 00000001 c00857f4
      [   62.803618] 7ea0: bf00078c 00007fff 00000000 c00835b4 eca77f58 00000000 c0082fac eca77f58
      [   62.811777] 7ec0: f05038c0 0003b008 bf000904 00000000 00000000 bf00078c 6e72656b 00006c65
      [   62.819936] 7ee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [   62.828095] 7f00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [   62.836255] 7f20: 00000000 00000000 00000000 00000000 00000000 00000000 00000003 0003b008
      [   62.844414] 7f40: 0000017b c000f5c8 eca76000 00000000 0003b008 c0085df8 f04ef000 0001b8a9
      [   62.852573] 7f60: f0503258 f05030c2 f0509fe8 00000968 00000dc8 00000000 00000000 00000000
      [   62.860732] 7f80: 00000029 0000002a 00000011 00000000 0000000a 00000000 33f6eb00 0003b008
      [   62.868892] 7fa0: bef01cac c000f400 33f6eb00 0003b008 00000003 0003b008 00000000 00000003
      [   62.877051] 7fc0: 33f6eb00 0003b008 bef01cac 0000017b 00000000 0003b008 0000000b 0003b008
      [   62.885210] 7fe0: bef01ae0 bef01ad0 0001dc23 b6e8c162 800b0070 00000003 c0c0c0c0 c0c0c0c0
      [   62.893380] [<c01277c0>] (kernfs_find_ns) from [<c0824888>] (pm_qos_latency_tolerance_attr_group+0x0/0x10)
      [   62.903005] Code: e28dd00c e8bd80f0 e92d41f0 e2923000 (e1d0e4b4)
      [   62.909115] ---[ end trace 02fb4373ef095c7b ]---
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NKrzysztof Opasiak <k.opasiak@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      5542f58c
    • R
      usb: gadget: atmel_usba_udc: add missing ret value check · 7674cba5
      Robert Baldyga 提交于
      Add missing return value check. In case of error print debug message
      and return error code.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Acked-by: NNicolas Ferre <nicolas.ferre@atmel.com>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      7674cba5
    • R
      usb: gadget: midi: avoid redundant f_midi_set_alt() call · 4ef7a4a1
      Robert Baldyga 提交于
      Function midi registers two interfaces with single set_alt() function
      which means that f_midi_set_alt() is called twice when configuration
      is set. That means that endpoint initialization and ep request allocation
      is done two times. To avoid this problem we do such things only once,
      for interface number 1 (MIDI Streaming interface).
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      4ef7a4a1
    • R
      usb: gadget: ffs: call functionfs_unbind() if _ffs_func_bind() fails · 55d81121
      Robert Baldyga 提交于
      Function ffs_do_functionfs_bind() calls functionfs_bind() which allocates
      usb request and increments refcounts. These things needs to be cleaned
      up by if further steps of initialization fail by calling functionfs_unbind().
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      55d81121
    • P
      usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth · 913e4a90
      Peter Chen 提交于
      According to USB Audio Device 2.0 Spec, Ch4.10.1.1:
      wMaxPacketSize is defined as follows:
      Maximum packet size this endpoint is capable of sending or receiving
      when this configuration is selected.
      This is determined by the audio bandwidth constraints of the endpoint.
      
      In current code, the wMaxPacketSize is defined as the maximum packet size
      for ISO endpoint, and it will let the host reserve much more space than
      it really needs, so that we can't let more endpoints work together at
      one frame.
      
      We find this issue when we try to let 4 f_uac2 gadgets work together [1]
      at FS connection.
      
      [1]http://www.spinics.net/lists/linux-usb/msg123478.htmlAcked-by: NDaniel Mack <zonque@gmail.com>
      Cc: andrzej.p@samsung.com
      Cc: Daniel Mack <zonque@gmail.com>
      Cc: tiwai@suse.de
      Cc: <stable@vger.kernel.org> #v3.18+
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NPeter Chen <peter.chen@freescale.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      913e4a90
    • S
      usb: gadget: f_mass_storage: stop thread in bind failure case · 8078f314
      Sanjay Singh Rawat 提交于
      After the worker thread is launched, bind function is doing further
      configuration. In case of failure stop the thread.
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Signed-off-by: NSanjay Singh Rawat <snjsrwt@gmail.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      8078f314
    • D
      usb: gadget: m66592-udc: forever loop in set_feature() · 5feb5d20
      Dan Carpenter 提交于
      There is an "&&" vs "||" typo here so this loops 3000 times or if we get
      unlucky it could loop forever.
      
      Fixes: ceaa0a6e ('usb: gadget: m66592-udc: add support for TEST_MODE')
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      5feb5d20
    • D
      usb: gadget: fotg210-udc: remove duplicate conditions · 1c99cabf
      Dan Carpenter 提交于
      We handle the "if (!req->req.length)" condition at the start of the
      function and return.  We can delete this dead code.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      1c99cabf
    • R
      usb: gadget: apply generic altsetting support check mechanism · 736d093b
      Robert Baldyga 提交于
      Replace calls of gadget_supports_altsettings() function (which check altset
      support by comparing UDC controller name with hardcoded names) with
      gadget_is_altset_supported() which checks generic quirk bitfield.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      736d093b
    • R
      usb: gadget: f_ecm/f_ncm: check quirk instead of UDC name · 7a896d40
      Robert Baldyga 提交于
      Use generic mechanism to check if UDC controller supports zlp.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      7a896d40
    • R
      usb: gadget: f_mass_storage: check quirk instead of UDC name · a4cc4215
      Robert Baldyga 提交于
      Use generic mechanism to check if UDC controller supports stalling.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      a4cc4215
    • R
      usb: gadget: add 'quirk_stall_not_supp' to usb_gadget · 02ded1b0
      Robert Baldyga 提交于
      Due to some UDC controllers may not support stalling, usb gadget layer
      needs to provide a generic way to inform gadget functions about non-standard
      hardware limitations.
      
      This patch adds 'quirk_stall_not_supp' field to struct usb_gadget and helper
      function gadget_is_stall_supported(). It also sets 'quirk_stall_not_supp'
      to 1 in at91_udc driver, which has such limitation.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      02ded1b0
    • R
      usb: gadget: add 'quirk_altset_not_supp' to usb_gadget · ffd9a0fc
      Robert Baldyga 提交于
      Due to some UDC controllers may not support altsettings, usb gadget layer
      needs to provide a generic way to inform gadget functions about non-standard
      hardware limitations.
      
      This patch adds 'quirk_altset_not_supp' field to struct usb_gadget and helper
      function gadget_is_altset_supported(). It also sets 'quirk_altset_not_supp'
      to 1 in pxa25x_udc and pxa27x_udc drivers, which have such limitation.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      ffd9a0fc
  2. 29 7月, 2015 26 次提交