Commit 1a258db6 authored by Andrei Warkentin's avatar Andrei Warkentin Committed by Chris Ball

mmc: card: block.c cleanup for host claim/release.

Move host claim/release into mmc_blk_issue_rq.

(This is helpful so that selecting partition only has to happen
in one place for these commands.)
Signed-off-by: default avatarAndrei Warkentin <andreiw@motorola.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent d3a8d95d
...@@ -273,8 +273,6 @@ static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req) ...@@ -273,8 +273,6 @@ static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
unsigned int from, nr, arg; unsigned int from, nr, arg;
int err = 0; int err = 0;
mmc_claim_host(card->host);
if (!mmc_can_erase(card)) { if (!mmc_can_erase(card)) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto out; goto out;
...@@ -294,8 +292,6 @@ static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req) ...@@ -294,8 +292,6 @@ static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
__blk_end_request(req, err, blk_rq_bytes(req)); __blk_end_request(req, err, blk_rq_bytes(req));
spin_unlock_irq(&md->lock); spin_unlock_irq(&md->lock);
mmc_release_host(card->host);
return err ? 0 : 1; return err ? 0 : 1;
} }
...@@ -307,8 +303,6 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, ...@@ -307,8 +303,6 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
unsigned int from, nr, arg; unsigned int from, nr, arg;
int err = 0; int err = 0;
mmc_claim_host(card->host);
if (!mmc_can_secure_erase_trim(card)) { if (!mmc_can_secure_erase_trim(card)) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto out; goto out;
...@@ -330,8 +324,6 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, ...@@ -330,8 +324,6 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
__blk_end_request(req, err, blk_rq_bytes(req)); __blk_end_request(req, err, blk_rq_bytes(req));
spin_unlock_irq(&md->lock); spin_unlock_irq(&md->lock);
mmc_release_host(card->host);
return err ? 0 : 1; return err ? 0 : 1;
} }
...@@ -402,8 +394,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req) ...@@ -402,8 +394,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
(rq_data_dir(req) == WRITE) && (rq_data_dir(req) == WRITE) &&
REL_WRITES_SUPPORTED(card); REL_WRITES_SUPPORTED(card);
mmc_claim_host(card->host);
do { do {
struct mmc_command cmd; struct mmc_command cmd;
u32 readcmd, writecmd, status = 0; u32 readcmd, writecmd, status = 0;
...@@ -589,8 +579,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req) ...@@ -589,8 +579,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
spin_unlock_irq(&md->lock); spin_unlock_irq(&md->lock);
} while (ret); } while (ret);
mmc_release_host(card->host);
return 1; return 1;
cmd_err: cmd_err:
...@@ -617,8 +605,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req) ...@@ -617,8 +605,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
spin_unlock_irq(&md->lock); spin_unlock_irq(&md->lock);
} }
mmc_release_host(card->host);
spin_lock_irq(&md->lock); spin_lock_irq(&md->lock);
while (ret) while (ret)
ret = __blk_end_request(req, -EIO, blk_rq_cur_bytes(req)); ret = __blk_end_request(req, -EIO, blk_rq_cur_bytes(req));
...@@ -629,16 +615,25 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req) ...@@ -629,16 +615,25 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
{ {
int ret;
struct mmc_blk_data *md = mq->data;
struct mmc_card *card = md->queue.card;
mmc_claim_host(card->host);
if (req->cmd_flags & REQ_DISCARD) { if (req->cmd_flags & REQ_DISCARD) {
if (req->cmd_flags & REQ_SECURE) if (req->cmd_flags & REQ_SECURE)
return mmc_blk_issue_secdiscard_rq(mq, req); ret = mmc_blk_issue_secdiscard_rq(mq, req);
else else
return mmc_blk_issue_discard_rq(mq, req); ret = mmc_blk_issue_discard_rq(mq, req);
} else if (req->cmd_flags & REQ_FLUSH) { } else if (req->cmd_flags & REQ_FLUSH) {
return mmc_blk_issue_flush(mq, req); ret = mmc_blk_issue_flush(mq, req);
} else { } else {
return mmc_blk_issue_rw_rq(mq, req); ret = mmc_blk_issue_rw_rq(mq, req);
} }
mmc_release_host(card->host);
return ret;
} }
static inline int mmc_blk_readonly(struct mmc_card *card) static inline int mmc_blk_readonly(struct mmc_card *card)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment