block: convert to pos and nr_sectors accessors
[linux-2.6-block.git] / drivers / block / amiflop.c
index 8df436ff7068b4840bdbcf610e357797ae387ae5..e4a14b94828ea30fc6b56a8da522e23f356c1205 100644 (file)
@@ -1351,15 +1351,15 @@ static void redo_fd_request(void)
        drive = floppy - unit;
 
        /* Here someone could investigate to be more efficient */
-       for (cnt = 0; cnt < CURRENT->current_nr_sectors; cnt++) { 
+       for (cnt = 0; cnt < blk_rq_cur_sectors(CURRENT); cnt++) {
 #ifdef DEBUG
                printk("fd: sector %ld + %d requested for %s\n",
-                      CURRENT->sector,cnt,
+                      blk_rq_pos(CURRENT), cnt,
                       (rq_data_dir(CURRENT) == READ) ? "read" : "write");
 #endif
-               block = CURRENT->sector + cnt;
+               block = blk_rq_pos(CURRENT) + cnt;
                if ((int)block > floppy->blocks) {
-                       end_request(CURRENT, 0);
+                       __blk_end_request_cur(CURRENT, -EIO);
                        goto repeat;
                }
 
@@ -1371,13 +1371,8 @@ static void redo_fd_request(void)
                       "0x%08lx\n", track, sector, data);
 #endif
 
-               if ((rq_data_dir(CURRENT) != READ) && (rq_data_dir(CURRENT) != WRITE)) {
-                       printk(KERN_WARNING "do_fd_request: unknown command\n");
-                       end_request(CURRENT, 0);
-                       goto repeat;
-               }
                if (get_track(drive, track) == -1) {
-                       end_request(CURRENT, 0);
+                       __blk_end_request_cur(CURRENT, -EIO);
                        goto repeat;
                }
 
@@ -1391,7 +1386,7 @@ static void redo_fd_request(void)
 
                        /* keep the drive spinning while writes are scheduled */
                        if (!fd_motor_on(drive)) {
-                               end_request(CURRENT, 0);
+                               __blk_end_request_cur(CURRENT, -EIO);
                                goto repeat;
                        }
                        /*
@@ -1407,10 +1402,8 @@ static void redo_fd_request(void)
                        break;
                }
        }
-       CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
-       CURRENT->sector += CURRENT->current_nr_sectors;
 
-       end_request(CURRENT, 1);
+       __blk_end_request_cur(CURRENT, 0);
        goto repeat;
 }