From: Hu Ziji <huziji@marvell.com>
To: linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 3/5] mmc: card: Add eMMC command queuing support in mmc block layer
Date: Mon, 8 Dec 2014 02:17:17 +0000 (UTC) [thread overview]
Message-ID: <loom.20141208T030638-232@post.gmane.org> (raw)
In-Reply-To: 20141202115821.GA27658@asutoshd-ics.in.qualcomm.com
Asutosh Das <asutoshd <at> codeaurora.org> writes:
> +static inline bool mmc_cmdq_should_pull_reqs(struct mmc_host *host,
> + struct mmc_cmdq_context_info *ctx)
> +{
> + spin_lock_bh(&ctx->cmdq_ctx_lock);
> + if (ctx->active_dcmd || ctx->rpmb_in_wait) {
> + if ((ctx->curr_state != CMDQ_STATE_HALT) ||
> + (ctx->curr_state != CMDQ_STATE_ERR)) {
Because CMDQ_STATE_HALT == 0 and CMDQ_STATE_ERR == 1, it is
impossible that condition ((ctx->curr_state == CMDQ_STATE_HALT) && (ctx-
>curr_state != CMDQ_STATE_ERR)) is satisfied. Thus the above if-condition will
always be true.
> + pr_debug("%s: %s: skip pulling reqs: dcmd: %d rpmb: %d state:
%d\n",
> + mmc_hostname(host), __func__, ctx->active_dcmd,
> + ctx->rpmb_in_wait, ctx->curr_state);
> + spin_unlock_bh(&ctx->cmdq_ctx_lock);
> + return false;
> + }
> + } else {
> + spin_unlock_bh(&ctx->cmdq_ctx_lock);
> + return true;
> + }
> +}
> +/**
> + * mmc_cmdq_halt - halt/un-halt the command queue engine
> + * <at> host: host instance
> + * <at> halt: true - halt, un-halt otherwise
> + *
> + * Host halts the command queue engine. It should complete
> + * the ongoing transfer and release the SD bus.
> + * All legacy SD commands can be sent upon successful
> + * completion of this function.
> + * Returns 0 on success, negative otherwise
> + */
> +int mmc_cmdq_halt(struct mmc_host *host, bool halt)
> +{
> + int err = 0;
> +
> + if ((halt && (host->cmdq_ctx.curr_state & CMDQ_STATE_HALT)) ||
> + (!halt && !(host->cmdq_ctx.curr_state & CMDQ_STATE_HALT)))
> + return 1;
> +
> + if (host->cmdq_ops->halt) {
> + err = host->cmdq_ops->halt(host, halt);
> + if (!err && halt)
> + host->cmdq_ctx.curr_state |= CMDQ_STATE_HALT;
> + else if (!err && !halt)
> + host->cmdq_ctx.curr_state &= ~CMDQ_STATE_HALT;
Since CMDQ_STATE_HALE == 0, ORed with CMDQ_STATE_HALT and
ANDed with ~CMDQ_STATE_HALT will neither modify the value of curr_state. Thus
CMDQ_STATE_HALT as 0 cannot indicate the halt state of cmd queue.
> + }
> + return 0;
> +}
> +EXPORT_SYMBOL(mmc_cmdq_halt);
> +enum cmdq_states {
> + CMDQ_STATE_HALT,
> + CMDQ_STATE_ERR,
> +};
According to above definition, CMDQ_STATE_HALT is 0x0 and
CMDQ_STATE_ERR is 0x1.
Hi Asutosh,
I think that the definition of CMDQ_STATE_HALT might fail to indicate halt status
correctly.
Could you check my comments please?
If I misunderstand your source code, please correct me.
Best regards,
Ziji
next prev parent reply other threads:[~2014-12-08 2:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-02 11:58 [PATCH 3/5] mmc: card: Add eMMC command queuing support in mmc block layer Asutosh Das
2014-12-08 2:17 ` Hu Ziji [this message]
2014-12-08 5:58 ` Asutosh Das
2014-12-08 19:03 ` Ziji Hu
2014-12-10 4:38 ` Asutosh Das
2015-01-15 13:56 ` Ulf Hansson
2015-01-16 3:45 ` Asutosh Das
2015-01-16 8:26 ` Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=loom.20141208T030638-232@post.gmane.org \
--to=huziji@marvell.com \
--cc=linux-arm-msm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.