diff options
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index b3689437269f..011d72011cc4 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -351,10 +351,7 @@ static void ide_floppy_callback(ide_drive_t *drive) | |||
351 | 351 | ||
352 | static void idefloppy_init_pc(struct ide_atapi_pc *pc) | 352 | static void idefloppy_init_pc(struct ide_atapi_pc *pc) |
353 | { | 353 | { |
354 | memset(pc->c, 0, 12); | 354 | memset(pc, 0, sizeof(*pc)); |
355 | pc->retries = 0; | ||
356 | pc->flags = 0; | ||
357 | pc->req_xfer = 0; | ||
358 | pc->buf = pc->pc_buf; | 355 | pc->buf = pc->pc_buf; |
359 | pc->buf_size = IDEFLOPPY_PC_BUFFER_SIZE; | 356 | pc->buf_size = IDEFLOPPY_PC_BUFFER_SIZE; |
360 | pc->callback = ide_floppy_callback; | 357 | pc->callback = ide_floppy_callback; |
@@ -561,12 +558,6 @@ static void idefloppy_create_start_stop_cmd(struct ide_atapi_pc *pc, int start) | |||
561 | pc->c[4] = start; | 558 | pc->c[4] = start; |
562 | } | 559 | } |
563 | 560 | ||
564 | static void idefloppy_create_test_unit_ready_cmd(struct ide_atapi_pc *pc) | ||
565 | { | ||
566 | idefloppy_init_pc(pc); | ||
567 | pc->c[0] = GPCMD_TEST_UNIT_READY; | ||
568 | } | ||
569 | |||
570 | static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, | 561 | static void idefloppy_create_rw_cmd(idefloppy_floppy_t *floppy, |
571 | struct ide_atapi_pc *pc, struct request *rq, | 562 | struct ide_atapi_pc *pc, struct request *rq, |
572 | unsigned long sector) | 563 | unsigned long sector) |
@@ -711,10 +702,10 @@ static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive) | |||
711 | set_disk_ro(floppy->disk, floppy->wp); | 702 | set_disk_ro(floppy->disk, floppy->wp); |
712 | page = &pc.buf[8]; | 703 | page = &pc.buf[8]; |
713 | 704 | ||
714 | transfer_rate = be16_to_cpu(*(u16 *)&pc.buf[8 + 2]); | 705 | transfer_rate = be16_to_cpup((__be16 *)&pc.buf[8 + 2]); |
715 | sector_size = be16_to_cpu(*(u16 *)&pc.buf[8 + 6]); | 706 | sector_size = be16_to_cpup((__be16 *)&pc.buf[8 + 6]); |
716 | cyls = be16_to_cpu(*(u16 *)&pc.buf[8 + 8]); | 707 | cyls = be16_to_cpup((__be16 *)&pc.buf[8 + 8]); |
717 | rpm = be16_to_cpu(*(u16 *)&pc.buf[8 + 28]); | 708 | rpm = be16_to_cpup((__be16 *)&pc.buf[8 + 28]); |
718 | heads = pc.buf[8 + 4]; | 709 | heads = pc.buf[8 + 4]; |
719 | sectors = pc.buf[8 + 5]; | 710 | sectors = pc.buf[8 + 5]; |
720 | 711 | ||
@@ -789,8 +780,8 @@ static int ide_floppy_get_capacity(ide_drive_t *drive) | |||
789 | for (i = 0; i < desc_cnt; i++) { | 780 | for (i = 0; i < desc_cnt; i++) { |
790 | unsigned int desc_start = 4 + i*8; | 781 | unsigned int desc_start = 4 + i*8; |
791 | 782 | ||
792 | blocks = be32_to_cpu(*(u32 *)&pc.buf[desc_start]); | 783 | blocks = be32_to_cpup((__be32 *)&pc.buf[desc_start]); |
793 | length = be16_to_cpu(*(u16 *)&pc.buf[desc_start + 6]); | 784 | length = be16_to_cpup((__be16 *)&pc.buf[desc_start + 6]); |
794 | 785 | ||
795 | debug_log("Descriptor %d: %dkB, %d blocks, %d sector size\n", | 786 | debug_log("Descriptor %d: %dkB, %d blocks, %d sector size\n", |
796 | i, blocks * length / 1024, blocks, length); | 787 | i, blocks * length / 1024, blocks, length); |
@@ -911,8 +902,8 @@ static int ide_floppy_get_format_capacities(ide_drive_t *drive, int __user *arg) | |||
911 | if (u_index >= u_array_size) | 902 | if (u_index >= u_array_size) |
912 | break; /* User-supplied buffer too small */ | 903 | break; /* User-supplied buffer too small */ |
913 | 904 | ||
914 | blocks = be32_to_cpu(*(u32 *)&pc.buf[desc_start]); | 905 | blocks = be32_to_cpup((__be32 *)&pc.buf[desc_start]); |
915 | length = be16_to_cpu(*(u16 *)&pc.buf[desc_start + 6]); | 906 | length = be16_to_cpup((__be16 *)&pc.buf[desc_start + 6]); |
916 | 907 | ||
917 | if (put_user(blocks, argp)) | 908 | if (put_user(blocks, argp)) |
918 | return(-EFAULT); | 909 | return(-EFAULT); |
@@ -1138,7 +1129,6 @@ static ide_driver_t idefloppy_driver = { | |||
1138 | .do_request = idefloppy_do_request, | 1129 | .do_request = idefloppy_do_request, |
1139 | .end_request = idefloppy_end_request, | 1130 | .end_request = idefloppy_end_request, |
1140 | .error = __ide_error, | 1131 | .error = __ide_error, |
1141 | .abort = __ide_abort, | ||
1142 | #ifdef CONFIG_IDE_PROC_FS | 1132 | #ifdef CONFIG_IDE_PROC_FS |
1143 | .proc = idefloppy_proc, | 1133 | .proc = idefloppy_proc, |
1144 | #endif | 1134 | #endif |
@@ -1166,7 +1156,9 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
1166 | floppy->flags &= ~IDEFLOPPY_FLAG_FORMAT_IN_PROGRESS; | 1156 | floppy->flags &= ~IDEFLOPPY_FLAG_FORMAT_IN_PROGRESS; |
1167 | /* Just in case */ | 1157 | /* Just in case */ |
1168 | 1158 | ||
1169 | idefloppy_create_test_unit_ready_cmd(&pc); | 1159 | idefloppy_init_pc(&pc); |
1160 | pc.c[0] = GPCMD_TEST_UNIT_READY; | ||
1161 | |||
1170 | if (idefloppy_queue_pc_tail(drive, &pc)) { | 1162 | if (idefloppy_queue_pc_tail(drive, &pc)) { |
1171 | idefloppy_create_start_stop_cmd(&pc, 1); | 1163 | idefloppy_create_start_stop_cmd(&pc, 1); |
1172 | (void) idefloppy_queue_pc_tail(drive, &pc); | 1164 | (void) idefloppy_queue_pc_tail(drive, &pc); |