fw_mgmt            66 drivers/staging/greybus/fw-management.c 	struct fw_mgmt *fw_mgmt = container_of(kref, struct fw_mgmt, kref);
fw_mgmt            68 drivers/staging/greybus/fw-management.c 	ida_destroy(&fw_mgmt->id_map);
fw_mgmt            69 drivers/staging/greybus/fw-management.c 	kfree(fw_mgmt);
fw_mgmt            77 drivers/staging/greybus/fw-management.c static void put_fw_mgmt(struct fw_mgmt *fw_mgmt)
fw_mgmt            79 drivers/staging/greybus/fw-management.c 	kref_put(&fw_mgmt->kref, fw_mgmt_kref_release);
fw_mgmt            83 drivers/staging/greybus/fw-management.c static struct fw_mgmt *get_fw_mgmt(struct cdev *cdev)
fw_mgmt            85 drivers/staging/greybus/fw-management.c 	struct fw_mgmt *fw_mgmt;
fw_mgmt            89 drivers/staging/greybus/fw-management.c 	list_for_each_entry(fw_mgmt, &fw_mgmt_list, node) {
fw_mgmt            90 drivers/staging/greybus/fw-management.c 		if (&fw_mgmt->cdev == cdev) {
fw_mgmt            91 drivers/staging/greybus/fw-management.c 			kref_get(&fw_mgmt->kref);
fw_mgmt            96 drivers/staging/greybus/fw-management.c 	fw_mgmt = NULL;
fw_mgmt           101 drivers/staging/greybus/fw-management.c 	return fw_mgmt;
fw_mgmt           104 drivers/staging/greybus/fw-management.c static int fw_mgmt_interface_fw_version_operation(struct fw_mgmt *fw_mgmt,
fw_mgmt           107 drivers/staging/greybus/fw-management.c 	struct gb_connection *connection = fw_mgmt->connection;
fw_mgmt           115 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent,
fw_mgmt           131 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent,
fw_mgmt           139 drivers/staging/greybus/fw-management.c static int fw_mgmt_load_and_validate_operation(struct fw_mgmt *fw_mgmt,
fw_mgmt           147 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent,
fw_mgmt           160 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent, "load-and-validate: firmware-tag is not NULL terminated\n");
fw_mgmt           165 drivers/staging/greybus/fw-management.c 	ret = ida_simple_get(&fw_mgmt->id_map, 1, 256, GFP_KERNEL);
fw_mgmt           167 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent, "failed to allocate request id (%d)\n",
fw_mgmt           172 drivers/staging/greybus/fw-management.c 	fw_mgmt->intf_fw_request_id = ret;
fw_mgmt           173 drivers/staging/greybus/fw-management.c 	fw_mgmt->intf_fw_loaded = false;
fw_mgmt           176 drivers/staging/greybus/fw-management.c 	ret = gb_operation_sync(fw_mgmt->connection,
fw_mgmt           180 drivers/staging/greybus/fw-management.c 		ida_simple_remove(&fw_mgmt->id_map,
fw_mgmt           181 drivers/staging/greybus/fw-management.c 				  fw_mgmt->intf_fw_request_id);
fw_mgmt           182 drivers/staging/greybus/fw-management.c 		fw_mgmt->intf_fw_request_id = 0;
fw_mgmt           183 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent,
fw_mgmt           195 drivers/staging/greybus/fw-management.c 	struct fw_mgmt *fw_mgmt = gb_connection_get_data(connection);
fw_mgmt           199 drivers/staging/greybus/fw-management.c 	if (!fw_mgmt->intf_fw_request_id) {
fw_mgmt           200 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent,
fw_mgmt           206 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent, "illegal size of firmware loaded request (%zu != %zu)\n",
fw_mgmt           214 drivers/staging/greybus/fw-management.c 	if (request->request_id != fw_mgmt->intf_fw_request_id) {
fw_mgmt           215 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent, "invalid request id for firmware loaded request (%02u != %02u)\n",
fw_mgmt           216 drivers/staging/greybus/fw-management.c 			fw_mgmt->intf_fw_request_id, request->request_id);
fw_mgmt           220 drivers/staging/greybus/fw-management.c 	ida_simple_remove(&fw_mgmt->id_map, fw_mgmt->intf_fw_request_id);
fw_mgmt           221 drivers/staging/greybus/fw-management.c 	fw_mgmt->intf_fw_request_id = 0;
fw_mgmt           222 drivers/staging/greybus/fw-management.c 	fw_mgmt->intf_fw_status = request->status;
fw_mgmt           223 drivers/staging/greybus/fw-management.c 	fw_mgmt->intf_fw_major = le16_to_cpu(request->major);
fw_mgmt           224 drivers/staging/greybus/fw-management.c 	fw_mgmt->intf_fw_minor = le16_to_cpu(request->minor);
fw_mgmt           226 drivers/staging/greybus/fw-management.c 	if (fw_mgmt->intf_fw_status == GB_FW_LOAD_STATUS_FAILED)
fw_mgmt           227 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent,
fw_mgmt           229 drivers/staging/greybus/fw-management.c 			fw_mgmt->intf_fw_status);
fw_mgmt           230 drivers/staging/greybus/fw-management.c 	else if (fw_mgmt->intf_fw_status == GB_FW_LOAD_STATUS_VALIDATION_FAILED)
fw_mgmt           231 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent,
fw_mgmt           233 drivers/staging/greybus/fw-management.c 			fw_mgmt->intf_fw_status);
fw_mgmt           235 drivers/staging/greybus/fw-management.c 		fw_mgmt->intf_fw_loaded = true;
fw_mgmt           237 drivers/staging/greybus/fw-management.c 	complete(&fw_mgmt->completion);
fw_mgmt           242 drivers/staging/greybus/fw-management.c static int fw_mgmt_backend_fw_version_operation(struct fw_mgmt *fw_mgmt,
fw_mgmt           245 drivers/staging/greybus/fw-management.c 	struct gb_connection *connection = fw_mgmt->connection;
fw_mgmt           258 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent, "backend-version: firmware-tag is not NULL terminated\n");
fw_mgmt           266 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent, "failed to get version of %s backend firmware (%d)\n",
fw_mgmt           286 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent,
fw_mgmt           291 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent, "Invalid status received: %u\n",
fw_mgmt           298 drivers/staging/greybus/fw-management.c static int fw_mgmt_backend_fw_update_operation(struct fw_mgmt *fw_mgmt,
fw_mgmt           311 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent, "backend-update: firmware-tag is not NULL terminated\n");
fw_mgmt           316 drivers/staging/greybus/fw-management.c 	ret = ida_simple_get(&fw_mgmt->id_map, 1, 256, GFP_KERNEL);
fw_mgmt           318 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent, "failed to allocate request id (%d)\n",
fw_mgmt           323 drivers/staging/greybus/fw-management.c 	fw_mgmt->backend_fw_request_id = ret;
fw_mgmt           326 drivers/staging/greybus/fw-management.c 	ret = gb_operation_sync(fw_mgmt->connection,
fw_mgmt           330 drivers/staging/greybus/fw-management.c 		ida_simple_remove(&fw_mgmt->id_map,
fw_mgmt           331 drivers/staging/greybus/fw-management.c 				  fw_mgmt->backend_fw_request_id);
fw_mgmt           332 drivers/staging/greybus/fw-management.c 		fw_mgmt->backend_fw_request_id = 0;
fw_mgmt           333 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent,
fw_mgmt           345 drivers/staging/greybus/fw-management.c 	struct fw_mgmt *fw_mgmt = gb_connection_get_data(connection);
fw_mgmt           349 drivers/staging/greybus/fw-management.c 	if (!fw_mgmt->backend_fw_request_id) {
fw_mgmt           350 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent, "unexpected backend firmware updated request received\n");
fw_mgmt           355 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent, "illegal size of backend firmware updated request (%zu != %zu)\n",
fw_mgmt           363 drivers/staging/greybus/fw-management.c 	if (request->request_id != fw_mgmt->backend_fw_request_id) {
fw_mgmt           364 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent, "invalid request id for backend firmware updated request (%02u != %02u)\n",
fw_mgmt           365 drivers/staging/greybus/fw-management.c 			fw_mgmt->backend_fw_request_id, request->request_id);
fw_mgmt           369 drivers/staging/greybus/fw-management.c 	ida_simple_remove(&fw_mgmt->id_map, fw_mgmt->backend_fw_request_id);
fw_mgmt           370 drivers/staging/greybus/fw-management.c 	fw_mgmt->backend_fw_request_id = 0;
fw_mgmt           371 drivers/staging/greybus/fw-management.c 	fw_mgmt->backend_fw_status = request->status;
fw_mgmt           373 drivers/staging/greybus/fw-management.c 	if ((fw_mgmt->backend_fw_status != GB_FW_BACKEND_FW_STATUS_SUCCESS) &&
fw_mgmt           374 drivers/staging/greybus/fw-management.c 	    (fw_mgmt->backend_fw_status != GB_FW_BACKEND_FW_STATUS_RETRY))
fw_mgmt           375 drivers/staging/greybus/fw-management.c 		dev_err(fw_mgmt->parent,
fw_mgmt           377 drivers/staging/greybus/fw-management.c 			fw_mgmt->backend_fw_status);
fw_mgmt           379 drivers/staging/greybus/fw-management.c 	complete(&fw_mgmt->completion);
fw_mgmt           388 drivers/staging/greybus/fw-management.c 	struct fw_mgmt *fw_mgmt = get_fw_mgmt(inode->i_cdev);
fw_mgmt           391 drivers/staging/greybus/fw-management.c 	if (fw_mgmt) {
fw_mgmt           392 drivers/staging/greybus/fw-management.c 		file->private_data = fw_mgmt;
fw_mgmt           401 drivers/staging/greybus/fw-management.c 	struct fw_mgmt *fw_mgmt = file->private_data;
fw_mgmt           403 drivers/staging/greybus/fw-management.c 	put_fw_mgmt(fw_mgmt);
fw_mgmt           407 drivers/staging/greybus/fw-management.c static int fw_mgmt_ioctl(struct fw_mgmt *fw_mgmt, unsigned int cmd,
fw_mgmt           418 drivers/staging/greybus/fw-management.c 	if (fw_mgmt->mode_switch_started)
fw_mgmt           423 drivers/staging/greybus/fw-management.c 		ret = fw_mgmt_interface_fw_version_operation(fw_mgmt,
fw_mgmt           437 drivers/staging/greybus/fw-management.c 		ret = fw_mgmt_backend_fw_version_operation(fw_mgmt,
fw_mgmt           451 drivers/staging/greybus/fw-management.c 		ret = fw_mgmt_load_and_validate_operation(fw_mgmt,
fw_mgmt           456 drivers/staging/greybus/fw-management.c 		if (!wait_for_completion_timeout(&fw_mgmt->completion,
fw_mgmt           457 drivers/staging/greybus/fw-management.c 						 fw_mgmt->timeout_jiffies)) {
fw_mgmt           458 drivers/staging/greybus/fw-management.c 			dev_err(fw_mgmt->parent, "timed out waiting for firmware load and validation to finish\n");
fw_mgmt           462 drivers/staging/greybus/fw-management.c 		intf_load.status = fw_mgmt->intf_fw_status;
fw_mgmt           463 drivers/staging/greybus/fw-management.c 		intf_load.major = fw_mgmt->intf_fw_major;
fw_mgmt           464 drivers/staging/greybus/fw-management.c 		intf_load.minor = fw_mgmt->intf_fw_minor;
fw_mgmt           475 drivers/staging/greybus/fw-management.c 		ret = fw_mgmt_backend_fw_update_operation(fw_mgmt,
fw_mgmt           480 drivers/staging/greybus/fw-management.c 		if (!wait_for_completion_timeout(&fw_mgmt->completion,
fw_mgmt           481 drivers/staging/greybus/fw-management.c 						 fw_mgmt->timeout_jiffies)) {
fw_mgmt           482 drivers/staging/greybus/fw-management.c 			dev_err(fw_mgmt->parent, "timed out waiting for backend firmware update to finish\n");
fw_mgmt           486 drivers/staging/greybus/fw-management.c 		backend_update.status = fw_mgmt->backend_fw_status;
fw_mgmt           497 drivers/staging/greybus/fw-management.c 			dev_err(fw_mgmt->parent, "timeout can't be zero\n");
fw_mgmt           501 drivers/staging/greybus/fw-management.c 		fw_mgmt->timeout_jiffies = msecs_to_jiffies(timeout);
fw_mgmt           505 drivers/staging/greybus/fw-management.c 		if (!fw_mgmt->intf_fw_loaded) {
fw_mgmt           506 drivers/staging/greybus/fw-management.c 			dev_err(fw_mgmt->parent,
fw_mgmt           516 drivers/staging/greybus/fw-management.c 		fw_mgmt->mode_switch_started = true;
fw_mgmt           518 drivers/staging/greybus/fw-management.c 		ret = gb_interface_request_mode_switch(fw_mgmt->connection->intf);
fw_mgmt           520 drivers/staging/greybus/fw-management.c 			dev_err(fw_mgmt->parent, "Mode-switch failed: %d\n",
fw_mgmt           522 drivers/staging/greybus/fw-management.c 			fw_mgmt->mode_switch_started = false;
fw_mgmt           535 drivers/staging/greybus/fw-management.c 	struct fw_mgmt *fw_mgmt = file->private_data;
fw_mgmt           536 drivers/staging/greybus/fw-management.c 	struct gb_bundle *bundle = fw_mgmt->connection->bundle;
fw_mgmt           551 drivers/staging/greybus/fw-management.c 	mutex_lock(&fw_mgmt->mutex);
fw_mgmt           552 drivers/staging/greybus/fw-management.c 	if (!fw_mgmt->disabled) {
fw_mgmt           555 drivers/staging/greybus/fw-management.c 			ret = fw_mgmt_ioctl(fw_mgmt, cmd, (void __user *)arg);
fw_mgmt           559 drivers/staging/greybus/fw-management.c 	mutex_unlock(&fw_mgmt->mutex);
fw_mgmt           589 drivers/staging/greybus/fw-management.c 	struct fw_mgmt *fw_mgmt;
fw_mgmt           595 drivers/staging/greybus/fw-management.c 	fw_mgmt = kzalloc(sizeof(*fw_mgmt), GFP_KERNEL);
fw_mgmt           596 drivers/staging/greybus/fw-management.c 	if (!fw_mgmt)
fw_mgmt           599 drivers/staging/greybus/fw-management.c 	fw_mgmt->parent = &connection->bundle->dev;
fw_mgmt           600 drivers/staging/greybus/fw-management.c 	fw_mgmt->timeout_jiffies = msecs_to_jiffies(FW_MGMT_TIMEOUT_MS);
fw_mgmt           601 drivers/staging/greybus/fw-management.c 	fw_mgmt->connection = connection;
fw_mgmt           603 drivers/staging/greybus/fw-management.c 	gb_connection_set_data(connection, fw_mgmt);
fw_mgmt           604 drivers/staging/greybus/fw-management.c 	init_completion(&fw_mgmt->completion);
fw_mgmt           605 drivers/staging/greybus/fw-management.c 	ida_init(&fw_mgmt->id_map);
fw_mgmt           606 drivers/staging/greybus/fw-management.c 	mutex_init(&fw_mgmt->mutex);
fw_mgmt           607 drivers/staging/greybus/fw-management.c 	kref_init(&fw_mgmt->kref);
fw_mgmt           610 drivers/staging/greybus/fw-management.c 	list_add(&fw_mgmt->node, &fw_mgmt_list);
fw_mgmt           624 drivers/staging/greybus/fw-management.c 	fw_mgmt->dev_num = MKDEV(MAJOR(fw_mgmt_dev_num), minor);
fw_mgmt           625 drivers/staging/greybus/fw-management.c 	cdev_init(&fw_mgmt->cdev, &fw_mgmt_fops);
fw_mgmt           627 drivers/staging/greybus/fw-management.c 	ret = cdev_add(&fw_mgmt->cdev, fw_mgmt->dev_num, 1);
fw_mgmt           632 drivers/staging/greybus/fw-management.c 	fw_mgmt->class_device = device_create(fw_mgmt_class, fw_mgmt->parent,
fw_mgmt           633 drivers/staging/greybus/fw-management.c 					      fw_mgmt->dev_num, NULL,
fw_mgmt           635 drivers/staging/greybus/fw-management.c 	if (IS_ERR(fw_mgmt->class_device)) {
fw_mgmt           636 drivers/staging/greybus/fw-management.c 		ret = PTR_ERR(fw_mgmt->class_device);
fw_mgmt           643 drivers/staging/greybus/fw-management.c 	cdev_del(&fw_mgmt->cdev);
fw_mgmt           650 drivers/staging/greybus/fw-management.c 	list_del(&fw_mgmt->node);
fw_mgmt           653 drivers/staging/greybus/fw-management.c 	put_fw_mgmt(fw_mgmt);
fw_mgmt           660 drivers/staging/greybus/fw-management.c 	struct fw_mgmt *fw_mgmt;
fw_mgmt           665 drivers/staging/greybus/fw-management.c 	fw_mgmt = gb_connection_get_data(connection);
fw_mgmt           667 drivers/staging/greybus/fw-management.c 	device_destroy(fw_mgmt_class, fw_mgmt->dev_num);
fw_mgmt           668 drivers/staging/greybus/fw-management.c 	cdev_del(&fw_mgmt->cdev);
fw_mgmt           669 drivers/staging/greybus/fw-management.c 	ida_simple_remove(&fw_mgmt_minors_map, MINOR(fw_mgmt->dev_num));
fw_mgmt           675 drivers/staging/greybus/fw-management.c 	mutex_lock(&fw_mgmt->mutex);
fw_mgmt           676 drivers/staging/greybus/fw-management.c 	fw_mgmt->disabled = true;
fw_mgmt           677 drivers/staging/greybus/fw-management.c 	mutex_unlock(&fw_mgmt->mutex);
fw_mgmt           680 drivers/staging/greybus/fw-management.c 	gb_connection_disable(fw_mgmt->connection);
fw_mgmt           684 drivers/staging/greybus/fw-management.c 	list_del(&fw_mgmt->node);
fw_mgmt           692 drivers/staging/greybus/fw-management.c 	put_fw_mgmt(fw_mgmt);