Thread (19 messages) 19 messages, 3 authors, 2015-08-17

Re: [PATCH V3 3/6] slimbus: Add messaging APIs to slimbus framework

From: Mark Brown <broonie@kernel.org>
Date: 2015-08-15 02:14:16
Also in: linux-arm-msm, lkml

On Mon, Aug 03, 2015 at 12:59:47AM -0600, Sagar Dharia wrote:
+	sema_init(&ctrl->tx_sem, (ctrl->tx.n - 1));
This sempahore counts the number of free slots in the statically
allocated list of transfers we have allocated.  It would be good to see
some discussion in the changelog as to why we've got this statically
allocated pool rather than just dynamically allocating them as needed -
I can see a performance argument there but it'd be good to have the
thinking documented.
+	buf = slim_get_tx(ctrl, txn, need_tid, async);
+	if (!buf)
+		return -ENOMEM;
+
+	if (need_tid) {
+		spin_lock_irqsave(&ctrl->txn_lock, flags);
+		for (i = 0; i < ctrl->last_tid; i++) {
+			if (ctrl->tid_tbl[i] == NULL)
+				break;
+		}
+		if (i >= ctrl->last_tid) {
+			if (ctrl->last_tid == (SLIM_MAX_TIDS - 1)) {
+				spin_unlock_irqrestore(&ctrl->txn_lock, flags);
+				return -ENOMEM;
We don't undo slim_get_tx() here but the definition looks like we ought
to be returning the buffer we allocated.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help