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

Commit ff7f78ed authored by Josh Cartwright's avatar Josh Cartwright Committed by Gerrit - the friendly Code Review server
Browse files

smd: perform SMD channel scanning synchronously at probe



When using the board-file probe order optimizations, the following
sequence is executed early on kernel boot:

	- msm_smd_init()
	- msm_rpm_smd_init()

When msm_smd_init() is invoked, it sets up it's data structures and then
invokes smd_post_init(), which places the probe work item in the
workqueue.

However, it's possible that msm_rpm_smd_init() is executed before SMD's
probe work is even invoked.  In this case, the rpm-smd driver requests
access to the 'rpm_requests' channel, but because the SMD channels have
yet to be scanned, it does not exist.

Workaround this issue by forcing channel scanning to happen immediately
in msm_smd_post_init().

Change-Id: Ib364861886c2439b78bce284939aceff297adcdc
Signed-off-by: default avatarJosh Cartwright <joshc@codeaurora.org>
parent ac6c6499
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
@@ -725,22 +725,11 @@ static void scan_alloc_table(struct smd_alloc_elm *shared,
	}
}

/**
 * smd_channel_probe_worker() - Scan for newly created SMD channels and init
 *				local structures so the channels are visable to
 *				local clients
 *
 * @work: work_struct corresponding to an instance of this function running on
 *		a workqueue.
 */
static void smd_channel_probe_worker(struct work_struct *work)
static void smd_channel_probe_now(struct remote_proc_info *r_info)
{
	struct smd_alloc_elm *shared;
	struct remote_proc_info *r_info;
	unsigned tbl_size;

	r_info = container_of(work, struct remote_proc_info, probe_work);

	shared = smem_get_entry(ID_CH_ALLOC_TBL, &tbl_size,
							r_info->remote_pid, 0);

@@ -767,6 +756,23 @@ static void smd_channel_probe_worker(struct work_struct *work)
	mutex_unlock(&smd_probe_lock);
}

/**
 * smd_channel_probe_worker() - Scan for newly created SMD channels and init
 *				local structures so the channels are visable to
 *				local clients
 *
 * @work: work_struct corresponding to an instance of this function running on
 *		a workqueue.
 */
static void smd_channel_probe_worker(struct work_struct *work)
{
	struct remote_proc_info *r_info;

	r_info = container_of(work, struct remote_proc_info, probe_work);

	smd_channel_probe_now(r_info);
}

/**
 * get_remote_ch() - gathers remote channel info
 *
@@ -3057,7 +3063,7 @@ static int restart_notifier_cb(struct notifier_block *this,
 */
void smd_post_init(unsigned remote_pid)
{
	schedule_work(&remote_info[remote_pid].probe_work);
	smd_channel_probe_now(&remote_info[remote_pid]);
}

/**