diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:38 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-10 16:39:38 -0400 |
commit | 49cac39e71bd6bbcf934c6ba837e21503902c088 (patch) | |
tree | 9096b78a0dc35c70375d4349aabe0f896e681416 /drivers/ide/ide-floppy.c | |
parent | 2ac07d920604eeee8966d52e70161f9b31fe90a3 (diff) |
ide-floppy: ->{srfp,wp} -> IDE_AFLAG_{SRFP,WP}
Add IDE_AFLAG_{SRFP,WP} drive->atapi_flags and use them
instead of ->{srfp,wp} struct ide_floppy_obj fields.
There should be no functional changes caused by this patch.
Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r-- | drivers/ide/ide-floppy.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index de611c57b280..78d92835a3c1 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -110,10 +110,6 @@ typedef struct ide_floppy_obj { | |||
110 | u8 cap_desc[8]; | 110 | u8 cap_desc[8]; |
111 | /* Copy of the flexible disk page */ | 111 | /* Copy of the flexible disk page */ |
112 | u8 flexible_disk_page[32]; | 112 | u8 flexible_disk_page[32]; |
113 | /* Write protect */ | ||
114 | int wp; | ||
115 | /* Supports format progress report */ | ||
116 | int srfp; | ||
117 | } idefloppy_floppy_t; | 113 | } idefloppy_floppy_t; |
118 | 114 | ||
119 | #define IDEFLOPPY_TICKS_DELAY HZ/20 /* default delay for ZIP 100 (50ms) */ | 115 | #define IDEFLOPPY_TICKS_DELAY HZ/20 /* default delay for ZIP 100 (50ms) */ |
@@ -574,8 +570,14 @@ static int ide_floppy_get_flexible_disk_page(ide_drive_t *drive) | |||
574 | " parameters\n"); | 570 | " parameters\n"); |
575 | return 1; | 571 | return 1; |
576 | } | 572 | } |
577 | floppy->wp = !!(pc.buf[3] & 0x80); | 573 | |
578 | set_disk_ro(disk, floppy->wp); | 574 | if (pc.buf[3] & 0x80) |
575 | drive->atapi_flags |= IDE_AFLAG_WP; | ||
576 | else | ||
577 | drive->atapi_flags &= ~IDE_AFLAG_WP; | ||
578 | |||
579 | set_disk_ro(disk, !!(drive->atapi_flags & IDE_AFLAG_WP)); | ||
580 | |||
579 | page = &pc.buf[8]; | 581 | page = &pc.buf[8]; |
580 | 582 | ||
581 | transfer_rate = be16_to_cpup((__be16 *)&pc.buf[8 + 2]); | 583 | transfer_rate = be16_to_cpup((__be16 *)&pc.buf[8 + 2]); |
@@ -614,7 +616,7 @@ static int idefloppy_get_sfrp_bit(ide_drive_t *drive) | |||
614 | idefloppy_floppy_t *floppy = drive->driver_data; | 616 | idefloppy_floppy_t *floppy = drive->driver_data; |
615 | struct ide_atapi_pc pc; | 617 | struct ide_atapi_pc pc; |
616 | 618 | ||
617 | floppy->srfp = 0; | 619 | drive->atapi_flags &= ~IDE_AFLAG_SRFP; |
618 | 620 | ||
619 | idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE); | 621 | idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE); |
620 | pc.flags |= PC_FLAG_SUPPRESS_ERROR; | 622 | pc.flags |= PC_FLAG_SUPPRESS_ERROR; |
@@ -622,7 +624,9 @@ static int idefloppy_get_sfrp_bit(ide_drive_t *drive) | |||
622 | if (ide_queue_pc_tail(drive, floppy->disk, &pc)) | 624 | if (ide_queue_pc_tail(drive, floppy->disk, &pc)) |
623 | return 1; | 625 | return 1; |
624 | 626 | ||
625 | floppy->srfp = pc.buf[8 + 2] & 0x40; | 627 | if (pc.buf[8 + 2] & 0x40) |
628 | drive->atapi_flags |= IDE_AFLAG_SRFP; | ||
629 | |||
626 | return 0; | 630 | return 0; |
627 | } | 631 | } |
628 | 632 | ||
@@ -820,7 +824,7 @@ static int ide_floppy_get_format_progress(ide_drive_t *drive, int __user *arg) | |||
820 | struct ide_atapi_pc pc; | 824 | struct ide_atapi_pc pc; |
821 | int progress_indication = 0x10000; | 825 | int progress_indication = 0x10000; |
822 | 826 | ||
823 | if (floppy->srfp) { | 827 | if (drive->atapi_flags & IDE_AFLAG_SRFP) { |
824 | idefloppy_create_request_sense_cmd(&pc); | 828 | idefloppy_create_request_sense_cmd(&pc); |
825 | if (ide_queue_pc_tail(drive, floppy->disk, &pc)) | 829 | if (ide_queue_pc_tail(drive, floppy->disk, &pc)) |
826 | return -EIO; | 830 | return -EIO; |
@@ -1044,7 +1048,7 @@ static int idefloppy_open(struct inode *inode, struct file *filp) | |||
1044 | goto out_put_floppy; | 1048 | goto out_put_floppy; |
1045 | } | 1049 | } |
1046 | 1050 | ||
1047 | if (floppy->wp && (filp->f_mode & 2)) { | 1051 | if ((drive->atapi_flags & IDE_AFLAG_WP) && (filp->f_mode & 2)) { |
1048 | ret = -EROFS; | 1052 | ret = -EROFS; |
1049 | goto out_put_floppy; | 1053 | goto out_put_floppy; |
1050 | } | 1054 | } |