Merge branch 'printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[platform/kernel/linux-starfive.git] / drivers / ide / ide-floppy.c
index ee3e77a..2b4868d 100644 (file)
  */
 #define IDEFLOPPY_PC_DELAY     (HZ/20) /* default delay for ZIP 100 (50ms) */
 
-static void idefloppy_update_buffers(ide_drive_t *drive,
-                               struct ide_atapi_pc *pc)
-{
-       struct request *rq = pc->rq;
-       struct bio *bio = rq->bio;
-
-       while ((bio = rq->bio) != NULL)
-               ide_complete_rq(drive, 0, ide_rq_bytes(rq));
-}
-
 static int ide_floppy_callback(ide_drive_t *drive, int dsc)
 {
        struct ide_disk_obj *floppy = drive->driver_data;
@@ -130,8 +120,9 @@ static void ide_floppy_report_error(struct ide_disk_obj *floppy,
 
 }
 
-static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
-               struct ide_atapi_pc *pc)
+static ide_startstop_t ide_floppy_issue_pc(ide_drive_t *drive,
+                                          struct ide_cmd *cmd,
+                                          struct ide_atapi_pc *pc)
 {
        struct ide_disk_obj *floppy = drive->driver_data;
 
@@ -157,7 +148,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
 
        pc->retries++;
 
-       return ide_issue_pc(drive);
+       return ide_issue_pc(drive, cmd);
 }
 
 void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *pc)
@@ -212,7 +203,6 @@ static void idefloppy_create_rw_cmd(ide_drive_t *drive,
        memcpy(rq->cmd, pc->c, 12);
 
        pc->rq = rq;
-       pc->b_count = 0;
        if (rq->cmd_flags & REQ_RW)
                pc->flags |= PC_FLAG_WRITING;
        pc->buf = NULL;
@@ -226,7 +216,6 @@ static void idefloppy_blockpc_cmd(struct ide_disk_obj *floppy,
        ide_init_pc(pc);
        memcpy(pc->c, rq->cmd, sizeof(pc->c));
        pc->rq = rq;
-       pc->b_count = 0;
        if (rq->data_len && rq_data_dir(rq) == WRITE)
                pc->flags |= PC_FLAG_WRITING;
        pc->buf = rq->data;
@@ -243,10 +232,11 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
                                             struct request *rq, sector_t block)
 {
        struct ide_disk_obj *floppy = drive->driver_data;
-       ide_hwif_t *hwif = drive->hwif;
-       struct ide_cmd *cmd = &hwif->cmd;
+       struct ide_cmd cmd;
        struct ide_atapi_pc *pc;
 
+       ide_debug_log(IDE_DBG_FUNC, "enter, cmd: 0x%x\n", rq->cmd[0]);
+
        if (drive->debug_mask & IDE_DBG_RQ)
                blk_dump_rq_flags(rq, (rq->rq_disk
                                        ? rq->rq_disk->disk_name
@@ -285,21 +275,21 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
                goto out_end;
        }
 
+       memset(&cmd, 0, sizeof(cmd));
+
        if (rq_data_dir(rq))
-               cmd->tf_flags |= IDE_TFLAG_WRITE;
-       cmd->rq = rq;
+               cmd.tf_flags |= IDE_TFLAG_WRITE;
+
+       cmd.rq = rq;
 
        if (blk_fs_request(rq) || pc->req_xfer) {
-               ide_init_sg_cmd(cmd, rq->nr_sectors);
-               ide_map_sg(drive, cmd);
+               ide_init_sg_cmd(&cmd, pc->req_xfer);
+               ide_map_sg(drive, &cmd);
        }
 
-       pc->sg = hwif->sg_table;
-       pc->sg_cnt = cmd->sg_nents;
-
        pc->rq = rq;
 
-       return idefloppy_issue_pc(drive, pc);
+       return ide_floppy_issue_pc(drive, &cmd, pc);
 out_end:
        drive->failed_pc = NULL;
        if (blk_fs_request(rq) == 0 && rq->errors == 0)
@@ -381,9 +371,11 @@ static int ide_floppy_get_capacity(ide_drive_t *drive)
        struct gendisk *disk = floppy->disk;
        struct ide_atapi_pc pc;
        u8 *cap_desc;
-       u8 header_len, desc_cnt;
+       u8 pc_buf[256], header_len, desc_cnt;
        int i, rc = 1, blocks, length;
 
+       ide_debug_log(IDE_DBG_FUNC, "enter");
+
        drive->bios_cyl = 0;
        drive->bios_head = drive->bios_sect = 0;
        floppy->blocks = 0;
@@ -391,6 +383,9 @@ static int ide_floppy_get_capacity(ide_drive_t *drive)
        drive->capacity64 = 0;
 
        ide_floppy_create_read_capacity_cmd(&pc);
+       pc.buf = &pc_buf[0];
+       pc.buf_size = sizeof(pc_buf);
+
        if (ide_queue_pc_tail(drive, disk, &pc)) {
                printk(KERN_ERR PFX "Can't get floppy parameters\n");
                return 1;
@@ -481,8 +476,6 @@ static void ide_floppy_setup(ide_drive_t *drive)
        u16 *id = drive->id;
 
        drive->pc_callback       = ide_floppy_callback;
-       drive->pc_update_buffers = idefloppy_update_buffers;
-       drive->pc_io_buffers     = ide_io_buffers;
 
        /*
         * We used to check revisions here. At this point however I'm giving up.