Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c323905a authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "smcinvoke : Add locking to shared variables"

parents 43f48b51 15bff51c
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -1558,16 +1558,19 @@ static long process_accept_req(struct file *filp, unsigned int cmd,

	mutex_lock(&g_smcinvoke_lock);
	server_info = get_cb_server_locked(server_obj->server_id);
	mutex_unlock(&g_smcinvoke_lock);

	if (!server_info) {
		pr_err("No matching server with server id : %u found\n",
					server_obj->server_id);
		mutex_unlock(&g_smcinvoke_lock);
		return -EINVAL;
	}

	if (server_info->state == SMCINVOKE_SERVER_STATE_DEFUNCT)
		server_info->state = 0;

	mutex_unlock(&g_smcinvoke_lock);

	/* First check if it has response otherwise wait for req */
	if (user_args.has_resp) {
		mutex_lock(&g_smcinvoke_lock);
@@ -1946,7 +1949,6 @@ static int smcinvoke_probe(struct platform_device *pdev)
		goto exit_destroy_device;
	}
	smcinvoke_pdev = pdev;
	cb_reqs_inflight = 0;

	return  0;

@@ -1973,12 +1975,15 @@ static int smcinvoke_remove(struct platform_device *pdev)
static int __maybe_unused smcinvoke_suspend(struct platform_device *pdev,
					pm_message_t state)
{
	int ret = 0;

	mutex_lock(&g_smcinvoke_lock);
	if (cb_reqs_inflight) {
		pr_err("Failed to suspend smcinvoke driver\n");
		return -EIO;
		ret = -EIO;
	}

	return 0;
	mutex_unlock(&g_smcinvoke_lock);
	return ret;
}

static int __maybe_unused smcinvoke_resume(struct platform_device *pdev)