]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/mmc/card/block.c
mmc: remove confusing flag
[linux-2.6-omap-h63xx.git] / drivers / mmc / card / block.c
index d24ab234394cc31d30233938d6f8d6ed7c215506..ab510689ecde7e0e709e242be821f2601e8d4514 100644 (file)
@@ -45,8 +45,6 @@
  */
 #define MMC_SHIFT      3
 
-static int major;
-
 /*
  * There is one mmc_blk_data per slot.
  */
@@ -137,23 +135,6 @@ struct mmc_blk_request {
        struct mmc_data         data;
 };
 
-static int mmc_blk_prep_rq(struct mmc_queue *mq, struct request *req)
-{
-       struct mmc_blk_data *md = mq->data;
-       int stat = BLKPREP_OK;
-
-       /*
-        * If we have no device, we haven't finished initialising.
-        */
-       if (!md || !mq->card) {
-               printk(KERN_ERR "%s: killing request - no device/host\n",
-                      req->rq_disk->disk_name);
-               stat = BLKPREP_KILL;
-       }
-
-       return stat;
-}
-
 static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
 {
        int err;
@@ -173,7 +154,7 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
        cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
 
        err = mmc_wait_for_cmd(card->host, &cmd, 0);
-       if ((err != MMC_ERR_NONE) || !(cmd.resp[0] & R1_APP_CMD))
+       if (err || !(cmd.resp[0] & R1_APP_CMD))
                return (u32)-1;
 
        memset(&cmd, 0, sizeof(struct mmc_command));
@@ -211,7 +192,7 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card)
 
        mmc_wait_for_req(card->host, &mrq);
 
-       if (cmd.error != MMC_ERR_NONE || data.error != MMC_ERR_NONE)
+       if (cmd.error || data.error)
                return (u32)-1;
 
        blocks = ntohl(blocks);
@@ -248,8 +229,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
                if (brq.data.blocks > card->host->max_blk_count)
                        brq.data.blocks = card->host->max_blk_count;
 
-               mmc_set_data_timeout(&brq.data, card, rq_data_dir(req) != READ);
-
                /*
                 * If the host doesn't support multiple block writes, force
                 * block writes to single block. SD cards are excepted from
@@ -262,7 +241,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
                        brq.data.blocks = 1;
 
                if (brq.data.blocks > 1) {
-                       brq.data.flags |= MMC_DATA_MULTI;
                        brq.mrq.stop = &brq.stop;
                        readcmd = MMC_READ_MULTIPLE_BLOCK;
                        writecmd = MMC_WRITE_MULTIPLE_BLOCK;
@@ -280,8 +258,12 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
                        brq.data.flags |= MMC_DATA_WRITE;
                }
 
+               mmc_set_data_timeout(&brq.data, card);
+
                brq.data.sg = mq->sg;
-               brq.data.sg_len = blk_rq_map_sg(req->q, req, brq.data.sg);
+               brq.data.sg_len = mmc_queue_map_sg(mq);
+
+               mmc_queue_bounce_pre(mq);
 
                if (brq.data.blocks !=
                    (req->nr_sectors >> (md->block_bits - 9))) {
@@ -298,6 +280,9 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
                }
 
                mmc_wait_for_req(card->host, &brq.mrq);
+
+               mmc_queue_bounce_post(mq);
+
                if (brq.cmd.error) {
                        printk(KERN_ERR "%s: error %d sending read/write command\n",
                               req->rq_disk->disk_name, brq.cmd.error);
@@ -428,13 +413,12 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
                return ERR_PTR(-ENOSPC);
        __set_bit(devidx, dev_use);
 
-       md = kmalloc(sizeof(struct mmc_blk_data), GFP_KERNEL);
+       md = kzalloc(sizeof(struct mmc_blk_data), GFP_KERNEL);
        if (!md) {
                ret = -ENOMEM;
                goto out;
        }
 
-       memset(md, 0, sizeof(struct mmc_blk_data));
 
        /*
         * Set the read-only status based on the supported commands
@@ -462,11 +446,10 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
        if (ret)
                goto err_putdisk;
 
-       md->queue.prep_fn = mmc_blk_prep_rq;
        md->queue.issue_fn = mmc_blk_issue_rq;
        md->queue.data = md;
 
-       md->disk->major = major;
+       md->disk->major = MMC_BLOCK_MAJOR;
        md->disk->first_minor = devidx << MMC_SHIFT;
        md->disk->fops = &mmc_bdops;
        md->disk->private_data = md;
@@ -634,14 +617,9 @@ static int __init mmc_blk_init(void)
 {
        int res = -ENOMEM;
 
-       res = register_blkdev(major, "mmc");
-       if (res < 0) {
-               printk(KERN_WARNING "Unable to get major %d for MMC media: %d\n",
-                      major, res);
+       res = register_blkdev(MMC_BLOCK_MAJOR, "mmc");
+       if (res)
                goto out;
-       }
-       if (major == 0)
-               major = res;
 
        return mmc_register_driver(&mmc_driver);
 
@@ -652,7 +630,7 @@ static int __init mmc_blk_init(void)
 static void __exit mmc_blk_exit(void)
 {
        mmc_unregister_driver(&mmc_driver);
-       unregister_blkdev(major, "mmc");
+       unregister_blkdev(MMC_BLOCK_MAJOR, "mmc");
 }
 
 module_init(mmc_blk_init);
@@ -661,5 +639,3 @@ module_exit(mmc_blk_exit);
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
 
-module_param(major, int, 0444);
-MODULE_PARM_DESC(major, "specify the major device number for MMC block driver");