Lines Matching refs:fw_download

33 	struct fw_download	*fw_download;
36 struct fw_download {
48 dev_dbg(fw_req->fw_download->parent, "firmware %s released\n",
66 ida_free(&fw_req->fw_download->id_map, fw_req->firmware_id);
91 static struct fw_request *get_fw_req(struct fw_download *fw_download,
96 mutex_lock(&fw_download->mutex);
98 list_for_each_entry(fw_req, &fw_download->fw_requests, node) {
108 mutex_unlock(&fw_download->mutex);
113 static void free_firmware(struct fw_download *fw_download,
120 mutex_lock(&fw_download->mutex);
122 mutex_unlock(&fw_download->mutex);
133 struct fw_download *fw_download = fw_req->fw_download;
135 dev_err(fw_download->parent,
140 free_firmware(fw_download, fw_req);
145 struct fw_download *fw_download = fw_req->fw_download;
150 dev_err(fw_download->parent,
155 free_firmware(fw_download, fw_req);
161 static struct fw_request *find_firmware(struct fw_download *fw_download,
164 struct gb_interface *intf = fw_download->connection->bundle->intf;
173 ret = ida_alloc_range(&fw_download->id_map, 1, 255, GFP_KERNEL);
175 dev_err(fw_download->parent,
186 dev_info(fw_download->parent, "Requested firmware package '%s'\n",
189 ret = request_firmware(&fw_req->fw, fw_req->name, fw_download->parent);
191 dev_err(fw_download->parent,
197 fw_req->fw_download = fw_download;
200 mutex_lock(&fw_download->mutex);
201 list_add(&fw_req->node, &fw_download->fw_requests);
202 mutex_unlock(&fw_download->mutex);
214 ida_free(&fw_download->id_map, fw_req->firmware_id);
224 struct fw_download *fw_download = gb_connection_get_data(connection);
231 dev_err(fw_download->parent,
243 dev_err(fw_download->parent,
248 fw_req = find_firmware(fw_download, tag);
253 dev_err(fw_download->parent, "error allocating response\n");
254 free_firmware(fw_download, fw_req);
262 dev_dbg(fw_download->parent,
271 struct fw_download *fw_download = gb_connection_get_data(connection);
281 dev_err(fw_download->parent,
292 fw_req = get_fw_req(fw_download, firmware_id);
294 dev_err(fw_download->parent,
320 dev_err(fw_download->parent,
329 dev_err(fw_download->parent,
338 dev_dbg(fw_download->parent,
354 struct fw_download *fw_download = gb_connection_get_data(connection);
360 dev_err(fw_download->parent,
369 fw_req = get_fw_req(fw_download, firmware_id);
371 dev_err(fw_download->parent,
378 free_firmware(fw_download, fw_req);
381 dev_dbg(fw_download->parent, "release firmware\n");
406 struct fw_download *fw_download;
412 fw_download = kzalloc(sizeof(*fw_download), GFP_KERNEL);
413 if (!fw_download)
416 fw_download->parent = &connection->bundle->dev;
417 INIT_LIST_HEAD(&fw_download->fw_requests);
418 ida_init(&fw_download->id_map);
419 gb_connection_set_data(connection, fw_download);
420 fw_download->connection = connection;
421 mutex_init(&fw_download->mutex);
430 ida_destroy(&fw_download->id_map);
431 kfree(fw_download);
438 struct fw_download *fw_download;
444 fw_download = gb_connection_get_data(connection);
445 gb_connection_disable(fw_download->connection);
451 mutex_lock(&fw_download->mutex);
452 list_for_each_entry(fw_req, &fw_download->fw_requests, node)
454 mutex_unlock(&fw_download->mutex);
457 list_for_each_entry_safe(fw_req, tmp, &fw_download->fw_requests, node) {
459 free_firmware(fw_download, fw_req);
463 ida_destroy(&fw_download->id_map);
464 kfree(fw_download);