aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/card
diff options
context:
space:
mode:
authorAndrei Warkentin <andreiw@motorola.com>2011-04-11 19:10:24 -0400
committerChris Ball <cjb@laptop.org>2011-05-24 21:01:16 -0400
commit1a258db6f396e26c2c00b19c0107a891895d4584 (patch)
treeb9012952b952612a929994f87f3488ce88bcb46f /drivers/mmc/card
parentd3a8d95dcbb726b9cf0bbc166b2473bdd236c88c (diff)
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: Andrei Warkentin <andreiw@motorola.com> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r--drivers/mmc/card/block.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 91a676773608..3e9082b729ff 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -273,8 +273,6 @@ static int mmc_blk_issue_discard_rq(struct mmc_queue *mq, struct request *req)
273 unsigned int from, nr, arg; 273 unsigned int from, nr, arg;
274 int err = 0; 274 int err = 0;
275 275
276 mmc_claim_host(card->host);
277
278 if (!mmc_can_erase(card)) { 276 if (!mmc_can_erase(card)) {
279 err = -EOPNOTSUPP; 277 err = -EOPNOTSUPP;
280 goto out; 278 goto out;
@@ -294,8 +292,6 @@ out:
294 __blk_end_request(req, err, blk_rq_bytes(req)); 292 __blk_end_request(req, err, blk_rq_bytes(req));
295 spin_unlock_irq(&md->lock); 293 spin_unlock_irq(&md->lock);
296 294
297 mmc_release_host(card->host);
298
299 return err ? 0 : 1; 295 return err ? 0 : 1;
300} 296}
301 297
@@ -307,8 +303,6 @@ static int mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
307 unsigned int from, nr, arg; 303 unsigned int from, nr, arg;
308 int err = 0; 304 int err = 0;
309 305
310 mmc_claim_host(card->host);
311
312 if (!mmc_can_secure_erase_trim(card)) { 306 if (!mmc_can_secure_erase_trim(card)) {
313 err = -EOPNOTSUPP; 307 err = -EOPNOTSUPP;
314 goto out; 308 goto out;
@@ -330,8 +324,6 @@ out:
330 __blk_end_request(req, err, blk_rq_bytes(req)); 324 __blk_end_request(req, err, blk_rq_bytes(req));
331 spin_unlock_irq(&md->lock); 325 spin_unlock_irq(&md->lock);
332 326
333 mmc_release_host(card->host);
334
335 return err ? 0 : 1; 327 return err ? 0 : 1;
336} 328}
337 329
@@ -402,8 +394,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
402 (rq_data_dir(req) == WRITE) && 394 (rq_data_dir(req) == WRITE) &&
403 REL_WRITES_SUPPORTED(card); 395 REL_WRITES_SUPPORTED(card);
404 396
405 mmc_claim_host(card->host);
406
407 do { 397 do {
408 struct mmc_command cmd; 398 struct mmc_command cmd;
409 u32 readcmd, writecmd, status = 0; 399 u32 readcmd, writecmd, status = 0;
@@ -589,8 +579,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
589 spin_unlock_irq(&md->lock); 579 spin_unlock_irq(&md->lock);
590 } while (ret); 580 } while (ret);
591 581
592 mmc_release_host(card->host);
593
594 return 1; 582 return 1;
595 583
596 cmd_err: 584 cmd_err:
@@ -617,8 +605,6 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *req)
617 spin_unlock_irq(&md->lock); 605 spin_unlock_irq(&md->lock);
618 } 606 }
619 607
620 mmc_release_host(card->host);
621
622 spin_lock_irq(&md->lock); 608 spin_lock_irq(&md->lock);
623 while (ret) 609 while (ret)
624 ret = __blk_end_request(req, -EIO, blk_rq_cur_bytes(req)); 610 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 615
630static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) 616static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
631{ 617{
618 int ret;
619 struct mmc_blk_data *md = mq->data;
620 struct mmc_card *card = md->queue.card;
621
622 mmc_claim_host(card->host);
623
632 if (req->cmd_flags & REQ_DISCARD) { 624 if (req->cmd_flags & REQ_DISCARD) {
633 if (req->cmd_flags & REQ_SECURE) 625 if (req->cmd_flags & REQ_SECURE)
634 return mmc_blk_issue_secdiscard_rq(mq, req); 626 ret = mmc_blk_issue_secdiscard_rq(mq, req);
635 else 627 else
636 return mmc_blk_issue_discard_rq(mq, req); 628 ret = mmc_blk_issue_discard_rq(mq, req);
637 } else if (req->cmd_flags & REQ_FLUSH) { 629 } else if (req->cmd_flags & REQ_FLUSH) {
638 return mmc_blk_issue_flush(mq, req); 630 ret = mmc_blk_issue_flush(mq, req);
639 } else { 631 } else {
640 return mmc_blk_issue_rw_rq(mq, req); 632 ret = mmc_blk_issue_rw_rq(mq, req);
641 } 633 }
634
635 mmc_release_host(card->host);
636 return ret;
642} 637}
643 638
644static inline int mmc_blk_readonly(struct mmc_card *card) 639static inline int mmc_blk_readonly(struct mmc_card *card)