mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: merez@codeaurora.org
To: "Seungwon Jeon" <tgih.jun@samsung.com>
Cc: merez@codeaurora.org, linux-mmc@vger.kernel.org,
	"'Chris Ball'" <cjb@laptop.org>,
	linux-kernel@vger.kernel.org
Subject: RE: [PATCH v5 2/2] mmc: core: Support packed command for eMMC4.5  device
Date: Wed, 2 May 2012 11:35:28 -0700 (PDT)	[thread overview]
Message-ID: <6c62e1bf619db82fb165dce5c6f383c4.squirrel@www.codeaurora.org> (raw)
In-Reply-To: <001601cd2668$8a074940$9e15dbc0$%jun@samsung.com>

>> > @@ -1291,10 +1657,42 @@ static int mmc_blk_issue_rw_rq(struct
>> mmc_queue
>> *mq, struct request *rqc)
>> >  			 * A block was successfully transferred.
>> >  			 */
>> >  			mmc_blk_reset_success(md, type);
>> > -			spin_lock_irq(&md->lock);
>> > -			ret = __blk_end_request(req, 0,
>> > +
>> > +			if (mq_rq->packed_cmd != MMC_PACKED_NONE) {
>> > +				int idx = mq_rq->packed_fail_idx, i = 0;
>> > +				ret = 0;
>> > +				while (!list_empty(&mq_rq->packed_list)) {
>> > +					prq = list_entry_rq(
>> > +						mq_rq->packed_list.next);
>> > +					if (idx == i) {
>> > +						/* retry from error index */
>> > +						mq_rq->packed_num -= idx;
>> > +						mq_rq->req = prq;
>> > +						ret = 1;
>> > +						break;
>> > +					}
>> > +					list_del_init(&prq->queuelist);
>> > +					spin_lock_irq(&md->lock);
>> > +					__blk_end_request(prq, 0,
>> > +							blk_rq_bytes(prq));
>> > +					spin_unlock_irq(&md->lock);
>> > +					i++;
>> > +				}
>> > +				if (mq_rq->packed_num == MMC_PACKED_N_SINGLE) {
>> > +					prq = list_entry_rq(
>> > +						mq_rq->packed_list.next);
>> You already get the prq inside the while. There is no need to do it
>> again.
> Right, but if while loop isn't taken, then prq can be used uninitialized.
> Though that case wouldn't happen actually, we don't want to see the
> compiling error.

The loop must be taken since we are inside the case of packed commands so
the list can't be empty.

If the compiler complained, you can set prq to be the first request before
entering the loop instead of setting it again in the if that follows the
loop. It will probably be more understood.
If you decide to leave it as is, I would also add the following to the if:
+                                                mq_rq->req = prq;
+                                                ret = 1;
Otherwise it seems like there could be a bug in cases where the loop is
not taken (since prq is the only one that is set) and the code is less
understood.

Thanks,
Maya Erez
Consultant for Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum



  reply	other threads:[~2012-05-02 18:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26 12:21 merez
2012-04-30  0:31 ` Seungwon Jeon
2012-05-02 18:35   ` merez [this message]
2012-05-08 23:41     ` Seungwon Jeon
  -- strict thread matches above, loose matches on Subject: below --
2012-02-29 18:10 merez
2012-03-01  7:47 ` Namjae Jeon
2012-03-02 14:26   ` merez
2012-03-04  8:09     ` Saugata Das
2012-03-05  5:21       ` merez
2012-03-04  8:25     ` Namjae Jeon
2012-03-06 14:10       ` merez
2012-03-07  0:17         ` Seungwon Jeon
2012-03-11 21:36           ` merez
2012-03-13  0:47             ` Seungwon Jeon
2012-03-17 14:59               ` merez
2012-03-01  9:01 ` Saugata Das
2012-03-02  0:09 ` Seungwon Jeon
2012-02-27 10:20 Seungwon Jeon

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=6c62e1bf619db82fb165dce5c6f383c4.squirrel@www.codeaurora.org \
    --to=merez@codeaurora.org \
    --cc=cjb@laptop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=tgih.jun@samsung.com \
    /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

Powered by JetHome