wbsd: fix section mismatch warnings
[deliverable/linux.git] / drivers / mmc / card / queue.c
CommitLineData
1da177e4 1/*
70f10482 2 * linux/drivers/mmc/card/queue.c
1da177e4
LT
3 *
4 * Copyright (C) 2003 Russell King, All Rights Reserved.
98ac2162 5 * Copyright 2006-2007 Pierre Ossman
1da177e4
LT
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 */
12#include <linux/module.h>
13#include <linux/blkdev.h>
83144186 14#include <linux/freezer.h>
87598a2b 15#include <linux/kthread.h>
1da177e4
LT
16
17#include <linux/mmc/card.h>
18#include <linux/mmc/host.h>
98ac2162 19#include "queue.h"
1da177e4 20
98ccf149
PO
21#define MMC_QUEUE_BOUNCESZ 65536
22
87598a2b 23#define MMC_QUEUE_SUSPENDED (1 << 0)
1da177e4
LT
24
25/*
9c9f2d63 26 * Prepare a MMC request. This just filters out odd stuff.
1da177e4
LT
27 */
28static int mmc_prep_request(struct request_queue *q, struct request *req)
29{
9c9f2d63
PO
30 /*
31 * We only like normal block requests.
32 */
33 if (!blk_fs_request(req) && !blk_pc_request(req)) {
1da177e4 34 blk_dump_rq_flags(req, "MMC bad request");
9c9f2d63 35 return BLKPREP_KILL;
1da177e4
LT
36 }
37
9c9f2d63 38 req->cmd_flags |= REQ_DONTPREP;
1da177e4 39
9c9f2d63 40 return BLKPREP_OK;
1da177e4
LT
41}
42
43static int mmc_queue_thread(void *d)
44{
45 struct mmc_queue *mq = d;
46 struct request_queue *q = mq->queue;
1da177e4 47
83144186 48 current->flags |= PF_MEMALLOC;
1da177e4 49
1da177e4 50 down(&mq->thread_sem);
1da177e4
LT
51 do {
52 struct request *req = NULL;
53
54 spin_lock_irq(q->queue_lock);
55 set_current_state(TASK_INTERRUPTIBLE);
56 if (!blk_queue_plugged(q))