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

Commit 7c8a2829 authored by Per Forlin's avatar Per Forlin Committed by Chris Ball
Browse files

mmc: core: clarify how to use post_req in case of errors



The err condition in post_req() is set to undo a call made to pre_req()
that hasn't been started yet.  The err condition is not set if an MMC
request returns an error.

Signed-off-by: default avatarPer Forlin <per.forlin@linaro.org>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 44669034
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -320,8 +320,14 @@ struct mmc_async_req *mmc_start_req(struct mmc_host *host,
		mmc_wait_for_req_done(host, host->areq->mrq);
		err = host->areq->err_check(host->card, host->areq);
		if (err) {
			/* post process the completed failed request */
			mmc_post_req(host, host->areq->mrq, 0);
			if (areq)
				/*
				 * Cancel the new prepared request, because
				 * it can't run until the failed
				 * request has been properly handled.
				 */
				mmc_post_req(host, areq->mrq, -EINVAL);

			host->areq = NULL;
+3 −0
Original line number Diff line number Diff line
@@ -109,6 +109,9 @@ struct mmc_host_ops {
	 * It is optional for the host to implement pre_req and post_req in
	 * order to support double buffering of requests (prepare one
	 * request while another request is active).
	 * pre_req() must always be followed by a post_req().
	 * To undo a call made to pre_req(), call post_req() with
	 * a nonzero err condition.
	 */
	void	(*post_req)(struct mmc_host *host, struct mmc_request *req,
			    int err);