aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/card/block.c18
-rw-r--r--drivers/mmc/card/queue.c35
-rw-r--r--drivers/mmc/card/queue.h8
3 files changed, 8 insertions, 53 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index a7562f7fc0b3..540ff4bea54c 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -135,23 +135,6 @@ struct mmc_blk_request {
135 struct mmc_data data; 135 struct mmc_data data;
136}; 136};
137 137
138static int mmc_blk_prep_rq(struct mmc_queue *mq, struct request *req)
139{
140 struct mmc_blk_data *md = mq->data;
141 int stat = BLKPREP_OK;
142
143 /*
144 * If we have no device, we haven't finished initialising.
145 */
146 if (!md || !mq->card) {
147 printk(KERN_ERR "%s: killing request - no device/host\n",
148 req->rq_disk->disk_name);
149 stat = BLKPREP_KILL;
150 }
151
152 return stat;
153}
154
155static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) 138static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
156{ 139{
157 int err; 140 int err;
@@ -460,7 +443,6 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
460 if (ret) 443 if (ret)
461 goto err_putdisk; 444 goto err_putdisk;
462 445
463 md->queue.prep_fn = mmc_blk_prep_rq;
464 md->queue.issue_fn = mmc_blk_issue_rq; 446 md->queue.issue_fn = mmc_blk_issue_rq;
465 md->queue.data = md; 447 md->queue.data = md;
466 448
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 2e77963db334..dd97bc798409 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -20,40 +20,21 @@
20#define MMC_QUEUE_SUSPENDED (1 << 0) 20#define MMC_QUEUE_SUSPENDED (1 << 0)
21 21
22/* 22/*
23 * Prepare a MMC request. Essentially, this means passing the 23 * Prepare a MMC request. This just filters out odd stuff.
24 * preparation off to the media driver. The media driver will
25 * create a mmc_io_request in req->special.
26 */ 24 */
27static int mmc_prep_request(struct request_queue *q, struct request *req) 25static int mmc_prep_request(struct request_queue *q, struct request *req)
28{ 26{
29 struct mmc_queue *mq = q->queuedata; 27 /*
30 int ret = BLKPREP_KILL; 28 * We only like normal block requests.
31 29 */
32 if (blk_special_request(req)) { 30 if (!blk_fs_request(req) && !blk_pc_request(req)) {
33 /*
34 * Special commands already have the command
35 * blocks already setup in req->special.
36 */
37 BUG_ON(!req->special);
38
39 ret = BLKPREP_OK;
40 } else if (blk_fs_request(req) || blk_pc_request(req)) {
41 /*
42 * Block I/O requests need translating according
43 * to the protocol.
44 */
45 ret = mq->prep_fn(mq, req);
46 } else {
47 /*
48 * Everything else is invalid.
49 */
50 blk_dump_rq_flags(req, "MMC bad request"); 31 blk_dump_rq_flags(req, "MMC bad request");
32 return BLKPREP_KILL;
51 } 33 }
52 34
53 if (ret == BLKPREP_OK) 35 req->cmd_flags |= REQ_DONTPREP;
54 req->cmd_flags |= REQ_DONTPREP;
55 36
56 return ret; 37 return BLKPREP_OK;
57} 38}
58 39
59static int mmc_queue_thread(void *d) 40static int mmc_queue_thread(void *d)
diff --git a/drivers/mmc/card/queue.h b/drivers/mmc/card/queue.h
index c9f139e764f6..1590b3f3f1f7 100644
--- a/drivers/mmc/card/queue.h
+++ b/drivers/mmc/card/queue.h
@@ -10,20 +10,12 @@ struct mmc_queue {
10 struct semaphore thread_sem; 10 struct semaphore thread_sem;
11 unsigned int flags; 11 unsigned int flags;
12 struct request *req; 12 struct request *req;
13 int (*prep_fn)(struct mmc_queue *, struct request *);
14 int (*issue_fn)(struct mmc_queue *, struct request *); 13 int (*issue_fn)(struct mmc_queue *, struct request *);
15 void *data; 14 void *data;
16 struct request_queue *queue; 15 struct request_queue *queue;
17 struct scatterlist *sg; 16 struct scatterlist *sg;
18}; 17};
19 18
20struct mmc_io_request {
21 struct request *rq;
22 int num;
23 struct mmc_command selcmd; /* mmc_queue private */
24 struct mmc_command cmd[4]; /* max 4 commands */
25};
26
27extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *); 19extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *);
28extern void mmc_cleanup_queue(struct mmc_queue *); 20extern void mmc_cleanup_queue(struct mmc_queue *);
29extern void mmc_queue_suspend(struct mmc_queue *); 21extern void mmc_queue_suspend(struct mmc_queue *);