Bluetooth: Fix __hci_req_sync
authorAndre Guedes <andre.guedes@openbossa.org>
Fri, 8 Mar 2013 14:20:13 +0000 (11:20 -0300)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Sat, 9 Mar 2013 20:10:13 +0000 (17:10 -0300)
commitbc4445c72cb5d1ed5af80c73e60214ab5ebd8e55
tree9b6c9c535389a069b6b6ded72f797c77559ad81d
parentd865b0070485dfbb0611c5dc07fff21c440858a5
Bluetooth: Fix __hci_req_sync

If hci_req_run returns error, we erroneously leave the current
process in TASK_INTERRUPTABLE state. If we leave the process in
TASK_INTERRUPTABLE and it is preempted, this process will never
be scheduled again.

This patch fixes this issue by moving the preparation for scheduling
(add to waitqueue and set process state) to just after the hci_req_run
call.

Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Acked-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
net/bluetooth/hci_core.c