Lines Matching defs:cmd
93 int mgmt_cmd_status(struct sock *sk, u16 index, u16 cmd, u8 status)
100 BT_DBG("sock %p, index %u, cmd %u, status %u", sk, index, cmd, status);
114 ev->opcode = cpu_to_le16(cmd);
136 int mgmt_cmd_complete(struct sock *sk, u16 index, u16 cmd, u8 status,
157 ev->opcode = cpu_to_le16(cmd);
187 struct mgmt_pending_cmd *cmd;
189 list_for_each_entry(cmd, &hdev->mgmt_pending, list) {
190 if (hci_sock_get_channel(cmd->sk) != channel)
192 if (cmd->opcode == opcode)
193 return cmd;
204 struct mgmt_pending_cmd *cmd;
206 list_for_each_entry(cmd, &hdev->mgmt_pending, list) {
207 if (cmd->user_data != data)
209 if (cmd->opcode == opcode)
210 return cmd;
217 void (*cb)(struct mgmt_pending_cmd *cmd, void *data),
220 struct mgmt_pending_cmd *cmd, *tmp;
222 list_for_each_entry_safe(cmd, tmp, &hdev->mgmt_pending, list) {
223 if (opcode > 0 && cmd->opcode != opcode)
226 cb(cmd, data);
234 struct mgmt_pending_cmd *cmd;
236 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
237 if (!cmd)
240 cmd->opcode = opcode;
241 cmd->index = hdev->id;
243 cmd->param = kmemdup(data, len, GFP_KERNEL);
244 if (!cmd->param) {
245 kfree(cmd);
249 cmd->param_len = len;
251 cmd->sk = sk;
254 list_add(&cmd->list, &hdev->mgmt_pending);
256 return cmd;
259 void mgmt_pending_free(struct mgmt_pending_cmd *cmd)
261 sock_put(cmd->sk);
262 kfree(cmd->param);
263 kfree(cmd);
266 void mgmt_pending_remove(struct mgmt_pending_cmd *cmd)
268 list_del(&cmd->list);
269 mgmt_pending_free(cmd);