Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67b8360a authored by Linus Walleij's avatar Linus Walleij Committed by Ulf Hansson
Browse files

mmc: core: refactor mmc_request_done()



We have this construction:

if (a && b && !c)
   finalize;
else
   block;
   finalize;

Which is equivalent by boolean logic to:

if (!a || !b || c)
   block;
finalize;

Which is simpler code.

Reviewed-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 0e72f95b
Loading
Loading
Loading
Loading
+16 −11
Original line number Diff line number Diff line
@@ -172,14 +172,16 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)

	trace_mmc_request_done(host, mrq);

	if (err && cmd->retries && !mmc_card_removed(host->card)) {
	/*
		 * Request starter must handle retries - see
		 * mmc_wait_for_req_done().
	 * We list various conditions for the command to be considered
	 * properly done:
	 *
	 * - There was no error, OK fine then
	 * - We are not doing some kind of retry
	 * - The card was removed (...so just complete everything no matter
	 *   if there are errors or retries)
	 */
		if (mrq->done)
			mrq->done(mrq);
	} else {
	if (!err || !cmd->retries || mmc_card_removed(host->card)) {
		mmc_should_fail_request(host, mrq);

		if (!host->ongoing_mrq)
@@ -211,11 +213,14 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
				mrq->stop->resp[0], mrq->stop->resp[1],
				mrq->stop->resp[2], mrq->stop->resp[3]);
		}

	}
	/*
	 * Request starter must handle retries - see
	 * mmc_wait_for_req_done().
	 */
	if (mrq->done)
		mrq->done(mrq);
}
}

EXPORT_SYMBOL(mmc_request_done);