public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Ball <cjb@laptop.org>
To: Namjae Jeon <linkinjeon@gmail.com>
Cc: linux-mmc@vger.kernel.org, linus.walleij@linaro.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mmc: Use switch() instead of if/else if in mmc_blk_issue_rq.
Date: Sat, 20 Aug 2011 11:12:26 -0400	[thread overview]
Message-ID: <m239gwglr9.fsf@bob.laptop.org> (raw)
In-Reply-To: <1313851839-32483-1-git-send-email-linkinjeon@gmail.com> (Namjae Jeon's message of "Sat, 20 Aug 2011 23:50:39 +0900")

Hi,

On Sat, Aug 20 2011, Namjae Jeon wrote:
> This uses a switch statement instead of if/else if statements.
> It will make to improve clarity and scalability, and offer faster execution through compiler optimization than if/else if statements.
>
> Signed-off-by: Namjae Jeon <linkinjeon@gmail.com>
> ---
>  drivers/mmc/card/block.c |   38 +++++++++++++++++++++++---------------
>  1 files changed, 23 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index 1ff5486..fe9dd89 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -1191,23 +1191,31 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
>  		goto out;
>  	}
>  
> -	if (req && req->cmd_flags & REQ_DISCARD) {
> -		/* complete ongoing async transfer before issuing discard */
> -		if (card->host->areq)
> -			mmc_blk_issue_rw_rq(mq, NULL);
> -		if (req->cmd_flags & REQ_SECURE)
> -			ret = mmc_blk_issue_secdiscard_rq(mq, req);
> -		else
> +	if (req) {
> +		switch(req->cmd_flags) {
> +		case REQ_DISCARD:
> +			/* complete ongoing async transfer before issuing discard */
> +			if (card->host->areq)
> +				mmc_blk_issue_rw_rq(mq, NULL);

But it doesn't work, because you've changed the test for "req->cmd_flags
& REQ_DISCARD" into a test for "req->cmd_flags == REQ_DISCARD".

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

      reply	other threads:[~2011-08-20 15:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-20 14:50 [PATCH] mmc: Use switch() instead of if/else if in mmc_blk_issue_rq Namjae Jeon
2011-08-20 15:12 ` Chris Ball [this message]

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=m239gwglr9.fsf@bob.laptop.org \
    --to=cjb@laptop.org \
    --cc=linkinjeon@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox