Staging: hv: make Device->RequestLock a real spinlock
[safe/jmp/linux-2.6] / drivers / block / xsysace.c
index 97c99b4..b20abe1 100644 (file)
@@ -390,9 +390,10 @@ static inline void ace_dump_mem(void *base, int len)
 
 static void ace_dump_regs(struct ace_device *ace)
 {
-       dev_info(ace->dev, "    ctrl:  %.8x  seccnt/cmd: %.4x      ver:%.4x\n"
-                KERN_INFO "    status:%.8x  mpu_lba:%.8x  busmode:%4x\n"
-                KERN_INFO "    error: %.8x  cfg_lba:%.8x  fatstat:%.4x\n",
+       dev_info(ace->dev,
+                "    ctrl:  %.8x  seccnt/cmd: %.4x      ver:%.4x\n"
+                "    status:%.8x  mpu_lba:%.8x  busmode:%4x\n"
+                "    error: %.8x  cfg_lba:%.8x  fatstat:%.4x\n",
                 ace_in32(ace, ACE_CTRL),
                 ace_in(ace, ACE_SECCNTCMD),
                 ace_in(ace, ACE_VERSION),
@@ -463,10 +464,11 @@ struct request *ace_get_next_request(struct request_queue * q)
 {
        struct request *req;
 
-       while ((req = elv_next_request(q)) != NULL) {
+       while ((req = blk_peek_request(q)) != NULL) {
                if (blk_fs_request(req))
                        break;
-               __blk_end_request_cur(req, -EIO);
+               blk_start_request(req);
+               __blk_end_request_all(req, -EIO);
        }
        return req;
 }
@@ -492,9 +494,13 @@ static void ace_fsm_dostate(struct ace_device *ace)
                set_capacity(ace->gd, 0);
                dev_info(ace->dev, "No CF in slot\n");
 
-               /* Drop all pending requests */
-               while ((req = elv_next_request(ace->queue)) != NULL)
-                       __blk_end_request_cur(req, -EIO);
+               /* Drop all in-flight and pending requests */
+               if (ace->req) {
+                       __blk_end_request_all(ace->req, -EIO);
+                       ace->req = NULL;
+               }
+               while ((req = blk_fetch_request(ace->queue)) != NULL)
+                       __blk_end_request_all(req, -EIO);
 
                /* Drop back to IDLE state and notify waiters */
                ace->fsm_state = ACE_FSM_STATE_IDLE;
@@ -642,6 +648,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
                        ace->fsm_state = ACE_FSM_STATE_IDLE;
                        break;
                }
+               blk_start_request(req);
 
                /* Okay, it's a data request, set it up for transfer */
                dev_dbg(ace->dev,
@@ -718,8 +725,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
                }
 
                /* bio finished; is there another one? */
-               if (__blk_end_request(ace->req, 0,
-                                       blk_rq_cur_bytes(ace->req))) {
+               if (__blk_end_request_cur(ace->req, 0)) {
                        /* dev_dbg(ace->dev, "next block; h=%u c=%u\n",
                         *      blk_rq_sectors(ace->req),
                         *      blk_rq_cur_sectors(ace->req));
@@ -979,7 +985,7 @@ static int __devinit ace_setup(struct ace_device *ace)
        ace->queue = blk_init_queue(ace_request, &ace->lock);
        if (ace->queue == NULL)
                goto err_blk_initq;
-       blk_queue_hardsect_size(ace->queue, 512);
+       blk_queue_logical_block_size(ace->queue, 512);
 
        /*
         * Allocate and initialize GD structure