Commit 49cac39e71bd6bbcf934c6ba837e21503902c088

Authored by Bartlomiej Zolnierkiewicz
1 parent 2ac07d9206

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>

Showing 2 changed files with 25 additions and 17 deletions Side-by-side Diff

drivers/ide/ide-floppy.c
... ... @@ -110,10 +110,6 @@
110 110 u8 cap_desc[8];
111 111 /* Copy of the flexible disk page */
112 112 u8 flexible_disk_page[32];
113   - /* Write protect */
114   - int wp;
115   - /* Supports format progress report */
116   - int srfp;
117 113 } idefloppy_floppy_t;
118 114  
119 115 #define IDEFLOPPY_TICKS_DELAY HZ/20 /* default delay for ZIP 100 (50ms) */
... ... @@ -574,8 +570,14 @@
574 570 " parameters\n");
575 571 return 1;
576 572 }
577   - floppy->wp = !!(pc.buf[3] & 0x80);
578   - set_disk_ro(disk, floppy->wp);
  573 +
  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 581 page = &pc.buf[8];
580 582  
581 583 transfer_rate = be16_to_cpup((__be16 *)&pc.buf[8 + 2]);
... ... @@ -614,7 +616,7 @@
614 616 idefloppy_floppy_t *floppy = drive->driver_data;
615 617 struct ide_atapi_pc pc;
616 618  
617   - floppy->srfp = 0;
  619 + drive->atapi_flags &= ~IDE_AFLAG_SRFP;
618 620  
619 621 idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE);
620 622 pc.flags |= PC_FLAG_SUPPRESS_ERROR;
... ... @@ -622,7 +624,9 @@
622 624 if (ide_queue_pc_tail(drive, floppy->disk, &pc))
623 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 630 return 0;
627 631 }
628 632  
... ... @@ -820,7 +824,7 @@
820 824 struct ide_atapi_pc pc;
821 825 int progress_indication = 0x10000;
822 826  
823   - if (floppy->srfp) {
  827 + if (drive->atapi_flags & IDE_AFLAG_SRFP) {
824 828 idefloppy_create_request_sense_cmd(&pc);
825 829 if (ide_queue_pc_tail(drive, floppy->disk, &pc))
826 830 return -EIO;
... ... @@ -1044,7 +1048,7 @@
1044 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 1052 ret = -EROFS;
1049 1053 goto out_put_floppy;
1050 1054 }
... ... @@ -356,21 +356,25 @@
356 356 IDE_AFLAG_CLIK_DRIVE = (1 << 19),
357 357 /* Requires BH algorithm for packets */
358 358 IDE_AFLAG_ZIP_DRIVE = (1 << 20),
  359 + /* Write protect */
  360 + IDE_AFLAG_WP = (1 << 21),
  361 + /* Supports format progress report */
  362 + IDE_AFLAG_SRFP = (1 << 22),
359 363  
360 364 /* ide-tape */
361   - IDE_AFLAG_IGNORE_DSC = (1 << 21),
  365 + IDE_AFLAG_IGNORE_DSC = (1 << 23),
362 366 /* 0 When the tape position is unknown */
363   - IDE_AFLAG_ADDRESS_VALID = (1 << 22),
  367 + IDE_AFLAG_ADDRESS_VALID = (1 << 24),
364 368 /* Device already opened */
365   - IDE_AFLAG_BUSY = (1 << 23),
  369 + IDE_AFLAG_BUSY = (1 << 25),
366 370 /* Attempt to auto-detect the current user block size */
367   - IDE_AFLAG_DETECT_BS = (1 << 24),
  371 + IDE_AFLAG_DETECT_BS = (1 << 26),
368 372 /* Currently on a filemark */
369   - IDE_AFLAG_FILEMARK = (1 << 25),
  373 + IDE_AFLAG_FILEMARK = (1 << 27),
370 374 /* 0 = no tape is loaded, so we don't rewind after ejecting */
371   - IDE_AFLAG_MEDIUM_PRESENT = (1 << 26),
  375 + IDE_AFLAG_MEDIUM_PRESENT = (1 << 28),
372 376  
373   - IDE_AFLAG_NO_AUTOCLOSE = (1 << 27),
  377 + IDE_AFLAG_NO_AUTOCLOSE = (1 << 29),
374 378 };
375 379  
376 380 struct ide_drive_s {