• Johan Hedberg's avatar
    Bluetooth: Use async requests internally in hci_req_sync · 42c6b129
    Johan Hedberg authored
    This patch converts the hci_req_sync() procedure to internaly use the
    asynchronous HCI requests.
    
    The hci_req_sync mechanism relies on hci_req_complete() calls from
    hci_event.c into hci_core.c whenever a HCI command completes. This is
    very similar to what asynchronous requests do and makes the conversion
    fairly straight forward by converting hci_req_complete into a request
    complete callback. By this change hci_req_complete (renamed to
    hci_req_sync_complete) becomes private to hci_core.c and all calls to it
    can be removed from hci_event.c.
    
    The commands in each hci_req_sync procedure are collected into their own
    request by passing the hci_request pointer to the request callback
    (instead of the hci_dev pointer). The one slight exception is the HCI
    init request which has the special handling of HCI driver specific
    initialization commands. These commands are run in their own request
    prior to the "main" init request.
    
    One other extra change that this patch must contain is the handling of
    spontaneous HCI reset complete events that some controllers exhibit.
    These were previously handled in the hci_req_complete function but the
    right place for them now becomes the hci_req_cmd_complete function.
    Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
    Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
    Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
    42c6b129
hci_event.c 90.9 KB