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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux