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

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

Merge "slimbus: Re-organize the mutex lock for reconfigure_now api"

parents ba4a167f 240b4eaf
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -2897,7 +2897,8 @@ static void slim_chan_changes(struct slim_device *sb, bool revert)
 * This API does what commit flag in other scheduling APIs do.
 * -EXFULL is returned if there is no space in TDM to reserve the
 * bandwidth. -EBUSY is returned if reconfiguration request is already in
 * progress.
 * progress. This API caller should take care of the mutex lock for
 * ctrl->sched.m_reconf.
 */
int slim_reconfigure_now(struct slim_device *sb)
{
@@ -2913,7 +2914,6 @@ int slim_reconfigure_now(struct slim_device *sb)
	DEFINE_SLIM_BCAST_TXN(txn, SLIM_MSG_MC_BEGIN_RECONFIGURATION, 0, 3,
				NULL, NULL, sb->laddr);

	mutex_lock(&ctrl->sched.m_reconf);
	/*
	 * If there are no pending changes from this client, avoid sending
	 * the reconfiguration sequence
@@ -3155,7 +3155,6 @@ int slim_reconfigure_now(struct slim_device *sb)
revert_reconfig:
	/* Revert channel changes */
	slim_chan_changes(sb, true);
	mutex_unlock(&ctrl->sched.m_reconf);
	return ret;
}
EXPORT_SYMBOL(slim_reconfigure_now);
@@ -3264,9 +3263,9 @@ int slim_control_ch(struct slim_device *sb, u16 chanh,
		if (nchan < SLIM_GRP_TO_NCHAN(chanh))
			chan = SLIM_HDL_TO_CHIDX(slc->nextgrp);
	} while (nchan < SLIM_GRP_TO_NCHAN(chanh));
	mutex_unlock(&ctrl->sched.m_reconf);
	if (!ret && commit)
		ret = slim_reconfigure_now(sb);
	mutex_unlock(&ctrl->sched.m_reconf);
	mutex_unlock(&sb->sldev_reconf);
	return ret;
}
@@ -3300,8 +3299,11 @@ int slim_reservemsg_bw(struct slim_device *sb, u32 bw_bps, bool commit)
	dev_dbg(&ctrl->dev, "request:bw:%d, slots:%d, current:%d\n", bw_bps, sl,
						sb->cur_msgsl);
	sb->pending_msgsl = sl;
	if (commit)
	if (commit) {
		mutex_lock(&ctrl->sched.m_reconf);
		ret = slim_reconfigure_now(sb);
		mutex_unlock(&ctrl->sched.m_reconf);
	}
	mutex_unlock(&sb->sldev_reconf);
	return ret;
}