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

Commit 54f3e657 authored by Vamsi Krishna Gattupalli's avatar Vamsi Krishna Gattupalli
Browse files

msm: adsprpc: Wait for actual shutdown to complete



Wait for shutdown to complete, before further unmapping
memory in release.

Change-Id: Ic574a3e851f99aa946b2e062fa7a752c64b9f2b2
Acked-by: default avatarDeepika Singh <dsi@qti.qualcomm.com>
Signed-off-by: default avatarVamsi Krishna Gattupalli <quic_vgattupa@quicinc.com>
parent 7e6242a7
Loading
Loading
Loading
Loading
+17 −1
Original line number Original line Diff line number Diff line
@@ -484,6 +484,7 @@ struct fastrpc_file {
	int debug_buf_alloced_attempted;
	int debug_buf_alloced_attempted;
	/* Flag to indicate dynamic process creation status*/
	/* Flag to indicate dynamic process creation status*/
	bool in_process_create;
	bool in_process_create;
	struct completion shutdown;
};
};


static struct fastrpc_apps gfa;
static struct fastrpc_apps gfa;
@@ -2971,8 +2972,10 @@ static int fastrpc_release_current_dsp_process(struct fastrpc_file *fl)
	if (err)
	if (err)
		goto bail;
		goto bail;
	VERIFY(err, fl->apps->channel[fl->cid].issubsystemup == 1);
	VERIFY(err, fl->apps->channel[fl->cid].issubsystemup == 1);
	if (err)
	if (err) {
		wait_for_completion(&fl->shutdown);
		goto bail;
		goto bail;
	}
	tgid = fl->tgid;
	tgid = fl->tgid;
	ra[0].buf.pv = (void *)&tgid;
	ra[0].buf.pv = (void *)&tgid;
	ra[0].buf.len = sizeof(tgid);
	ra[0].buf.len = sizeof(tgid);
@@ -4129,6 +4132,7 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp)
	hlist_add_head(&fl->hn, &me->drivers);
	hlist_add_head(&fl->hn, &me->drivers);
	spin_unlock(&me->hlock);
	spin_unlock(&me->hlock);
	mutex_init(&fl->perf_mutex);
	mutex_init(&fl->perf_mutex);
	init_completion(&fl->shutdown);
	return 0;
	return 0;
}
}


@@ -4614,6 +4618,8 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb,
{
{
	struct fastrpc_apps *me = &gfa;
	struct fastrpc_apps *me = &gfa;
	struct fastrpc_channel_ctx *ctx;
	struct fastrpc_channel_ctx *ctx;
	struct fastrpc_file *fl;
	struct hlist_node *n;
	struct notif_data *notifdata = (struct notif_data *)data;
	struct notif_data *notifdata = (struct notif_data *)data;
	int cid = -1;
	int cid = -1;


@@ -4626,6 +4632,16 @@ static int fastrpc_restart_notifier_cb(struct notifier_block *nb,
		ctx->ssrcount++;
		ctx->ssrcount++;
		ctx->issubsystemup = 0;
		ctx->issubsystemup = 0;
		mutex_unlock(&me->channel[cid].smd_mutex);
		mutex_unlock(&me->channel[cid].smd_mutex);
	} else if (code == SUBSYS_AFTER_SHUTDOWN) {
		pr_info("adsprpc: %s: %s subsystem is down\n",
			__func__, gcinfo[cid].subsys);
		spin_lock(&me->hlock);
		hlist_for_each_entry_safe(fl, n, &me->drivers, hn) {
			if (fl->cid != cid)
				continue;
			complete(&fl->shutdown);
		}
		spin_unlock(&me->hlock);
	} else if (code == SUBSYS_RAMDUMP_NOTIFICATION) {
	} else if (code == SUBSYS_RAMDUMP_NOTIFICATION) {
		if (cid == RH_CID) {
		if (cid == RH_CID) {
			if (me->ramdump_handle)
			if (me->ramdump_handle)