Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1350895 > unrolled thread
| Started by | Mark Brown <broonie@kernel.org> |
|---|---|
| First post | 2016-03-05 13:50 +0100 |
| Last post | 2016-03-05 13:50 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH V4 3/6] slimbus: Add messaging APIs to slimbus framework Mark Brown <broonie@kernel.org> - 2016-03-05 13:50 +0100
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2016-03-05 13:50 +0100 |
| Subject | Re: [PATCH V4 3/6] slimbus: Add messaging APIs to slimbus framework |
| Message-ID | <r9jOG-6fy-23@gated-at.bofh.it> |
[Multipart message — attachments visible in raw view] — view raw
On Sat, Feb 06, 2016 at 11:44:22AM -0700, Sagar Dharia wrote:
> + spin_lock_irqsave(&ctrl->txn_lock, flags);
> + msg = ctrl->tid_tbl[tid];
> + if (msg == NULL || msg->rbuf == NULL) {
> + spin_unlock_irqrestore(&ctrl->txn_lock, flags);
> + dev_err(&ctrl->dev, "Got response to invalid TID:%d, len:%d\n",
> + tid, len);
> + return;
> + }
> + memcpy(msg->rbuf, reply, len);
> + ctrl->tid_tbl[tid] = NULL;
> + if (msg->comp_cb)
> + msg->comp_cb(msg->ctx, 0);
> + spin_unlock_irqrestore(&ctrl->txn_lock, flags);
Do we need to hold the lock for so long (especially with things like the
memcpy())? As far as I can tell we only need the lock for this:
> + msg = ctrl->tid_tbl[tid];
> + ctrl->tid_tbl[tid] = NULL;
> + if (mc == SLIM_MSG_MC_REQUEST_CHANGE_VALUE ||
> + mc == SLIM_MSG_MC_CHANGE_VALUE ||
> + mc == SLIM_MSG_MC_REQUEST_CLEAR_INFORMATION ||
> + mc == SLIM_MSG_MC_CLEAR_INFORMATION)
> + txn->rl += msg->num_bytes;
A switch statement might be nicer here.
Back to top | Article view | linux.kernel
csiph-web