mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-29 15:43:59 +08:00
mmc: block: add a block request prepare function
Break out code from mmc_blk_issue_rw_rq to create a block request prepare function. This doesn't change any functionallity. This helps when handling more than one active block request. Signed-off-by: Per Forlin <per.forlin@linaro.org> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Venkatraman S <svenkatr@ti.com> Tested-by: Sourav Poddar <sourav.poddar@ti.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
This commit is contained in:
parent
97868a2bdf
commit
54d49d7762
@ -812,12 +812,15 @@ static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq,
|
||||
R1_CC_ERROR | /* Card controller error */ \
|
||||
R1_ERROR) /* General/unknown error */
|
||||
|
||||
static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
||||
static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
|
||||
struct mmc_card *card,
|
||||
int disable_multi,
|
||||
struct mmc_queue *mq)
|
||||
{
|
||||
u32 readcmd, writecmd;
|
||||
struct mmc_blk_request *brq = &mqrq->brq;
|
||||
struct request *req = mqrq->req;
|
||||
struct mmc_blk_data *md = mq->data;
|
||||
struct mmc_card *card = md->queue.card;
|
||||
struct mmc_blk_request *brq = &mq->mqrq_cur->brq;
|
||||
int ret = 1, disable_multi = 0, retry = 0;
|
||||
|
||||
/*
|
||||
* Reliable writes are used to implement Forced Unit Access and
|
||||
@ -828,9 +831,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
||||
(rq_data_dir(req) == WRITE) &&
|
||||
(md->flags & MMC_BLK_REL_WR);
|
||||
|
||||
do {
|
||||
u32 readcmd, writecmd;
|
||||
|
||||
memset(brq, 0, sizeof(struct mmc_blk_request));
|
||||
brq->mrq.cmd = &brq->cmd;
|
||||
brq->mrq.data = &brq->data;
|
||||
@ -917,8 +917,8 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
||||
|
||||
mmc_set_data_timeout(&brq->data, card);
|
||||
|
||||
brq->data.sg = mq->mqrq_cur->sg;
|
||||
brq->data.sg_len = mmc_queue_map_sg(mq, mq->mqrq_cur);
|
||||
brq->data.sg = mqrq->sg;
|
||||
brq->data.sg_len = mmc_queue_map_sg(mq, mqrq);
|
||||
|
||||
/*
|
||||
* Adjust the sg list so it is the same size as the
|
||||
@ -939,8 +939,18 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
||||
brq->data.sg_len = i;
|
||||
}
|
||||
|
||||
mmc_queue_bounce_pre(mq->mqrq_cur);
|
||||
mmc_queue_bounce_pre(mqrq);
|
||||
}
|
||||
|
||||
static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
|
||||
{
|
||||
struct mmc_blk_data *md = mq->data;
|
||||
struct mmc_card *card = md->queue.card;
|
||||
struct mmc_blk_request *brq = &mq->mqrq_cur->brq;
|
||||
int ret = 1, disable_multi = 0, retry = 0;
|
||||
|
||||
do {
|
||||
mmc_blk_rw_rq_prep(mq->mqrq_cur, card, disable_multi, mq);
|
||||
mmc_wait_for_req(card->host, &brq->mrq);
|
||||
|
||||
mmc_queue_bounce_post(mq->mqrq_cur);
|
||||
|
Loading…
Reference in New Issue
Block a user