[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150615110837.GL18309@sirena.org.uk>
Date: Mon, 15 Jun 2015 12:08:37 +0100
From: Mark Brown <broonie@...nel.org>
To: Sagar Dharia <sdharia@...eaurora.org>
Cc: gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
bp@...e.de, poeschel@...onage.de, santosh.shilimkar@...com,
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,
nkaje@...eaurora.org, mbutler@...ience.com, kheitke@...ience.com,
mlocke@...eaurora.org, agross@...eaurora.org,
linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH 3/3] slimbus: Add messaging APIs to slimbus framework
On Sat, Jun 13, 2015 at 11:49:18PM -0600, Sagar Dharia wrote:
> + if (txn->mt == SLIM_MSG_MT_CORE &&
> + (txn->mc == SLIM_MSG_MC_REQUEST_INFORMATION ||
> + txn->mc == SLIM_MSG_MC_REQUEST_CLEAR_INFORMATION ||
> + txn->mc == SLIM_MSG_MC_REQUEST_VALUE ||
> + txn->mc == SLIM_MSG_MC_REQUEST_CLEAR_INFORMATION)) {
The mc comparison here looks like you meant to write a switch
statement.
> + ret = ctrl->xfer_msg(ctrl, txn);
> + return ret;
> +}
No need for ret here.
> +static int slim_xfer_msg(struct slim_controller *ctrl,
> + struct slim_device *sbdev, struct slim_val_inf *msg,
> + u8 mc)
> +{
> + DEFINE_SLIM_LDEST_TXN(txn_stack, mc, 6, sbdev->laddr, msg);
> + struct slim_msg_txn *txn = &txn_stack;
> + int ret;
> + unsigned long flags;
> + u16 sl, cur;
> + bool tid_txn, async = false;
> + DECLARE_COMPLETION_ONSTACK(complete);
> +
> + ret = slim_val_inf_sanity(msg, mc);
> + if (ret) {
> + pr_err("Sanity check failed for msg:offset:0x%x, mc:%d",
> + msg->start_offset, mc);
dev_err() seems better, and if you're going to print an error on this
why not move the error prints into the sanity check so someone seeing
the error message can tell what went wrong?
> + sl = slim_slicesize(msg->num_bytes);
> + dev_err(&ctrl->dev, "SB xfer msg:os:%x, len:%d, MC:%x, sl:%x\n",
> + msg->start_offset, msg->num_bytes, mc, sl);
Looks like you left osme debug statements in here.
> + if (!msg->comp_cb && tid_txn) {
> + msg->comp_cb = slim_sync_default_cb;
> + msg->ctx = &complete;
> + } else
> + async = true;
Coding style: if you have braces on one branch of an if they should be
on both.
> + /* sync read */
> + if (!ret && tid_txn && !async) {
> + ret = wait_for_completion_timeout(&complete, HZ);
> + if (!ret)
> + ret = -ETIMEDOUT;
> + else
> + ret = 0;
> + }
Are we sure that HZ is a good timeout here - might it be too short or
too long for some users?
> diff --git a/include/linux/slimbus.h b/include/linux/slimbus.h
> index 61b7c74..1d98c58 100644
> --- a/include/linux/slimbus.h
> +++ b/include/linux/slimbus.h
> @@ -34,6 +34,7 @@ extern struct bus_type slimbus_type;
> #define SLIM_FRM_SLOTS_PER_SUPERFRAME 16
> #define SLIM_GDE_SLOTS_PER_SUPERFRAME 2
>
> +#define SLIM_MAX_TXNS 256
Where did this number come from?
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists