|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | +/* |
| 3 | + * BlueZ - Bluetooth protocol stack for Linux |
| 4 | + * |
| 5 | + * Copyright (C) 2021 Intel Corporation |
| 6 | + */ |
| 7 | + |
| 8 | +typedef int (*hci_cmd_sync_work_func_t)(struct hci_dev *hdev, void *data); |
| 9 | +typedef void (*hci_cmd_sync_work_destroy_t)(struct hci_dev *hdev, void *data, |
| 10 | + int err); |
| 11 | + |
| 12 | +struct hci_cmd_sync_work_entry { |
| 13 | + struct list_head list; |
| 14 | + hci_cmd_sync_work_func_t func; |
| 15 | + void *data; |
| 16 | + hci_cmd_sync_work_destroy_t destroy; |
| 17 | +}; |
| 18 | + |
| 19 | +/* Function with sync suffix shall not be called with hdev->lock held as they |
| 20 | + * wait the command to complete and in the meantime an event could be received |
| 21 | + * which could attempt to acquire hdev->lock causing a deadlock. |
| 22 | + */ |
| 23 | +struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, |
| 24 | + const void *param, u32 timeout); |
| 25 | +struct sk_buff *hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, |
| 26 | + const void *param, u32 timeout); |
| 27 | +struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, |
| 28 | + const void *param, u8 event, u32 timeout); |
| 29 | +struct sk_buff *__hci_cmd_sync_sk(struct hci_dev *hdev, u16 opcode, u32 plen, |
| 30 | + const void *param, u8 event, u32 timeout, |
| 31 | + struct sock *sk); |
| 32 | +int __hci_cmd_sync_status(struct hci_dev *hdev, u16 opcode, u32 plen, |
| 33 | + const void *param, u32 timeout); |
| 34 | +int __hci_cmd_sync_status_sk(struct hci_dev *hdev, u16 opcode, u32 plen, |
| 35 | + const void *param, u8 event, u32 timeout, |
| 36 | + struct sock *sk); |
| 37 | + |
| 38 | +void hci_cmd_sync_init(struct hci_dev *hdev); |
| 39 | +void hci_cmd_sync_clear(struct hci_dev *hdev); |
| 40 | + |
| 41 | +int hci_cmd_sync_queue(struct hci_dev *hdev, hci_cmd_sync_work_func_t func, |
| 42 | + void *data, hci_cmd_sync_work_destroy_t destroy); |
0 commit comments