lkml.org 
[lkml]   [2015]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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?
    [unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2015-06-15 13:21    [W:2.296 / U:0.304 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site