usb: gadget: udc: fix spin_lock in pch_udc
authorPengyu Ma <pengyu.ma@windriver.com>
Mon, 3 Aug 2015 03:28:24 +0000 (11:28 +0800)
committerFelipe Balbi <balbi@ti.com>
Mon, 3 Aug 2015 14:44:47 +0000 (09:44 -0500)
commitd3cb25a12138a09bc948c0091d3d42e519980659
tree3032ed2fc90747e3306bc457f70f206261ac03e5
parentf811a38300be3cdb603171aea5ad3fb42b71ca53
usb: gadget: udc: fix spin_lock in pch_udc

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: Pengyu Ma <pengyu.ma@windriver.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/udc/pch_udc.c