block_device_operations->release() should return void
[cascardo/linux.git] / drivers / mmc / card / block.c
index 5bab73b..dd27b07 100644 (file)
@@ -304,14 +304,13 @@ static int mmc_blk_open(struct block_device *bdev, fmode_t mode)
        return ret;
 }
 
-static int mmc_blk_release(struct gendisk *disk, fmode_t mode)
+static void mmc_blk_release(struct gendisk *disk, fmode_t mode)
 {
        struct mmc_blk_data *md = disk->private_data;
 
        mutex_lock(&block_mutex);
        mmc_blk_put(md);
        mutex_unlock(&block_mutex);
-       return 0;
 }
 
 static int
@@ -1932,8 +1931,14 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
        }
 
 out:
-       if (!req && !(mq->flags & MMC_QUEUE_NEW_REQUEST))
-               /* release host only when there are no more requests */
+       if ((!req && !(mq->flags & MMC_QUEUE_NEW_REQUEST)) ||
+            (req && (req->cmd_flags & MMC_REQ_SPECIAL_MASK)))
+               /*
+                * Release host when there are no more requests
+                * and after special request(discard, flush) is done.
+                * In case sepecial request, there is no reentry to
+                * the 'mmc_blk_issue_rq' with 'mqrq_prev->req'.
+                */
                mmc_release_host(card->host);
        return ret;
 }