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

Commit a3298c3d authored by Skylar Chang's avatar Skylar Chang
Browse files

msm: gsi: fix IPC low priority logging



Allocate IPC low priority on first usage only.

Change-Id: Ic44f5af02d1d7fd72b255c8989cfc6b7dcd7766d
CRs-Fixed: 2016076
Acked-by: default avatarAdy Abraham <adya@qti,qualcomm.com>
Signed-off-by: default avatarSkylar Chang <chiaweic@codeaurora.org>
parent 0a4d1ddb
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@

static struct dentry *dent;
static char dbg_buff[4096];
static void *gsi_ipc_logbuf_low;

static void gsi_wq_print_dp_stats(struct work_struct *work);
static DECLARE_DELAYED_WORK(gsi_print_dp_stats_work, gsi_wq_print_dp_stats);
@@ -758,22 +759,20 @@ static ssize_t gsi_enable_ipc_low(struct file *file,
	if (kstrtos8(dbg_buff, 0, &option))
		return -EFAULT;

	mutex_lock(&gsi_ctx->mlock);
	if (option) {
		if (!gsi_ctx->ipc_logbuf_low) {
			gsi_ctx->ipc_logbuf_low =
		if (!gsi_ipc_logbuf_low) {
			gsi_ipc_logbuf_low =
				ipc_log_context_create(GSI_IPC_LOG_PAGES,
					"gsi_low", 0);
		}

		if (gsi_ctx->ipc_logbuf_low == NULL) {
			if (gsi_ipc_logbuf_low == NULL)
				TERR("failed to get ipc_logbuf_low\n");
			return -EFAULT;
		}
		gsi_ctx->ipc_logbuf_low = gsi_ipc_logbuf_low;
	} else {
		if (gsi_ctx->ipc_logbuf_low)
			ipc_log_context_destroy(gsi_ctx->ipc_logbuf_low);
		gsi_ctx->ipc_logbuf_low = NULL;
	}
	mutex_unlock(&gsi_ctx->mlock);

	return count;
}