This patch moves all cancel inquiry code from stop_discovery() to a new function called cancel_inquiry(). Signed-off-by: Andre Guedes <andre.guedes@xxxxxxxxxxxxx> --- net/bluetooth/mgmt.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 21bbf69..36f6bc2 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -1647,6 +1647,12 @@ failed: return err; } +/* hdev must be locked */ +static inline int cancel_inquiry(struct hci_dev *hdev) +{ + return hci_send_cmd(hdev, HCI_OP_INQUIRY_CANCEL, 0, NULL); +} + static int stop_discovery(struct sock *sk, u16 index) { struct hci_dev *hdev; @@ -1679,7 +1685,7 @@ static int stop_discovery(struct sock *sk, u16 index) } if (test_bit(HCI_INQUIRY, &hdev->flags)) - err = hci_send_cmd(hdev, HCI_OP_INQUIRY_CANCEL, 0, NULL); + err = cancel_inquiry(hdev); if (err < 0) mgmt_pending_remove(cmd); -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html