Bluetooth: Move handling of HCI_RUNNING flag into core
Setting and clearing of HCI_RUNNING flag in each and every driver is just duplicating the same code all over the place. So instead of having the driver do it in their hdev->open and hdev->close callbacks, set it globally in the core transport handling. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
73d0d3c867
commit
e9ca8bf157
13 changed files with 4 additions and 82 deletions
|
@ -1385,6 +1385,7 @@ static int hci_dev_do_open(struct hci_dev *hdev)
|
|||
goto done;
|
||||
}
|
||||
|
||||
set_bit(HCI_RUNNING, &hdev->flags);
|
||||
hci_notify(hdev, HCI_DEV_OPEN);
|
||||
|
||||
atomic_set(&hdev->cmd_cnt, 1);
|
||||
|
@ -1468,6 +1469,7 @@ static int hci_dev_do_open(struct hci_dev *hdev)
|
|||
hdev->sent_cmd = NULL;
|
||||
}
|
||||
|
||||
clear_bit(HCI_RUNNING, &hdev->flags);
|
||||
hci_notify(hdev, HCI_DEV_CLOSE);
|
||||
|
||||
hdev->close(hdev);
|
||||
|
@ -1653,6 +1655,7 @@ int hci_dev_do_close(struct hci_dev *hdev)
|
|||
hdev->sent_cmd = NULL;
|
||||
}
|
||||
|
||||
clear_bit(HCI_RUNNING, &hdev->flags);
|
||||
hci_notify(hdev, HCI_DEV_CLOSE);
|
||||
|
||||
/* After this point our queues are empty
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue