mmc: clarifications on host.post_req()
Subsystems (2)
cover mmc: clarifications on host.post_req()
Fixes for 3.1.
This patchset doesn't fix any bugs in 3.1 but it improves the documentation in order to prevent new bugs.
Per Forlin (2):
mmc: core: clarify how to use post_req in case of errors
mmc: mmci: simplify err check in mmci_post_request
drivers/mmc/core/core.c | 6 ++++++ drivers/mmc/host/mmci.c | 2 +- include/linux/mmc/host.h | 3 +++ 3 files changed, 10 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.4.1
PATCH 1/2 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 error.
--- drivers/mmc/core/core.c | 6 ++++++ include/linux/mmc/host.h | 3 +++ 2 files changed, 9 insertions(+), 0 deletions(-)
drivers/mmc/core/core.c +6 -0
@@ -279,8 +279,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 ;
include/linux/mmc/host.h +3 -0
@@ -108,6 +108,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);
Signature · 1 line
1.7.4.1
PATCH 1/2 mmc: core: clarify how to use post_req in case of errors
Quoted 5 lines · Per Forlin
The err condition in
post_req()is set to undo a call made topre_req()that hasn't been started yet.
The err condition is not set if an MMC request returns error.Signed-off-by Per Forlin <[email protected]>
Comments look correct so:
Thanks,
Linus Walleij
PATCH 2/2 mmc: mmci: simplify err check in mmci_post_request
In reply to Per ForlinThe error condition indicates that mmci_post_request() should cleanup after the mmci_pre_request(). In this case the resources allocated by device_prep_slave_sg() are freed by calling dmaengine_terminate_all(). dma_unmap_sg() should always be performed if the host_cookie is set.
--- drivers/mmc/host/mmci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/host/mmci.c +1 -1
@@ -529,7 +529,7 @@ static void mmci_post_request(struct mmc_host *mmc, struct mmc_request *mrq,if (chan) {if (err)dmaengine_terminate_all (chan); -if (err || data->host_cookie) +if (data->host_cookie)dma_unmap_sg (mmc_dev (host->mmc), data->sg, data->sg_len, dir); mrq->data->host_cookie =0 ;
Signature · 1 line
1.7.4.1
PATCH 2/2 mmc: mmci: simplify err check in mmci_post_request
Quoted 6 lines · Per Forlin
The error condition indicates that
mmci_post_request()should cleanup after themmci_pre_request(). In this case the resources allocated bydevice_prep_slave_sg()are freed by callingdmaengine_terminate_all().dma_unmap_sg()should always be performed if thehost_cookieis set.Signed-off-by Per Forlin <[email protected]>
Thanks,
Linus Walleij
cover mmc: clarifications on host.post_req()
In reply to Per ForlinHi Per,
Quoted 3 lines · Per Forlin
Fixes for 3.1.
This patchset doesn't fix any bugs in 3.1 but it improves the documentation in order to prevent new bugs.
I've merged this into mmc-next now, but I'm planning on sending it for 3.2 instead of 3.1 at this point; hope that's okay.
Thanks,
- Chris.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
cover mmc: clarifications on host.post_req()
Quoted 10 lines · Chris Ball
Hi Per,
Quoted 3 lines · Per Forlin
Fixes for 3.1.
This patchset doesn't fix any bugs in 3.1 but it improves the documentation in order to prevent new bugs.I've merged this into mmc-next now, but I'm planning on sending it for 3.2 instead of 3.1 at this point; hope that's okay.
Fine with me.
Thanks,
Per