[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160305051325.GD18327@sirena.org.uk>
Date: Sat, 5 Mar 2016 14:13:25 +0900
From: Mark Brown <broonie@...nel.org>
To: Sagar Dharia <sdharia@...eaurora.org>
Cc: gregkh@...uxfoundation.org, bp@...e.de, poeschel@...onage.de,
treding@...dia.com, gong.chen@...ux.intel.com,
andreas.noever@...il.com, alan@...ux.intel.com,
mathieu.poirier@...aro.org, daniel@...ll.ch, oded.gabbay@....com,
jkosina@...e.cz, sharon.dvir1@...l.huji.ac.il, joe@...ches.com,
davem@...emloft.net, james.hogan@...tec.com,
michael.opdenacker@...e-electrons.com, daniel.thompson@...aro.org,
robh+dt@...nel.org, pawel.moll@....com, mark.rutland@....com,
ijc+devicetree@...lion.org.uk, galak@...eaurora.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
kheitke@...ience.com, mlocke@...eaurora.org, agross@...eaurora.org,
linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH V4 3/6] slimbus: Add messaging APIs to slimbus framework
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.
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists